Repository navigation
Limit the CI workflow token to read-only contents - #271
Merged
Merged
Conversation
Reviewer's GuideConfigurationRestrict the CI workflow token to read-only repository contents so its jobs do not inherit broader default permissions.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
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.
What and why
CodeQL's first scan of
mainleft 11 open alerts. Five are real and fixed here; six are not and stay as they are.actions/missing-workflow-permissions). The fiveci.ymljobs had nopermissions:block, so each got the repository's default token. No job needs more than read access.ci.ymlnow setscontents: readat the top level, asrelease.ymlandvuln.ymldo.go/command-injection,crons_actions.go). The flagged value is the action in the request body.doCronActionpasses onlyrun,pauseorresumeon to the shell; anything else returns "unknown action". Host, unit and plist come from the last cron scan, never from the request, and the scan covers onlycrons.hosts.go/allocation-size-overflow).len(a)+len(b)over slices of config lines, skill sources and held lock entries. The inputs are bounded by memory and, in the view, by a 2 MiB request cap.No Go code changes.
How I checked it
Against a build of
mainin a throwaway home with recording stubs forsshandlaunchctl, throughtackroom viewon loopback: a host that is not configured got 409, a host of-oProxyCommand=...got 409, an action ofrun; touch ...got 422, a cross-siteOrigingot 403. None reached the stubs. A normal configured host reachedsshwith the expected arguments.ci.ymlparses withpermissions: {contents: read}over all five jobs.Not checked: older OpenSSH versions and a remote login shell of fish.
go test ./...andgo vet ./...passI can explain this change without an AI tool
Summary by Sourcery
Harden CI workflow permissions by limiting its repository token to read-only contents access.
Enhancements:
CI: