The secrets of repositories using github actions can be modified by a collaborator using the REST API #159727
Replies: 1 comment
-
Hi there, Thanks for bringing this up — it’s a very important topic, especially for teams that rely heavily on GitHub Actions and proper permission management. What you’ve described appears to align with the current behavior of GitHub’s permissions model, where users with the "Write" role (which includes collaborators) have the ability to create, update, and delete repository-level secrets via both the UI and the CLI/REST API. This is considered expected behavior and is documented in GitHub’s permission documentation. Unfortunately, at this time, there is no granular permission setting at the repository level that would allow you to prevent collaborators with write access from modifying secrets while still retaining their ability to contribute to the repository in other ways (e.g., pushing code, creating PRs). Options You Can Consider:
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Select Topic Area
Question
Body
Hello,
The secrets of repositories using github actions can be modified by a collaborator using the REST API. I'm not sure if this is a bug or an expected behavior
Is there a way to limit this behavior with github permissions, so that collaborators cannot modify the values of secrets using the REST API.
To recreate it you can have two users and add one as a contributor to a private repository. Create with the owner of the repository the secret in Settings > Secrets and Variables > Actions > New repository secret
With the user with the role of collaborator the repository is cloned and using ghcli you can change the value of the created secret. The command is:
gh secret set <secret_name> -b "secret_value_changed_by_collaborator"
thanks in advance for the help
Beta Was this translation helpful? Give feedback.
All reactions