You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Forgive all job-level permissions
Signed-off-by: Pedro Kaj Kjellerup Nacht <[email protected]>
* Update tests
Signed-off-by: Pedro Kaj Kjellerup Nacht <[email protected]>
* Replace magic number
Signed-off-by: Pedro Kaj Kjellerup Nacht <[email protected]>
* Rename test
Signed-off-by: Pedro Kaj Kjellerup Nacht <[email protected]>
* Test that multiple job-level permissions are forgiven
Signed-off-by: Pedro Kaj Kjellerup Nacht <[email protected]>
* Drop unused permissionIsPresent
Signed-off-by: Pedro Kaj Kjellerup Nacht <[email protected]>
* Update documentation
Signed-off-by: Pedro Kaj Kjellerup Nacht <[email protected]>
* Modify score descriptions
Signed-off-by: Pedro Kaj Kjellerup Nacht <[email protected]>
* Document warning for job-level permissions
Signed-off-by: Pedro Kaj Kjellerup Nacht <[email protected]>
* List job-level permissions that get WARNed
Signed-off-by: Pedro Kaj Kjellerup Nacht <[email protected]>
---------
Signed-off-by: Pedro Kaj Kjellerup Nacht <[email protected]>
Signed-off-by: André Backman <[email protected]>
Copy file name to clipboardExpand all lines: docs/checks.md
+20-18Lines changed: 20 additions & 18 deletions
Original file line number
Diff line number
Diff line change
@@ -613,13 +613,13 @@ Note: The check does not verify the signatures.
613
613
614
614
Risk: `High` (vulnerable to malicious code additions)
615
615
616
-
This check determines whether the project's automated workflows tokens are set
617
-
to read-only by default. It is currently limited to repositories hosted on
618
-
GitHub, and does not support other source hosting repositories (i.e., Forges).
616
+
This check determines whether the project's automated workflows tokens follow the
617
+
principle of least privilege. This is important because attackers may use a
618
+
compromised token with write access to, for example, push malicious code into the
619
+
project.
619
620
620
-
Setting token permissions to read-only follows the principle of least privilege.
621
-
This is important because attackers may use a compromised token with write
622
-
access to push malicious code into the project.
621
+
It is currently limited to repositories hosted on GitHub, and does not support
622
+
other source hosting repositories (i.e., Forges).
623
623
624
624
The highest score is awarded when the permissions definitions in each workflow's
625
625
yaml file are set as read-only at the
@@ -630,25 +630,27 @@ One point is reduced from the score if all jobs have their permissions defined b
630
630
This configuration is secure, but there is a chance that when a new job is added to the workflow, its job permissions could be
631
631
left undefined because of human error.
632
632
633
-
The check cannot detect if the "read-only" GitHub permission setting is
634
-
enabled, as there is no API available.
635
-
636
-
Additionally, points are reduced if certain write permissions are defined for a job.
633
+
Though a project's score won't be penalized, the check's details will include
634
+
warnings for more sensitive run-level permissions, listed below:
637
635
638
-
### Write permissions causing a small reduction
639
-
*`statuses` - May allow an attacker to change the result of pre-submit checks and get a PR merged.
636
+
*`actions` - May allow an attacker to steal GitHub secrets by approving to run an action that needs approval.
640
637
*`checks` - May allow an attacker to remove pre-submit checks and introduce a bug.
641
-
*`security-events` - May allow an attacker to read vulnerability reports before a patch is available. However, points are not reduced if the job utilizes a recognized action for uploading SARIF results.
642
-
*`deployments` - May allow an attacker to charge repo owner by triggering VM runs, and tiny chance an attacker can trigger a remote service with code they own if server accepts code/location variables unsanitized.
643
-
644
-
### Write permissions causing a large reduction
645
638
*`contents` - Allows an attacker to commit unreviewed code. However, points are not reduced if the job utilizes a recognized packaging action or command.
639
+
*`deployments` - May allow an attacker to charge repo owner by triggering VM runs, and tiny chance an attacker can trigger a remote service with code they own if server accepts code/location variables unsanitized.
646
640
*`packages` - Allows an attacker to publish packages. However, points are not reduced if the job utilizes a recognized packaging action or command.
647
-
*`actions` - May allow an attacker to steal GitHub secrets by approving to run an action that needs approval.
641
+
*`security-events` - May allow an attacker to read vulnerability reports before a patch is available. However, points are not reduced if the job utilizes a recognized action for uploading SARIF results.
642
+
*`statuses` - May allow an attacker to change the result of pre-submit checks and get a PR merged.
643
+
644
+
This compromise makes it clear the maintainer has done what's possible to use those permissions safety,
645
+
but allows users to identify that the permissions are used.
646
+
647
+
The check cannot detect if the "read-only" GitHub permission setting is
648
+
enabled, as there is no API available.
648
649
649
650
650
651
**Remediation steps**
651
-
- Set permissions as `read-all` or `contents: read` as described in GitHub's [documentation](https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#permissions).
652
+
- Set top-level permissions as `read-all` or `contents: read` as described in GitHub's [documentation](https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#permissions).
653
+
- Set any required write permissions at the job-level. Only set the permissions required for that job; do not set `permissions: write-all` at the job level.
652
654
- To help determine the permissions needed for your workflows, you may use [StepSecurity's online tool](https://app.stepsecurity.io/secureworkflow/) by ticking the "Restrict permissions for GITHUB_TOKEN". You may also tick the "Pin actions to a full length commit SHA" to fix issues found by the Pinned-dependencies check.
Copy file name to clipboardExpand all lines: docs/checks/internal/checks.yaml
+28-24Lines changed: 28 additions & 24 deletions
Original file line number
Diff line number
Diff line change
@@ -653,13 +653,13 @@ checks:
653
653
description: |
654
654
Risk: `High` (vulnerable to malicious code additions)
655
655
656
-
This check determines whether the project's automated workflows tokens are set
657
-
to read-only by default. It is currently limited to repositories hosted on
658
-
GitHub, and does not support other source hosting repositories (i.e., Forges).
656
+
This check determines whether the project's automated workflows tokens follow the
657
+
principle of least privilege. This is important because attackers may use a
658
+
compromised token with write access to, for example, push malicious code into the
659
+
project.
659
660
660
-
Setting token permissions to read-only follows the principle of least privilege.
661
-
This is important because attackers may use a compromised token with write
662
-
access to push malicious code into the project.
661
+
It is currently limited to repositories hosted on GitHub, and does not support
662
+
other source hosting repositories (i.e., Forges).
663
663
664
664
The highest score is awarded when the permissions definitions in each workflow's
665
665
yaml file are set as read-only at the
@@ -670,26 +670,30 @@ checks:
670
670
This configuration is secure, but there is a chance that when a new job is added to the workflow, its job permissions could be
671
671
left undefined because of human error.
672
672
673
-
The check cannot detect if the "read-only" GitHub permission setting is
674
-
enabled, as there is no API available.
675
-
676
-
Additionally, points are reduced if certain write permissions are defined for a job.
673
+
Though a project's score won't be penalized, the check's details will include
674
+
warnings for more sensitive run-level permissions, listed below:
677
675
678
-
### Write permissions causing a small reduction
679
-
* `statuses` - May allow an attacker to change the result of pre-submit checks and get a PR merged.
676
+
* `actions` - May allow an attacker to steal GitHub secrets by approving to run an action that needs approval.
680
677
* `checks` - May allow an attacker to remove pre-submit checks and introduce a bug.
681
-
* `security-events` - May allow an attacker to read vulnerability reports before a patch is available. However, points are not reduced if the job utilizes a recognized action for uploading SARIF results.
682
-
* `deployments` - May allow an attacker to charge repo owner by triggering VM runs, and tiny chance an attacker can trigger a remote service with code they own if server accepts code/location variables unsanitized.
683
-
684
-
### Write permissions causing a large reduction
685
678
* `contents` - Allows an attacker to commit unreviewed code. However, points are not reduced if the job utilizes a recognized packaging action or command.
679
+
* `deployments` - May allow an attacker to charge repo owner by triggering VM runs, and tiny chance an attacker can trigger a remote service with code they own if server accepts code/location variables unsanitized.
686
680
* `packages` - Allows an attacker to publish packages. However, points are not reduced if the job utilizes a recognized packaging action or command.
687
-
* `actions` - May allow an attacker to steal GitHub secrets by approving to run an action that needs approval.
681
+
* `security-events` - May allow an attacker to read vulnerability reports before a patch is available. However, points are not reduced if the job utilizes a recognized action for uploading SARIF results.
682
+
* `statuses` - May allow an attacker to change the result of pre-submit checks and get a PR merged.
683
+
684
+
This compromise makes it clear the maintainer has done what's possible to use those permissions safety,
685
+
but allows users to identify that the permissions are used.
686
+
687
+
The check cannot detect if the "read-only" GitHub permission setting is
688
+
enabled, as there is no API available.
688
689
689
690
remediation:
690
691
- >-
691
-
Set permissions as `read-all` or `contents: read` as described in
692
+
Set top-level permissions as `read-all` or `contents: read` as described in
Set any required write permissions at the job-level. Only set the permissions
696
+
required for that job; do not set `permissions: write-all` at the job level.
693
697
- >-
694
698
To help determine the permissions needed for your workflows, you may use [StepSecurity's online tool](https://app.stepsecurity.io/secureworkflow/) by ticking
695
699
the "Restrict permissions for GITHUB_TOKEN". You may also tick the "Pin actions to a full length commit SHA" to fix issues found
@@ -819,9 +823,9 @@ checks:
819
823
820
824
This check determines whether the webhook defined in the repository has a token configured to authenticate the origins of requests.
821
825
remediation:
822
-
- >-
823
-
Check whether your service supports token authentication.
824
-
- >-
825
-
If there is support for token authentication, set the secret in the webhook configuration. See [Setting up a webhook](https://docs.github.com/en/developers/webhooks-and-events/webhooks/creating-webhooks#setting-up-a-webhook)
826
-
- >-
827
-
If there is no support for token authentication, consider implementing it by following [these directions](https://docs.github.com/en/developers/webhooks-and-events/webhooks/securing-your-webhooks).
826
+
- >-
827
+
Check whether your service supports token authentication.
828
+
- >-
829
+
If there is support for token authentication, set the secret in the webhook configuration. See [Setting up a webhook](https://docs.github.com/en/developers/webhooks-and-events/webhooks/creating-webhooks#setting-up-a-webhook)
830
+
- >-
831
+
If there is no support for token authentication, consider implementing it by following [these directions](https://docs.github.com/en/developers/webhooks-and-events/webhooks/securing-your-webhooks).
0 commit comments