feat: Add configurable permissions for Actions automatic tokens#36173
feat: Add configurable permissions for Actions automatic tokens#36173lunny merged 332 commits intogo-gitea:mainfrom
Conversation
|
@lunny @wxiaoguang Please review this |
|
Thank you for asking me to review, but I don't use Actions. You can invite the maintainers from the original issue to review. |
@silverwind Please review |
|
I review mostly frontend stuff and am not much of an actions user myself, so please be patient until someone finds time to review it properly. |
No problem |
|
By the way, I see another (older) PR: Feat/actions token permissions #36113 , it added more than 2000 lines of code. What are the differences? Which PR would win ....... @Zettat123 |
This PR doesn't fully implement the proposal in #24635. (For example, it doesn't support configuring actions access between repositories in the same organization) It seems that #36113 implemented these features, but I think its code needs improvement. |
|
@Zettat123 @silverwind Pls give me a few hours(15-20 hours) and this PR will be ready to go |
But "PR: Feat/actions token permissions #36113" came first, and it is more complete, why not respect the first author, but only review this second one? |
@wxiaoguang should i close my pr ? |
I don't know. Reviewers decide. |
I reviewed both PRs, but did not receive responses to my comments in #36113. If @Excellencedev will address the review comments, I think we should keep this PR. |
|
Imho, the only sensible thing we can do is race these 2 PRs. |
|
Adressed most your comments in my latest commit, now i just need to make sure i fully implement the proposal in #24635 |
|
According to the solution in #24635, I think this PR does not implement:
|
Ok no problem. I'm working on it |
|
@Zettat123 My PR is now ready for review ! |
the grammar looks good |
see b10db5d |
What does this do?
|
It checks if the HTML has a data-collaborate attribute and, if so, adds it to the search URL as a filter. This allows the search to either include or exclude repositories where the user is only a collaborator |
Is it your guess? Or your AI's answer? Where is |
ChristopherHX
left a comment
There was a problem hiding this comment.
I confirm
- the user and org cross-repo setting no longer shows (also does not allow to add) repositories of a different owner
- a deleted repository disappears from the cross-repo list (user settings page)
- changing settings does save if UI matches backend revision
Some things that didn't feel right to me
- you can press add repo without having any selected (more or less just does a reload)
- Non Issue so far
having an previous settings page js in the cache did clear cross-repo setting and shows broken form for me (idk what pr revision that was based on before)
Fixed in e1d11ae
|
|
should i do a pr to gitea docs ? |
I think yes. We need a PR to gitea docs. |
|
@lunny Added a PR: https://gitea.com/gitea/docs/pulls/366 |



Overview
This PR introduces granular permission controls for Gitea Actions tokens (
GITEA_TOKEN), aligning Gitea's security model with GitHub Actions standards while maintaining compatibility with Gitea's unique repository unit system.It addresses the need for finer access control by allowing administrators and repository owners to define default token permissions, set maximum permission ceilings, and control cross-repository access within organizations.
Key Features
1. Granular Token Permissions
permissions:keyword in workflow and job YAML files (e.g.,contents: read,issues: write).contentsandpackages, with no access to other units.Custom: Allows defining specific default levels for each unit type (Code, Issues, PRs, Packages, etc.).EDIT removed UI was confusing2. Organization & Repository Settings
3. Security Hardening
Package Access: Actions tokens can now only access packages explicitly linked to a repository, with cross-repo access governed by the organization's security policy.EDIT removed feat: Add configurable permissions for Actions automatic tokens #36173 (comment)4. Technical Implementation
action_run_jobtable. This ensures the token's authority is deterministic throughout the job's lifecycle.contentsscope is applied first, allowing granular scopes likecodeorreleasesto override it for precise control.How to Test
go test ./services/actions/...andgo test ./models/repo/...to verify parsing logic and permission clamping.tests/integration/actions_job_token_test.gocovering:permissions:keyword evaluation.GITEA_TOKENcapabilities.Documentation
Added a PR in gitea's docs for this : https://gitea.com/gitea/docs/pulls/366
UI:
/fixes #24635
/claim #24635