Repository navigation
Use project read-only deploy-token to clone gitlab repos - #7590
Merged
Merged
Conversation
Pipelines clone with the OAuth token of the repository user, which often reaches every repository of that user with write access. A leaked clone credential should reach only one repository, read-only. Repo.CloneSecret stores credentials a forge created for one repository, like a read-only deploy token. It is not part of the API. Forges write it in Activate. Repair and move saved the repo before Activate, so they now save it again afterwards. A deactivated repo drops it. No forge uses it yet.
GitLab pipelines cloned with the OAuth token of the repository user, which has the api scope for everything that user can reach. Activation now creates the project deploy token woodpecker-clone with only the read_repository scope and stores it in the clone secret. Repair replaces it and deactivation deletes it. Netrc hands it to the clone step. The token does not expire, so a refreshed user token no longer affects queued pipelines. Creating a deploy token needs the Maintainer role. If it fails, activation still works and pipelines clone with the user token as before. Repositories activated earlier get the token on repair.
Member
Author
|
PS: gitea also supports it: https://docs.gitea.com/api/operations/repo-create-deploy-token/ I just want to start with one forge and then widen it ... |
Contributor
|
Surge PR preview deployment was removed |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #7590 +/- ##
==========================================
+ Coverage 66.87% 66.96% +0.08%
==========================================
Files 451 451
Lines 22646 22668 +22
==========================================
+ Hits 15145 15180 +35
+ Misses 7501 7488 -13 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
qwerty287
reviewed
Nov 20, 2026
Aligns it with the other remote IDs (review).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add option to store repo specific clone secrets.
So we can have scoped pinned down to repo read only secrets for each repo.
And do initial implementation for gitlab