fix(security): several codeql fixes - #3475
Open
taciturnaxolotl wants to merge 2 commits into
Open
Conversation
write, edit, and multiedit called os.MkdirAll before showing the permission prompt, so a denied request still left empty directories behind. An agent could mkdir -p anywhere on the machine with no consent. Move MkdirAll to just before os.WriteFile, matching the ordering the download tool already uses.
lint, nightly, release, and schema-update ran with the repo default write-all token because they had no permissions block. Add explicit least-privilege scopes: contents read for lint and schema-update (the latter commits via PAT, not GITHUB_TOKEN). For the goreleaser-driven release and nightly jobs, grant contents/packages write plus id-token write (OIDC for cosign signing) to match what the reusable meta workflows declare, plus actions read for the nightly check job.
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.
The write, edit, and multiedit tools all called os.MkdirAll before showing the permission prompt, so a denied request still left empty directories behind. An agent could mkdir -p anywhere on the machine with no consent. Move MkdirAll to just before os.WriteFile, matching the ordering the download tool already uses.
Also added proper permission scoping on all the github workflows to avoid excessive permissions