-
Notifications
You must be signed in to change notification settings - Fork 402
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
chore(ci): enforce top-level permission to minimum fail-safe permission as per openssf #2638
chore(ci): enforce top-level permission to minimum fail-safe permission as per openssf #2638
Conversation
Signed-off-by: StepSecurity Bot <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fix suggestions to not break all workflows that require additional permissions at job-level
@varunsh-coder following up on this with a proper review this time - I've noticed Step-Security tool adds My previous experience doing this led to actions failing as top-level permissions cannot be increased at the job-level. Practical example: we have certain workflows that need to create temporary branches and create PRs from them. |
just read all issues open/closed in OSSF Scorecard, and specifically this ossf/scorecard#1128. I'll create a separate repo to test one of our workflows with a read-only top-level permission that increases its scope at the job-level. I suspect I might be misremembering a nested workflow increasing the scope and failing vs top-level minimum with some increased scope at job-level. |
Confirmed, reverting suggested changes and keeping |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving after clarifying top-level vs job-level permissions potential breakage.
PR body updated to help review in the future.
No acknowledgement section found. Please make sure you used the template to open a PR and didn't remove the acknowledgment section. Check the template here: https://github.com/aws-powertools/powertools-lambda-python/blob/develop/.github/PULL_REQUEST_TEMPLATE.md#acknowledgment |
No related issues found. Please ensure there is an open issue related to this change to avoid significant delays or closure. |
Awesome work, congrats on your first merged pull request and thank you for helping improve everyone's experience! |
Hi @heitorlessa, the Step-Security tool only adds the If a job has job level permission, those job level permissions are used. Top level permissions are used if a job does not define any permissions. |
Gotcha, that explains it. Thank you! Everything went smoothly, only one small breakage after merging due to nested workflows not getting Thank you once again for the awesome tool! |
Issue number: #2203
Summary
OSSF Scorecard rates workflows based on top-level permission as either
read-all,
: read. Step-Security recommends the bare minimum for a fail-safe run with
contents: read`.Doesn't that break our workflows that need additional permissions?
No. Job-level permissions can still increase a given scope. This changes merely enforces that new jobs will have
contents: read
permission if no explicit scope is defined.In which scenario this could break our workflows?
Nested workflows via
workflow_call
, where parent workflow's permissions cannot be overridden to prevent privilege escalation.Notes
This pull request is created by Secure Repo at the request of @heitorlessa. Please merge the Pull Request to incorporate the requested changes. Please tag @heitorlessa on your message if you have any questions related to the PR. You can also engage with the StepSecurity team by tagging @step-security-bot.
Changes
Security Fixes
Least Privileged GitHub Actions Token Permissions
The GITHUB_TOKEN is an automatically generated secret to make authenticated calls to the GitHub API. GitHub recommends setting minimum token permissions for the GITHUB_TOKEN.
Add Dependency Review Workflow
The Dependency Review Workflow enforces dependency reviews on your pull requests. The action scans for vulnerable versions of dependencies introduced by package version changes in pull requests, and warns you about the associated security vulnerabilities. This gives you better visibility of what's changing in a pull request, and helps prevent vulnerabilities being added to your repository.
Feedback
For bug reports, feature requests, and general feedback; please create an issue in step-security/secure-repo. To create such PRs, please visit https://app.stepsecurity.io/securerepo.
Signed-off-by: StepSecurity Bot [email protected]