- Notifications
You must be signed in to change notification settings - Fork3.1k
feat: Add fine-grained permissions support and tool permissions docs (Phase 2)#1486
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:SamMorrowDrums/oauth-scopes
Are you sure you want to change the base?
Conversation
Phase 2 of OAuth scopes work:- Extend pkg/scopes package with fine-grained permission types: - Permission type with constants (actions, contents, issues, etc.) - PermissionLevel type (read, write, admin) - FineGrainedPermission struct and helper functions - WithScopesAndPermissions(), AddPermissions(), GetPermissionsFromMeta() - ReadPerm(), WritePerm(), AdminPerm() convenience functions- Create comprehensive docs/tool-permissions.md: - OAuth scope hierarchy reference - Fine-grained permission levels explanation - Tool-by-category permission tables for all ~90 tools - Minimum required scopes by use case - Notes about limitations and special cases- Update README.md with links to permissions docs: - Link in Prerequisites section for PAT creation - Callout note before Tools section- Add tests for all new fine-grained permission functionality
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Pull request overview
This PR adds comprehensive support for fine-grained personal access token permissions alongside existing OAuth scope support, and provides detailed documentation to help users understand authentication requirements for each tool.
Key Changes:
- Extended the scopes package with fine-grained permission types, levels, and utility functions
- Created comprehensive tool permissions documentation mapping 100+ tools to their required OAuth scopes and fine-grained permissions
- Updated README to link to the new permissions documentation
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
pkg/scopes/scopes.go | Added fine-grained permission types (Permission,PermissionLevel,FineGrainedPermission) with 20+ permission constants, and 7 new functions for working with permissions in tool metadata |
pkg/scopes/scopes_test.go | Added 5 comprehensive test functions covering all new permission functionality including helper functions, metadata operations, and edge cases |
docs/tool-permissions.md | Created new 312-line documentation file organizing all tools by category with OAuth scopes and fine-grained permissions, plus permission hierarchy explanations and use-case guides |
README.md | Added two strategic links to the new tool permissions documentation in the Prerequisites and Tools sections |
Summary
This PR adds fine-grained permission types to the scopes package and creates comprehensive tool permissions documentation.
Changes
Extended
pkg/scopes/scopes.goAdded support for fine-grained personal access token permissions:
New Types:
Permission- Fine-grained permission constants (e.g.,PermActions,PermContents,PermIssues,PermPullRequests)PermissionLevel- Access levels (PermissionRead,PermissionWrite,PermissionAdmin)FineGrainedPermission- Struct combining permission and levelNew Functions:
WithScopesAndPermissions()- Create Meta with both OAuth scopes and fine-grained permissionsAddPermissions()- Add permissions to existing Meta mapGetPermissionsFromMeta()- Extract permissions from tool MetaReadPerm(),WritePerm(),AdminPerm()- Convenience constructorsPerm()- General permission constructorNew
docs/tool-permissions.mdComprehensive documentation covering:
Categories documented:
Updated README.md
Added links to the new permissions documentation:
Testing
TestFineGrainedPermissionStringTestWithScopesAndPermissionsTestAddPermissionsTestAddPermissionsToNilMetaTestGetPermissionsFromMetaTestPermHelperFunctionsPart of OAuth Scopes Work (Phase 2 of 4)