Is this an open source repository, where people will be using forks to propose changes to your workflow?

If so, see these docs. The default setting requires approval of workflows to run for all outside collaborators, which means other people won't be able to extract your secrets.

🌐
GitHub
github.com › github › docs › issues › 1087
Clarify permission level needed to access secrets · Issue #1087 · github/docs
November 5, 2020 - To create secrets for an organization repository, you must have admin access. ... Authenticated users must have collaborator access to a repository to create, update, or read secrets.
Author   muru
🌐
Brainly
brainly.com › computers and technology › high school › access to github secrets requires at least collaborator access. select yes if the statement is true. otherwise, select no.
[FREE] Access to GitHub secrets requires at least collaborator access. Select Yes if the statement is true. - brainly.com
The statement is TRUE; access to GitHub secrets requires at least collaborator access, making the correct answer "Yes." Collaborators can manage secrets associated with a repository, while repository owners have complete access.
Discussions

git - Manage secrets in GitHub Actions - Stack Overflow
I'm trying to find the way how to secretly deploy my Azure access keys to inject them into GitHub Actions. The problem is that I have no access to the Settings of a GitHub repo, admin of the repo i... More on stackoverflow.com
🌐 stackoverflow.com
Access to GitHub secrets requires at least collaborator access. Select Yes if the statement is true. Otherwise, select No.
Answer to Access to GitHub secrets requires at least More on chegg.com
🌐 chegg.com
1
April 25, 2022
git - Is it okay to use GitHub Secrets with a public repo? - Stack Overflow
I have a private repo with a GitHub Action that pushes the code to an AWS S3 bucket when there's a new push to the master branch. I need a pair of access keys to be able to push the contents and I'm More on stackoverflow.com
🌐 stackoverflow.com
Secrets: which permission do my developer needs and is there a "service account"?
As far as I know, only admins can set secrets. But there is an alternative. To communicate with aws you don't need any secrets. You can register GitHub as a OIDC provider in your aws account. You then create a role with a trust relationship to that GitHub OIDC provider with the name of your org and repo. Now adding the needed permission to the role. In GitHub Actions you now can set the permission for the idtoken to write and use the setup aws credentials actions. All it needs is the arn of your role which is not really a secret. No long lived secrets, less management. GitHub has a nice gide on that. More on reddit.com
🌐 r/github
4
0
April 10, 2024
🌐
GitHub
docs.github.com › en › rest › actions › secrets
REST API endpoints for GitHub Actions Secrets - GitHub Docs
Authenticated users must have collaborator access to a repository to create, update, or read secrets. OAuth app tokens and personal access tokens (classic) need the admin:org scope to use this endpoint.
🌐
Mikepenz
blog.mikepenz.dev › a › manage-secrets-ga
Manage Secrets in GitHub Actions | Mike Penz
GitHub offers repo maintainers to define secrets via the repo settings. One very important detail for repositories with collaborators is, that you fully trust everybody with collaborator access, as secrets added for public repositories will also be available to collaborators.
🌐
GitHub
docs.github.com › en › actions › security-for-github-actions › security-guides › using-secrets-in-github-actions
Using secrets in GitHub Actions - GitHub Docs
To create secrets or variables ... access. Lastly, to create secrets or variables for a personal account repository or an organization repository through the REST API, you must have collaborator access....
🌐
Mackorone
mackorone.com › 2021 › 04 › 02 › collaborators-and-secrets.html
Collaborators And Secrets - Posts
Last week, I migrated CI for my ... caught my attention: Secrets are environment variables that are encrypted. Anyone with collaborator access to this repository can use these secrets for Actions....
Find elsewhere
🌐
Blacksmith
blacksmith.sh › blog › best-practices-for-managing-secrets-in-github-actions
Best Practices for Managing Secrets in GitHub Actions | Blacksmith
Only repository owners and collaborators with appropriate permissions can access and modify these secrets. Environment Secrets: Environment secrets add an extra layer of security by being specific to designated environments (like development, ...
🌐
DevOps Journal
devopsjournal.io › blog › 2022 › 11 › 02 › GitHub-secrets-without-admin-rights
Working with GitHub secrets without admin rights | DevOps Journal
November 2, 2022 - # list secrets for that environment: gh api repos/<OWNER>/<REPO>/environments/<ENVIRONMENT>/secrets · For creating environments in your own user space, you have Admin access so you can use this API call. If you add a body you can the timeout rule, specify protection rules (who needs to approve the job that targets the environment) as well as the deployment branch rule (which branch is allowed to target that environment). gh api -X PUT /repos/<OWNER>/<REPO>/environments/NEW_ENVIRONMENT ... If you are invited as a Collaborator to another user’s repo, you cannot create environments with the API.
Top answer
1 of 2
65

Yes, secrets are safe to use in public repositories but there are some things you should be careful about.

  • All secrets are automatically masked in build logs and show as ***. However, if during your workflow you create a sensitive credential from a secret (e.g. base64 an API key) then you should mask the new value so it doesn't leak in the build log.

    echo "::add-mask::My sensitive value"
    
  • If you are very concerned about the security of your secrets, I would also suggest not using third party GitHub actions directly by following the action's tags or branches. Fork the action and use your fork in workflows. This will prevent the possibility of someone modifying an action you are using to capture secrets being used by the action, and send them to some external server under their control.

    Alternatively, use the action directly and reference the commit hash for the version you want to target.

    - uses: thirdparty/foo-action@172ec762f2ac8e050062398456fccd30444f8f30
    
  • Use two-factor authentication (2FA) on your account. If your account is compromised, it's trivial for an attacker to create a workflow and export your secrets.

  • Repository collaborators or any organization users with write access are able to create a workflow to export secrets. So manage access to your repository carefully.

Points related to pull requests:

  • Public repository pull_request events triggered by forks do not have access to secrets, except for the default GITHUB_TOKEN. Additionally, The GITHUB_TOKEN has read-only access when an event is triggered by a forked repository. These are intentional restrictions enforced by GitHub Actions to prevent an attacker creating a pull request containing a workflow that captures secrets, or uses secrets to perform operations.
  • The pull_request_target event does not have secret restrictions for events triggered by forks. By default it checks out the last commit on the base branch, but it is possible to checkout the pull request HEAD. Choosing to do this requires extreme caution. Passing secrets to any code that could be modified in a pull request could allow an attacker to write code to export secrets.
2 of 2
3

Yes, it appears so. According to Github, you have organization-level access control policies to who can access your secrets.

For secrets stored at the organization-level, you can use access policies to control which repositories can use organization secrets. Organization-level secrets let you share secrets between multiple repositories, which reduces the need for creating duplicate secrets. Updating an organization secret in one location also ensures that the change takes effect in all repository workflows that use that secret.

Whether the repository is public or private does not affect this, and that makes sense. Public projects need secrets, too.

🌐
OnboardBase
onboardbase.com › blog › github-secrets
Github Secrets: A Complete Guide
November 10, 2022 - To create secrets for an organization repository, you must have admin access. ... Onboardbase is a solid alternative to GitHub Secrets that focuses on team collaboration. Each teammate can be given permission to use secrets based on their role ...
🌐
Octopus Deploy
octopus.com › blog › githubactions-secrets
Secrets In GitHub Actions | Octopus blog
March 1, 2022 - GitHub ties repository secrets to only one repository. They’re available to anyone with the collaborator role to use in actions.
🌐
GitHub
docs.github.com › en › code-security › reference › secret-security › understanding-github-secret-types
Understanding GitHub secret types - GitHub Docs
Users with admin access to the repository can create and manage Actions secrets. Users with collaborator access to the repository can use the secret.
🌐
GitHub
docs.github.com › en › enterprise-cloud@latest › code-security › getting-started › understanding-github-secret-types
Understanding GitHub secret types - GitHub Enterprise Cloud Docs
Users with admin access to the repository can create and manage Actions secrets. Users with collaborator access to the repository can use the secret.