-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Redesign Scoped Access Tokens #24767
Changes from 57 commits
ce18b9a
17663a4
2b2cdc9
8c0e8dc
0fc8dd1
5bb478d
3bb330e
28c9dcd
5d90011
b439ccf
e405ab5
8850928
c05d22e
de80a3d
6df3808
149cb89
21be460
9eca1fe
bb59102
a077bd0
c95343c
2486584
80772f9
2216d6b
2996b87
4c406d9
2bdeac0
cdef14b
be57005
eff94f1
94424cb
75254a0
5da5715
80bcbee
b46fd71
bb9ab9c
8fe485b
fa903f9
26a4914
c7ff458
76b7dbf
30faca5
1ad3b7e
577673b
f932ad8
2ba71e1
9e7f300
fcc8595
b4ad948
4d67b4a
af17f87
04f55e1
24a1a99
67a63fe
89c640b
f3390f6
d36f036
a3d67d1
c749400
d8d1472
1c3023e
566ea50
02a1b03
67e1531
fccb03e
cb233ca
4d3fea8
a855029
cb6c9ee
45e8376
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,42 +44,53 @@ To use the Authorization Code Grant as a third party application it is required | |
|
||
## Scopes | ||
|
||
Gitea supports the following scopes for tokens: | ||
Gitea supports scoped access tokens, which allow users the ability to restrict tokens to operate only on selected url routes. Scopes are grouped by high-level API routes, and further refined to the following: | ||
|
||
- `read`: `GET` routes | ||
- `write`: `POST`, `PUT`, and `PATCH` routes (in addition to `GET`) | ||
- `delete`: `DELETE` routes (in addition to `POST`, `PUT`, `PATCH` and `GET`) | ||
|
||
Gitea token scopes are as follows: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The "public only" is not mentioned here but appears in code, I still have difficulty to understand what is "public only" or what it affects ..... |
||
|
||
| Name | Description | | ||
| ---- | ----------- | | ||
| **(no scope)** | Grants read-only access to public user profile and public repositories. | | ||
| **repo** | Full control over all repositories. | | ||
| **repo:status** | Grants read/write access to commit status in all repositories. | | ||
| **public_repo** | Grants read/write access to public repositories only. | | ||
| **admin:repo_hook** | Grants access to repository hooks of all repositories. This is included in the `repo` scope. | | ||
| **write:repo_hook** | Grants read/write access to repository hooks | | ||
| **read:repo_hook** | Grants read-only access to repository hooks | | ||
| **admin:org** | Grants full access to organization settings | | ||
| **write:org** | Grants read/write access to organization settings | | ||
| **read:org** | Grants read-only access to organization settings | | ||
| **admin:public_key** | Grants full access for managing public keys | | ||
| **write:public_key** | Grant read/write access to public keys | | ||
| **read:public_key** | Grant read-only access to public keys | | ||
| **admin:org_hook** | Grants full access to organizational-level hooks | | ||
| **admin:user_hook** | Grants full access to user-level hooks | | ||
| **notification** | Grants full access to notifications | | ||
| **user** | Grants full access to user profile info | | ||
| **read:user** | Grants read access to user's profile | | ||
| **user:email** | Grants read access to user's email addresses | | ||
| **user:follow** | Grants access to follow/un-follow a user | | ||
| **delete_repo** | Grants access to delete repositories as an admin | | ||
| **package** | Grants full access to hosted packages | | ||
| **write:package** | Grants read/write access to packages | | ||
| **read:package** | Grants read access to packages | | ||
| **delete:package** | Grants delete access to packages | | ||
| **admin:gpg_key** | Grants full access for managing GPG keys | | ||
| **write:gpg_key** | Grants read/write access to GPG keys | | ||
| **read:gpg_key** | Grants read-only access to GPG keys | | ||
| **admin:application** | Grants full access to manage applications | | ||
| **write:application** | Grants read/write access for managing applications | | ||
| **read:application** | Grants read access for managing applications | | ||
| **sudo** | Allows to perform actions as the site admin. | | ||
| **(no scope)** | Not supported. A scope is required even for public repositories. | | ||
lunny marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| **activitypub** |`activitypub` API routes: ActivityPub related operations. | | ||
| **read:activitypub** | Grants read access for ActivityPub operations. | | ||
| **write:activitypub** | Grants read/write access for ActivityPub operations. | | ||
| **delete:activitypub** | Grants read/write/delete access for ActivityPub operations. Currently the same as `write:activitypub`. | | ||
| **admin** | `/admin/*` API routes: Site-wide administrative operations (hidden for non-admin accounts). | | ||
| **read:admin** | Grants read access for admin operations, such as getting cron jobs or registered user emails. | | ||
| **write:admin** | Grants read/write access for admin operations, such as running cron jobs or updating user accounts. | | ||
| **delete:admin** | Grants read/write/delete access for admin operations, such as deleting user accounts. | | ||
| **issue** | `issues/*`, `labels/*`, `milestones/*` API routes: Issue-related operations. | | ||
| **read:issue** | Grants read access for issues operations, such as getting issue comments, issue attachments, and milestones. | | ||
| **write:issue** | Grants read/write access for issues operations, such as posting or editing an issue comment or attachment, and updating milestones. | | ||
| **delete:issue** | Grants read/write/delete access for issues operations, such as deleting comments, labels or issue attachments. | | ||
| **misc** | miscellaneous and settings top-level API routes. | | ||
| **read:misc** | Grants read access to miscellaneous operations, such as getting label and gitignore templates. | | ||
| **write:misc** | Grants read/write access to miscellaneous operations, such as markup utility operations. | | ||
| **delete:misc** | Grants read/write/delete access to miscellaneous operations. Currently the same as `write:misc`. | | ||
| **notification** | `notification/*` API routes: user notification operations. | | ||
| **read:notification** | Grants read access to user notifications, such as which notifications users are subscribed to and read new notifications. | | ||
| **write:notification** | Grants read/write access to user notifications, such as marking notifications as read. | | ||
| **delete:notification** | Grants read/write/delete access to user notifications. Currently the same as `write:notification`. | | ||
| **organization** | `orgs/*` and `teams/*` API routes: Organization and team management operations. | | ||
| **read:organization** | Grants read access to org and team status, such as listing all orgs a user has visibility to, teams, and team members. | | ||
| **write:organization** | Grants read/write access to org and team status, such as creating and updating teams and updating org settings. | | ||
| **delete:organization** | Grants read/write/delete access to org and team status, such as deleting teams and orgs. | | ||
| **package** | `/packages/*` API routes: Packages operations | | ||
| **read:package** | Grants read access to package operations, such as reading and downloading available packages. | | ||
| **write:package** | Grants read/write access to package operations. Currently the same as `read:package`. | | ||
| **delete:package** | Grants read/write/delete access to package operations, such as deleting packages. | | ||
| **repository** | `/repos/*` API routes except `/repos/issues/*`: Repository file, pull-request, and release operations. | | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have a slight feeling that this is precisely the category we should split up into distinct categories as those are again completely different subcategories - typically, you either want the whole package, or you only want to interact with 2-3 parts of the API, i.e. pulling all issues and PRs, perhaps writing back to them or creating a new release. |
||
| **read:repository** | Grants read access to repository operations, such as getting repository files, releases, collaborators. | | ||
| **write:repository** | Grants read/write access to repository operations, such as getting updating repository files, creating pull requests, updating collaborators. | | ||
| **delete:repository** | Grants read/write/delete access to repository operations, such as getting deleting repository file, delete pull-request, removing collaborators. | | ||
| **user** | `/user/*` and `/users/*` API routes: User-related operations. | | ||
| **read:user** | Grants read access to user operations, such as getting user repo subscriptions and user settings. | | ||
| **write:user** | Grants read/write access to user operations, such as updating user repo subscriptions, followed users, and user settings. | | ||
| **delete:user** | Grants read/write/delete access to user operations, such as removing user repo subscriptions. | | ||
|
||
## Client types | ||
|
||
|
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.
I guess something like "full" or "manage" is a better name than "delete".
For example: IMO "transfer a repo" is "full manage", but not "write" or "delete".