Repository navigation
fix(security): give the GitHub token only to the calls that need it - #5266
Conversation
|
Details, checks and remaining risks (the PR body is the short squash message): The GitHub token of the session now reaches only the git and gh calls that need it, in a place that no other program of the call reads. Why: the process runner gave the token to each git child and to each gh child in the environment. A local git call ( What changes:
The two-container Job of #3700 stays the structural fix. Plan: Fail-to-pass (
Local checks (GitHub Actions do not run in this fork):
|
9ccf46b to
64ab4e6
Compare
…search A plan can name a git call as a verification command. The step runs it in the checkout, where git reads the configuration that the agent can write, and the process runner gives a git call that reaches a remote the token. The reader of a verification command now refuses git in any form other than the negative search. The step, the stage gate, the plan reader and the amendments read the same rule. No plan pull request of the Service in the last 14 days uses git in another form.
… a network call The network git call of the implement job checked the git settings of the checkout before it ended the leftover processes. A refused setting stopped the call before any sweep, and the job then went on to its GitHub writes. The call now ends the leftover processes first. A refused setting at the push of a wip: commit or of a checkpoint stops the item with the class git_config at once, and a refused setting at the push of a stop gives the stop that class.
…Hub token in a runner In a runner, the process runner now ends every leftover process of the job before a gh child or a git child that reaches a remote starts, before the token folder of a gh child exists. A process that survives stops the item. The job runs code of the checkout, such as tests and hooks, after the end of a turn, so the end of a turn was not the last point where such a process could start. The private gh configuration folder no longer depends on the current folder. It goes into the runtime folder of the user (platformdirs), else into the temp folder of the system, else into the data directory when it is absolute. When none works, the call stops with an error that names the settings. An async call looks up the token in a thread and makes the folder in the thread of the event loop, so a cancelled call leaves no folder.
The new git folder of a network call linked the objects of the clone, but not its shallow file, so a fetch in a shallow clone walked into parents that the clone does not hold and failed. The folder now gets a copy of the shallow file, and a fetch that changes it writes it back into the clone.
SECURITY.md item 15 and docs/ROADMAP_WORKFLOW.md now name where the private gh configuration folder goes, the end of leftover processes before each child with the token in a runner, the rule for git in a verification command, and the limits: a repository with Git LFS or a driver of its own cannot use the implement Job, a gh call reads no gh configuration of the person, and the eval of the implement step runs only outside a runner.
…-back - The private gh folder goes directly into the runtime folder, with no folder of devops-cli between them, so a link below the runtime folder cannot move it. A runtime or temp folder that resolves into the current folder is skipped. - A child that gets the session's token starts in a session of its own, and a timeout kills its whole process group. In a runner, the sweep of leftover processes runs again after the child. - The copy of the shallow file opens it with O_NOFOLLOW, and the write-back uses a new file with a random name and os.replace. - The text of a surviving process names no step, and the dry-run fetch line says that it is the short form of the refspec.
64ab4e6 to
cdc8b46
Compare
|
Fix round 2 (head cdc8b46, rebased on origin/main f9ca1b4).
Each new test failed on the previous head (64ab4e6) for the expected reason, and passes now.
|
🤖 I have created a release *beep* *boop* --- ## [0.125.1](v0.125.0...v0.125.1) (2026-11-13) ### Bug Fixes * **security:** give the GitHub token only to the calls that need it ([#5266](#5266)) ([38266c7](38266c7)), closes [#5265](#5265) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: dan-petty-release[bot] <346998822+dan-petty-release[bot]@users.noreply.github.com>
The GitHub token of the session now reaches only the git and gh calls that need it.
GH_CONFIG_DIR, 0700/0600), not from its environment. No temp candidate is in the current folder. The folder goes after the call.shallowfile, stops the item (classgit_config).! git grep.Closes #5265
Change:
openspec/changes/archive/2026-11-12-5265-github-token-scope/