fix(ci): add least-privilege permissions to workflow files#2944
Draft
waveywaves wants to merge 2 commits intochainloop-dev:mainfrom
Draft
fix(ci): add least-privilege permissions to workflow files#2944waveywaves wants to merge 2 commits intochainloop-dev:mainfrom
waveywaves wants to merge 2 commits intochainloop-dev:mainfrom
Conversation
1375beb to
3da776c
Compare
Add top-level permissions blocks following the two-tier permission
pattern recommended by OpenSSF Scorecard:
- stale.yml: add `permissions: {}` at workflow level (job already has
issues: write + pull-requests: write)
- build_external_container_images.yaml: move `packages: write` from
workflow level to job level; set workflow level to `permissions: read-all`
scm_configuration_check.yaml already had `permissions: read-all` at
workflow level so no change was needed.
Fixes chainloop-dev#2841
Signed-off-by: Vibhav Bobade <vibhav.bobde@gmail.com>
Replace os.CreateTemp (which generates a random suffix) with a deterministic filename derived from the config's content hash (ConfigHash[:12]). This ensures that retries produce the same temp file path, preventing duplicate CAS uploads when the attestation is retried due to remote state conflicts. Fixes: chainloop-dev#2907 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Vibhav Bobade <vibhav.bobde@gmail.com>
3da776c to
dcdd23f
Compare
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
permissionsblocks to workflow files following the two-tier permission pattern recommended by OpenSSF Scorecardstale.yml: addedpermissions: {}at workflow level (job-levelissues: write+pull-requests: writealready correct)build_external_container_images.yaml: movedpackages: writefrom workflow level to job level; set workflow level topermissions: { contents: read }codeql.yml: removedid-token: writefrom workflow level (keptcontents: read); job level already hasid-token: writescm_configuration_check.yaml: already hadpermissions: read-allat workflow level, no change neededIssue Item Checklist
stale.ymlpermissions: {}at workflow levelscm_configuration_check.yamlpermissions: read-allat workflow level before this PRbuild_external_container_images.yamlpackages: writeat workflow levelpackages: writeto job level, set workflow level topermissions: { contents: read }release.yaml(issue saysgithub_release.yaml)packages: write+contents: writepackage_chart.yamlpackages: writecodeql.ymlid-token: writeat workflow levelid-token: writeTest Plan
stale.ymlworkflow runs correctly (cron or manual dispatch) with the new top-levelpermissions: {}build_external_container_images.yamlworkflow can still build and push container images withpackages: writenow at job levelcodeql.ymlworkflow still generates SLSA provenance withid-token: writeonly at job levelFixes #2841