Skip to content

fix(core): give the GitHub token only to the calls that need it #5265

Description

@dan-petty

Problem or Motivation

The process runner gives the GitHub token of the session to each git child and to each gh child in their environment. Many of these calls need no token: a local git call (git add, git commit, git diff) does not reach a remote. A child also starts programs that its configuration names, and in an implement Job the agent of a step can write some of that configuration. So the token reaches places that do not need it. A private security advisory holds the details; it is published after the fix ships.

Proposed Solution & Architectural Design

  • Only a git call that reaches a remote (push, fetch, pull, ls-remote, clone, and some remote subcommands) gets the token.
  • A gh call gets the token from a new private config folder for each call (GH_CONFIG_DIR, mode 0700, file mode 0600), not from its environment. The folder goes after the call, also after an error or a timeout.
  • The implement Job runs each network git call in a new bare git folder that reads no global, system or clone configuration and no hook, with an empty home folder and a reset credential helper.
  • In a runner, a git setting, attribute driver or alternates file that the Job does not allow stops the item before any network call (a new failure class).
  • SECURITY.md states the invariant.

Target Subsystem

Core process runner (src/devops_cli/core/process.py) and the implement Job (src/devops_cli/roadmap/implement/).

Existing Tool Considered

git's and gh's own configuration controls (GIT_CONFIG_GLOBAL, GIT_CONFIG_NOSYSTEM, GH_CONFIG_DIR). No new tool. The two-container Job of #3700 stays the structural follow-up.

Acceptance Criteria

  • Tests: a local git call and a gh child get no token in their environment; a network git call of the Job reads no agent-written configuration or hook; the gh config folder is gone after success, error and timeout.
  • uv run devops ci fail-to-pass --base origin/main shows these tests fail on the base.
  • After the release, one implement Job pushes its branch.

Related

#3700, #2695.

Source: https://github.com/dan-petty/devops-cli/blob/main/SECURITY.md

Activity

  1. added
    source/agent
    type/bug
    status/new
    value/high
    effort/high
    on Nov 12, 2026
  2. dan-petty commented on Nov 12, 2026

    @dan-petty
    OwnerAuthor
    • Scope: none. The title has the scope core, and .github/labels.yml declares no scope/core label. Add the label to the file to give the scope to this item.
    • Priority: P1-High. A private security advisory covers this and the token reaches untrusted agent-written configuration.
    • Related: fix(github): keep the hooks permission out of the runner Job token #5058, which asks for a different change. Both limit token exposure in runner Job child processes, but #5058 removes the hooks-read permission from the token while the candidate stops giving the token to processes that do not need it.
  3. added
    priority/p1-high
    status/in-progress
    status/in-review
    and removed
    status/new
    status/in-progress
    on Nov 12, 2026
  4. removed
    status/in-review
    on Nov 13, 2026
  5. added a commit that references this issue on Nov 13, 2026
  6. devops-cli-service commented on Nov 13, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-13 01:10 UTC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/highpriority/p1-highsource/agenttype/bugvalue/high

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions