Review workflow secrets security #147
Replies: 6 comments 3 replies
-
List of secrets we are using: Repository secrets:
Other secrets:
|
Beta Was this translation helpful? Give feedback.
-
I have changed the organization's default workflow permissions: I think it will help us to have a more restricted approach and also to be more explicit in defining permissions for the workflows. One of the test projects' workflow has failed: Previous default permissions: New default permissions: I suppose we need to add the |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
This is in general a list of nice-to-have things about security: https://bestpractices.coreinfrastructure.org/en/projects?q=git-queue |
Beta Was this translation helpful? Give feedback.
-
@da2ce7 regarding not trusting third-party actions like for example the one used by MegaLinter, right now with the most restricted workflow permissions the MegaLinter workflow GITHUB_TOKEN would have these permissions: And it seems the workflow has only those permissions even if you execute it having write permissions with a local branch. |
Beta Was this translation helpful? Give feedback.
-
Creating a PR from a fork shows this warning: |
Beta Was this translation helpful? Give feedback.
-
@da2ce7 and I were discussing workflow secrets. We have to review them in order to avoid someone stealing the secrets.
I'm going to start the discussion with some useful links to read before going deep into the details.
LINKS
GitHub docs: Implementing least privilege for secrets in GitHub Actions
GitHub docs: Environment secrets.
Using CODEOWNERS to monitor changes. You can use the CODEOWNERS feature to control how changes are made to your workflow files
GitHub docs: Deployment branches.
GitHub Community Forum: Limit secrets to specific branches
branch-based-secrets GitHub Action. Dynamically use different secrets depending on the current branch the action is currently running on.
Keeping your GitHub Actions and workflows secure Part 1: Preventing pwn requests.
Github Actions and the threat of malicious pull requests.
Using Environment Protection Rules to Secure Secrets When Building External Forks with pull_request_target
GitHub Actions & Security: Best practices
Staroverflow question: How to Define Github Branch Specific Secret or an Alternative?.
Blog post: Stealing arbitrary GitHub Actions secrets.
Beta Was this translation helpful? Give feedback.
All reactions