-
Notifications
You must be signed in to change notification settings - Fork 63.2k
docs: security hardening info for actions untrusted content #38048
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
wrslatz
wants to merge
34
commits into
github:main
Choose a base branch
from
wrslatz:gha-hardening-pull-request-target
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+81
−3
Open
Changes from 21 commits
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
81db9f3
docs: untrusted code risks in actions
wrslatz e4df5a1
docs: expand pull_request_target warning links
wrslatz bccd376
docs: warning for workflow_run security risks
wrslatz e6a50fb
Update content/actions/how-tos/security-for-github-actions/security-g…
Sharra-writes 834a877
Update content/actions/how-tos/security-for-github-actions/security-g…
Sharra-writes 809c2c5
Update content/actions/how-tos/security-for-github-actions/security-g…
Sharra-writes d03bd88
Update data/reusables/actions/pull-request-target-permissions-warning.md
Sharra-writes b1ff7f6
Update data/reusables/actions/workflow-run-permissions-warning.md
Sharra-writes 1871bfa
docs: sync hardening info to enterprise-onboarding
wrslatz 153ca42
docs: fix grammar and improve content in reusables
wrslatz f710cb9
Merge branch 'main' into gha-hardening-pull-request-target
wrslatz ae2c0e4
Merge branch 'main' into gha-hardening-pull-request-target
wrslatz ca12535
Merge branch 'main' into gha-hardening-pull-request-target
wrslatz 36b6336
Merge branch 'main' into gha-hardening-pull-request-target
wrslatz 9bde44a
Merge branch 'main' into gha-hardening-pull-request-target
Sharra-writes f38780a
Merge branch 'main' into gha-hardening-pull-request-target
wrslatz 205713f
Merge branch 'main' into gha-hardening-pull-request-target
wrslatz 8f7d1fa
Merge branch 'main' into gha-hardening-pull-request-target
wrslatz 2b28b60
Merge branch 'main' into gha-hardening-pull-request-target
wrslatz 3b24c7d
Update content/actions/reference/security/secure-use.md
Sharra-writes 454725d
Update content/actions/reference/security/secure-use.md
Sharra-writes 135ce49
Update content/actions/reference/security/secure-use.md
Sharra-writes 1d8099b
Update content/actions/reference/security/secure-use.md
Sharra-writes 8989d45
docs: change product reference
wrslatz 2b8e32b
Update content/enterprise-onboarding/github-actions-for-your-enterpri…
Sharra-writes f3d1e1a
Update content/enterprise-onboarding/github-actions-for-your-enterpri…
Sharra-writes d77656f
Update content/enterprise-onboarding/github-actions-for-your-enterpri…
Sharra-writes 07e97d8
Update content/enterprise-onboarding/github-actions-for-your-enterpri…
Sharra-writes 5301aa9
Update data/reusables/actions/pull-request-target-permissions-warning.md
Sharra-writes 3253a3b
Update data/reusables/actions/workflow-run-permissions-warning.md
Sharra-writes 90927fe
Update content/enterprise-onboarding/github-actions-for-your-enterpri…
Sharra-writes 833242a
Update data/reusables/actions/pull-request-target-permissions-warning.md
Sharra-writes ba5b0c4
Update data/reusables/actions/workflow-run-permissions-warning.md
Sharra-writes e6153eb
Merge branch 'main' into gha-hardening-pull-request-target
Sharra-writes File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
2 changes: 1 addition & 1 deletion
2
data/reusables/actions/pull-request-target-permissions-warning.md
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
> [!WARNING] | ||
> For workflows that are triggered by the `pull_request_target` event, the `GITHUB_TOKEN` is granted read/write repository permission unless the `permissions` key is specified and the workflow can access secrets, even when it is triggered from a fork. Although the workflow runs in the context of the base of the pull request, you should make sure that you do not check out, build, or run untrusted code from the pull request with this event. Additionally, any caches share the same scope as the base branch. To help prevent cache poisoning, you should not save the cache if there is a possibility that the cache contents were altered. For more information, see [Keeping your GitHub Actions and workflows secure: Preventing pwn requests](https://securitylab.github.com/research/github-actions-preventing-pwn-requests) on the GitHub Security Lab website. | ||
> For workflows that are triggered by the `pull_request_target` event, the `GITHUB_TOKEN` may be granted read/write repository permission (unless the `permissions` key is explicitly specified in the workflow or repository/organization default permission are set to Read-Only) and the workflow can access referenced secrets, even when it is triggered from a fork. Although the workflow runs in the context of the base of the pull request, you should be cautious if checking out untrusted code from the pull request with this event. Make sure that you do not build, or run untrusted code from the pull request. When `pull_request_target` is triggered against the main branch it shares the same cache as the other privileged workflows running in the context of the main branch. Running untrusted code on this trigger may lead to cache poisoning. For more information, see [Understanding the risks of untrusted code checkout](/actions/security-for-github-actions/security-guides/security-hardening-for-github-actions#understanding-the-risks-of-untrusted-code-checkout) in the Security Hardening for GitHub Actions documentation and [Keeping your GitHub Actions and workflows secure: Preventing pwn requests](https://securitylab.github.com/research/github-actions-preventing-pwn-requests) on the GitHub Security Lab website. | ||
Sharra-writes marked this conversation as resolved.
Show resolved
Hide resolved
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
> [!WARNING] | ||
> Workflows triggered by the `workflow_run` event are privileged (i.e. they share the same cache of the main branch with other privileged workflow triggers, may have repository write access and access to referenced secrets). You should make sure that you do not check out, build, or run untrusted code from the pull request or other untrusted sources with this event. The workflow shares the same cache as the other privileged workflows running in the context of the main branch. Running untrusted code on this trigger may lead to cache poisoning. For more information, see [Understanding the risks of untrusted code checkout](/actions/security-for-github-actions/security-guides/security-hardening-for-github-actions#understanding-the-risks-of-untrusted-code-checkout) in the Security Hardening for GitHub Actions documentation and [Keeping your GitHub Actions and workflows secure: Preventing pwn requests](https://securitylab.github.com/research/github-actions-preventing-pwn-requests) on the GitHub Security Lab website. | ||
Sharra-writes marked this conversation as resolved.
Show resolved
Hide resolved
|
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.