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
Restricting GitHub Actions permissions to the minimum necessary improves the security of our workflows by limiting access to only what's required. Adopting this structure, read-only permissions at the top level, with specific write permissions declared only at the run level, helps prevent unintended modifications and aligns with GitHub security best practices.
Update each GitHub Actions workflow YAML file in the repository to set permissions as read-only by default at the top level. For actions requiring write permissions, define these explicitly at the step level. This approach ensures each workflow only has the necessary access permissions and minimizes security risks.to read-only by default at the top level. For actions requiring write permissions, define these explicitly at the step level. This approach ensures that each workflow has only
Implementation ideas
Audit Existing Workflows: Review each workflow YAML file to identify any permissions currently set at the top level.
Set Default Permissions: Update each workflow file to set permissions: read all at the top level to establish a read-only default.
Specify Run-Level Permissions: Add only the necessary permissions at the run level for steps requiring write access (e.g., to commit changes or interact with GitHub resources).
Testing: Test each updated workflow to confirm it still operates correctly with the reduced permissions and no access issues arise during execution.
Documentation: Add comments in each workflow YAML file explaining the permission setup to help future maintainers understand the structure.
Ex:
.../...
name: Welcome New Users with Thanks and Tip non-stargazers ;-)
on:
pull_request_target:
types: [opened, closed]
issues:
types: [opened]
permissions:
contents: read
jobs:
run:
permissions:
issues: write # for wow-actions/welcome to comment on issues
pull-requests: write # wow-actions/welcome to comment on PRs
.../...
This change aims to enhance security while ensuring workflows function as expected.
The text was updated successfully, but these errors were encountered:
Reason/Context
Restricting GitHub Actions permissions to the minimum necessary improves the security of our workflows by limiting access to only what's required. Adopting this structure, read-only permissions at the top level, with specific write permissions declared only at the run level, helps prevent unintended modifications and aligns with GitHub security best practices.
This is an OpenSSF Scorecard check, which is important for our CLOMonitor score. See:
https://github.com/ossf/scorecard/blob/main/docs/checks.md#token-permissions
https://clomonitor.io/docs/topics/checks/#token-permissions-from-openssf-scorecard
Description
Update each GitHub Actions workflow YAML file in the repository to set permissions as read-only by default at the top level. For actions requiring write permissions, define these explicitly at the step level. This approach ensures each workflow only has the necessary access permissions and minimizes security risks.to read-only by default at the top level. For actions requiring write permissions, define these explicitly at the step level. This approach ensures that each workflow has only
Implementation ideas
Ex:
This change aims to enhance security while ensuring workflows function as expected.
The text was updated successfully, but these errors were encountered: