Add minimum token permissions for all GitHub workflow files #21
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.
This PR adds minimum token permissions to all GitHub workflow files to improve security posture according to OpenSSF Scorecard recommendations, specifically addressing the Token-Permissions check.
Changes Made
Root-Level Permissions Added
permissions: contents: read
to all workflows that only need basic read accesspermissions: read-all
forossf-scorecard.yml
(already compliant)Job-Level Permissions Added Where Needed
contents: write
(for gh-pages push) andpull-requests: write
(for PR comments)security-events: write
(for CodeQL results upload)contents: write
(for GitHub releases)pull-requests: write
(for PR labels) to both jobspull-requests: write
(for PR labels)Template Updates
lint.yml.j2
,test.yml.j2
,misc.yml.j2
) to include proper permissionstest_1.yml
file that was no longer generatedFiles Updated
backport.yml
,benchmarks.yml
,changelog.yml
,check-links.yml
,codeql-analysis.yml
,contrib.yml
,prepare-patch-release.yml
,prepare-release-branch.yml
,release.yml
lint_0.yml
,test_0.yml
,misc_0.yml
.github/workflows/templates/
Security Impact
OPENTELEMETRYBOT_GITHUB_TOKEN
) only receive basic read permissionsGITHUB_TOKEN
is explicitly usedVerification
All 14 workflow files now pass OpenSSF Scorecard Token-Permissions requirements. The changes are minimal and surgical, maintaining existing functionality while improving security posture.
Fixes #20.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.