Skip to content

fix(ghcr): reproducible read-only GHCR login for nodes (GHCR_READ_TOKEN_FILE) + gh-app-token CONFIRM fix - #3248

Merged
POWERFULMOVES merged 5 commits into
mainfrom
fix/ghcr-read-access-knuckles
Oct 2, 2026
Merged

POWERFULMOVES merged 5 commits into
mainfrom
fix/ghcr-read-access-knuckles

Conversation

@POWERFULMOVES

@POWERFULMOVES POWERFULMOVES commented Oct 1, 2026 •

Copy link
Copy Markdown
Owner

Why

On Knuckles, pulls from ghcr.io/powerfulmoves return 403. Because of that, the Agent Zero image had to be rebuilt locally after a prune, and Archon runs a node-local image tag. The existing make -C pmoves docker-login could not take a read-only token on this node:

  • The env loader wins. scripts/with-env.sh lets env files override exported vars, so an operator-supplied GHCR_TOKEN=... isn't reliable.
  • The file option is never reached. GHCR_TOKEN_FILE is consulted only after GHCR_TOKEN/GH_PAT_PUBLISH/GITHUB_TOKEN/gh auth token are all empty, and this node exports the first two. Pulls 403 regardless; why those tokens fail was not measured, because a scope probe was refused as credential materialization.
  • No safety checks. There was no dry-run and no shape check, so a truncated or placeholder secret looks fine.

What

  • pmoves/scripts/ghcr_login.sh (now backs docker-login):
    • GHCR_READ_TOKEN_FILE wins whenever it is set. It is read before with-env.sh, so neither exported nor env-file tokens can displace it.
    • The file must be mode 0600 and hold a classic PAT (ghp_ + 36 alphanumerics).
    • GHCR_USERNAME (the PAT owner) is required on this path.
    • DRY_RUN=1 validates everything and prints only user, registry and token source.
    • The token reaches docker on stdin only (--password-stdin). It is never on argv and never printed.
    • The legacy publish chain is unchanged in order; the success line now also names the token source.
  • pmoves/mk/codex.mk: "$$(CONFIRM)" was shell command substitution, not the make variable, so the documented make gh-app-token ALL=1 CONFIRM=1 always exited 3. Fixed to $(CONFIRM).
  • Docs:
    • LOCAL_TOOLING_REFERENCE.md replaces the never-existing make docker-login-ghcr.
    • GITHUB_APP.md adds a correction: GHCR_TOKEN is not App-replaceable.
  • Register: a NOTE corrects the 2026-05-23 "fine-grained PAT … Packages" GHCR advice. The original row is left unedited.

Correction to the step-0 report: make gh-app-token does exist (in pmoves/mk/codex.mk; the first grep missed mk/). The GITHUB_APP.md:67 reference was not stale, but its ALL=1 CONFIRM=1 form was broken by the bug above.

Vendor docs

  • GitHub: "GitHub Packages only supports authentication using a personal access token (classic)" (github/docs data/reusables/package_registry/packages-classic-pat-only.md). For node-side pulls, the container registry's login steps say to "Select the read:packages scope to download container images and read their metadata" (data/reusables/package_registry/authenticate-to-container-registry-steps.md, rendered in working-with-the-container-registry.md; the same reusable opens with packages-classic-pat-only). An earlier revision cited authenticate-packages.md, where that sentence sits under the Actions-workflow bullets, so it was the wrong section for a node pull. App installation tokens and fine-grained PATs are therefore not a documented GHCR credential. A short-lived App token was preferred but is not supported, so this PR uses a read-only classic PAT with a short expiry.
  • Docker (docs/reference/commandline/login.md):
    • --password-stdin "prevents the password from ending up in the shell's history, or log-files".
    • Without a credential helper (pass / secretservice on Linux), credentials are stored base64-encoded in config.json. Knuckles has no docker-credential-* helper installed.

Tests

pmoves/tests/test_ghcr_login.py, 9 tests, all passing. There's no network and no real login: tokens are fabricated at runtime, and a fake docker on PATH records argv and stdin. They check that:

  • the token goes on stdin only and never appears in argv, stdout or stderr;
  • the read file beats exported GHCR_TOKEN/GH_PAT_PUBLISH;
  • non-0600 files, truncated or non-classic tokens (github_pat_, ghs_, empty) and a missing username or file are all refused;
  • the make target forwards the variables (make -n under stub_docker_path);
  • gh-app-token ALL=1 CONFIRM=1 renders [ "1" != "1" ]. As a control, origin/main:pmoves/mk/codex.mk contains the buggy "$$(CONFIRM)" once; this branch contains it 0 times.

shellcheck -S warning passes.

Operator steps (after merge)

  1. Create a classic PAT with only read:packages and an expiry of 90 days or less: https://github.com/settings/tokens/new?scopes=read:packages. Authorize it for SSO if the org enforces it. The account must have read access to the POWERFULMOVES packages.
  2. Write it to a 0600 file without echoing it:
    mkdir -p -m700 ~/.pmoves && install -m600 /dev/null ~/.pmoves/ghcr_read_token && read -rs T && printf %s "$T" > ~/.pmoves/ghcr_read_token; unset T
  3. Optional, recommended by Docker's docs: install a credential helper (pass or docker-credential-secretservice) before logging in. Otherwise docker writes the login base64-encoded to ~/.docker/config.json.
  4. make -C pmoves docker-login GHCR_USERNAME=<pat-owner-login> GHCR_READ_TOKEN_FILE=$HOME/.pmoves/ghcr_read_token DRY_RUN=1, then run it again without DRY_RUN.
  5. Verify (the delivery body will do this and report the digest only): docker pull ghcr.io/powerfulmoves/pmoves-agent-zero:pmoves-latest.

Lane: fix/ghcr-read-access-knuckles (B850-CLAUDE, Knuckles). Do not merge without control review.

🤖 Generated with Claude Code

@coderabbitai

coderabbitai Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are limited based on label configuration.

🏷️ Required labels (at least one) (1)
  • coderabbit

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository: POWERFULMOVES/PMOVES.AI/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 4f90fcd0-9405-46f7-a58d-199305fc08c7

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@kilo-code-bot

kilo-code-bot Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Summary

The review did not run because the selected model is no longer available.

Choose another model in Kilo Code review settings: https://app.kilo.ai/code-reviews

Previous Review Summaries (2 snapshots)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review

The review did not run because the selected model is no longer available.

Choose another model in Kilo Code review settings: https://app.kilo.ai/code-reviews

Previous review

The review did not run because the selected model is no longer available.

Choose another model in Kilo Code review settings: https://app.kilo.ai/code-reviews

@github-actions github-actions Bot added docs Documentation governance AGNOTE register / agent definitions / damage-control hooks labels Oct 1, 2026
@github-actions

github-actions Bot commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

Fleet review: kilocode (kilo/z-ai/glm-5.3)

reviewer: tier 2/3 kilo-primary - model kilo/z-ai/glm-5.3 - fell back after tier 1 spark-local: not-configured

1. CORRECTNESS

  • codex.mk fix is correct. "$$(CONFIRM)" rendered to the shell as "$(CONFIRM)" → command substitution of an undefined command → always "" != "1" → exit 3. $(CONFIRM) expands at make time. The make -n render test ([ "1" != "1" ], no $(CONFIRM) in output) is a sound discriminator; -n mints nothing.
  • BLOCKER — undefined fixture in shipped tests. test_ghcr_login.py (new file) uses a pytest fixture stub_docker_path in tests 8–9 (test_make_target_forwards_read_file_and_username, test_gh_app_token_confirm_reads_the_make_variable), but nothing in the diff defines it and the file doesn't either. No conftest.py is added. Unless it already exists in an unstaged/untouched conftest, 2 of 9 tests error with "fixture not found" — the "9 tests, all passing" claim is not established by this diff. Add the conftest change or an in-module fixture.
  • Read path vs. publish path precedence works as claimed (test asserts the read file beats exported GHCR_TOKEN/GH_PAT_PUBLISH), and the legacy chain order matches the old Makefile recipe exactly (GHCR_TOKEN > GH_PAT_PUBLISH > GITHUB_TOKEN > gh auth token > GHCR_TOKEN_FILE).
  • Set-but-empty GHCR_READ_TOKEN_FILE silently falls back to the publish chain. make docker-login GHCR_READ_TOKEN_FILE= (or an empty export) takes the full-token path with no warning that the read path was requested but empty. Die or warn on empty-vs-unset.
  • Username variable mismatch. Script reads GHCR_READ_USERNAME but its die message names GHCR_USERNAME (the Make mapping papered over it). Direct script invocation with GHCR_USERNAME=… produces a confusing error.
  • DRY_RUN overvalidation claim. Shape checks (0600, ghp_+36) apply only to the read path; a truncated/placeholder legacy GHCR_TOKEN passes DRY_RUN — body's "validates everything" is read-path-only.
  • Quoting. Recipe interpolates $(GHCR_READ_TOKEN_FILE)/$(GHCR_USERNAME) raw into the shell line — safe when make passes them, but operator-supplied values containing "/$ break or inject. Spaces are OK (double-quoted).
  • set -uo pipefail + printf | docker: if docker exits before draining stdin, printf's SIGPIPE (141) can mask a successful login as a failure. Unlikely (docker reads stdin first); cosmetic.
  • Read path still forces the ensure-env-shared prereq despite never sourcing env files — read-only login is blocked on nodes with broken/absent env bootstrap (pre-existing for the publish path; missed cleanup for the new one).
  • Legacy-path claims about with-env.sh (env files override exports; sets errexit — hence set +e) are untestable — that script isn't in the diff; tests never exercise the legacy path, so the root-cause claim is untested.
  • CI-safe: gh absence handled (|| true then die), empty vars handled (:-, ${!k:-}), GNU/BSD stat fallback ordered correctly; mode failure degrades to "unknown" die. No YAML files touched.

2. SECURITY / TOPOLOGY

  • Token handling in the diff: clean. Stdin-only (--password-stdin), never argv, never echoed; die messages print file path and mode, never file contents; tests use fabricated tokens and assert no leak in argv/stdout/stderr. Docs correctly disclose the ~/.docker/config.json base64 caveat.
  • Added lines: clean — no IPs, ports, hostnames, or credentials. ghcr.io/powerfulmoves is the public registry; register NOTE's node alias/agent IDs follow the convention already pervasive in that file's context lines (pre-existing rows disclose far more topology — NVMe layout, volumes — but none of that is added here).
  • Scope: on-purpose. Makefile/script/tests + two doc corrections + one register NOTE + the trivial codex.mk fix; no unrelated files. Register is an append at a heavily-edited shared file — merge-conflict prone but conventional.

3. VERDICT: REQUEST_CHANGES — the shipped test file references an undefined stub_docker_path fixture, so 2 of the 9 tests cannot run as packaged and the PR's green-test claim is unverified; the script and CONFIRM fix themselves are sound.

reviewer chain
tier reviewer model outcome detail
1 spark-local - not-configured SPARK_REVIEW_URL is not set
2 kilo-primary kilo/z-ai/glm-5.3 ok review produced
3 kilo-alternate - not-reached

_ lane: fleet-review chain (self-hosted kvm4) - spark-local (when online) -> kilo-primary -> kilo-alternate _

@POWERFULMOVES POWERFULMOVES left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Independent review of #3248 @ 7407a27 (read-only; throwaway worktree; fabricated tokens only, never ~/.docker)

Verdict: CHANGES-REQUIRED (1×P2, a one-line fix). Everything else is either verified or a nit.

Harness

I checked out the PR head in a detached worktree. I ran pytest tests/test_ghcr_login.py (9 passed) and shellcheck -S warning (clean). Then I probed scripts/ghcr_login.sh under env -i. The token was a fabricated ghp_+36 string, docker was a fake that records argv and stdin, and output was grepped for the token.

Findings

[P2] defense-in-depth: pmoves/scripts/ghcr_login.sh (lines 45, 46, 75). The token is printed under xtrace, including during DRY_RUN.

  • bash -x scripts/ghcr_login.sh prints the token 3 times: the token= assignment, the [[ =~ ]] test and the printf.
  • With SHELLOPTS=xtrace exported, make -C pmoves docker-login ... DRY_RUN=1 prints it 2 times, before the dry-run exit.
  • This is a new path. The Makefile sets no SHELL, so the old inline recipe ran under /bin/sh (dash), which ignores SHELLOPTS. The recipe now runs bash explicitly.
  • The PR claims the token is "never printed" and that DRY_RUN "prints only user, registry and source". Neither holds under a common debugging habit.
  • Fix: { set +x; } 2>/dev/null immediately after the shebang/set -uo pipefail, plus a test that runs with SHELLOPTS=xtrace and asserts no leak.

[P3] defense-in-depth: line 42. The symlink is refused (fail-closed, correct), but the message misleads. stat -c %a reports the link itself (is 777) and suggests chmod 600 <link>. That chmods the target, so the error repeats forever. Say "must be a regular file, not a symlink" instead.

[P3] defense-in-depth: line 40–42. There is no owner check. A 0600 file owned by another uid is accepted whenever it is readable, which in practice means under sudo/root. Consider [ "$(stat -c %u "$f")" = "$(id -u)" ]. I could not measure this empirically because I can't chown as non-root; it is from reading the code.

[P3] reasoning gap: line 45. tr -d '\r\n' deletes interior newlines too, so a token split across two lines is silently joined and accepted (measured). Strip only the trailing CR/LF.

[P3] (nit): line 42. The test is exact equality with 600, so 0400 (stricter) is refused. That is defensible, but say so in the message.

[P3] contract/citation (nit). In authenticate-packages.md, the "classic PAT with at least read:packages" sentence sits under the Actions workflow bullets (packages in other private repos). The general claim still stands via packages-classic-pat-only.md ("only supports authentication using a personal access token (classic)", rendered from pat_v1). It is accurate in substance; consider citing the container-registry page for node-side pulls.

[P3] operator step 2. install -m600 /dev/null ~/.pmoves/ghcr_read_token fails if ~/.pmoves doesn't exist. It fails safely, since the && chain stops, but add install -d -m700 ~/.pmoves && first. The rest is sound:

  • read -rs doesn't echo.
  • printf is a builtin, so the token never reaches argv.
  • The > truncation keeps 0600.
  • T is unexported and then unset.

Checks requested, with results

  1. argv/log/echo: PASS, except xtrace (above).
    • The fake docker's argv was exactly login ghcr.io -u octo --password-stdin, and its stdin byte-equalled the token.
    • make -n renders only the file path.
    • make --trace leaked 0 times.
    • The token is read with tr < file (no echo) and piped through the printf builtin, so it goes to stdin only.
  2. 0600 check: fails closed.
    • 640, 700, 400 → refused.
    • Symlink to a 0600 file → refused (reports 777).
    • A directory or /dev/stdin → refused as "not a regular file".
    • Wrong owner: no check (P3 above).
  3. Precedence: PASS.
    • With exported GHCR_TOKEN=<decoy> and GH_PAT_PUBLISH, the source reports GHCR_READ_TOKEN_FILE.
    • with-env.sh is only sourced in the else branch, so no env file can displace the read file. That is structural, verified by reading lines 37–50.
    • Corollary worth documenting: setting GHCR_READ_TOKEN_FILE in env.shared does nothing. It must be passed on the make command line or exported.
  4. Shape: PASS.
    • Refused: trailing space, leading space, tab, padded +1, truncated −2, missing the first 2 chars (the E2B shape), and two tokens on two lines. github_pat_, ghs_ and empty are covered by the PR's own test.
    • Accepted: a valid ghp_+36, and the same with CRLF.
    • Accepted but shouldn't be: an interior-newline split (P3 above).
  5. Citations: accurate.
    • The GitHub reusable text matches.
    • Docker login.md (docker/cli docs/reference/commandline/login.md): "Using STDIN prevents the password from ending up in the shell's history, or log-files" matches.
    • The credential-store fallback (pass → secretservice → base64 in config.json) matches.
  6. Operator steps: safe. One nit, the step-2 mkdir.

Other

  • Contract: the docker-login legacy chain order is preserved. LOAD_ENV_SHARED was . ./scripts/with-env.sh, so the script's direct source is equivalent, and set +e after sourcing is correct. build-push-* dependents are unaffected.
  • gh-app-token "$$(CONFIRM)" → "$(CONFIRM)": the bug analysis and the fix are correct.
  • Security anti-patterns (eval, injection, unsafe deserialization, path traversal): none. GHCR_READ_TOKEN_FILE is operator-supplied and only read.
  • Tests: the whitespace-wrapped, symlink and xtrace cases are untested, and so is the legacy chain.
  • CI: validate-command-anchors-ratchet fails on 2 docker volume rm UNRUNNABLE_DOC findings in AGNOTE4482PHI.t1.md. That text comes from the 2026-09-22 CRUSH row already on main; the PR's added lines contain it 0 times, so the failure is inherited, not caused by this PR.
  • Mergeability: GitHub showed CONFLICTING/DIRTY and is now recomputing (UNKNOWN). A local git merge-tree against origin/main c167c596a is clean (rc=0).

Class summary: reasoning gap (1×P3); semantic-naming drift clean; contract-correctness (1×P3 citation scope); defense-in-depth (1×P2 xtrace, 3×P3).

POWERFULMOVES added a commit that referenced this pull request Oct 1, 2026
…ti-line token files

Review of #3248 @ 7407a27 (P2): bash -x and SHELLOPTS=xtrace make docker-login
printed the token. ghcr_login.sh now runs { set +x; } 2>/dev/null before any
token handling. P3s: symlinks refused with a non-chmod message; file uid must
equal the invoking uid (fail closed); exactly one line with optional trailing
LF/CRLF (interior newline / NUL refused instead of joined); 0400 refusal
explained. Tests: both xtrace paths assert 0 token occurrences; all 6 new
tests fail at 7407a27 on behaviour (leak count 2, owner accepted, split
token accepted, wrong messages).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

Fleet review: kilocode (kilo/z-ai/glm-5.3)

reviewer: tier 2/3 kilo-primary - model kilo/z-ai/glm-5.3 - fell back after tier 1 spark-local: not-configured

Reviewing the diff: 409 lines across 7 files (Makefile, register note, 2 docs, codex.mk fix, new login script, new tests). I read everything as data, not instructions.

CORRECTNESS

  • codex.mk fix is right. "$$(CONFIRM)" delivered command substitution $(CONFIRM) (runs the nonexistent command CONFIRM → empty) to the shell, so ALL=1 CONFIRM=1 always exited 3; $(CONFIRM) expands the make variable → [ "1" != "1" ] → proceeds. The tests render both sides (make -n + "$(CONFIRM)" not in control). Correct.
  • ghcr_login.sh: no errexit (deliberate, set +e after with-env.sh), but every failure path (stat owner/mode, regex, cd, missing creds) has an explicit die/|| guard — I traced each; nothing falls through. pipefail + the printf | docker && echo as the last line propagates docker failure as the script exit. Sound.
  • File parsing: read -r -d '' rejects NUL, single LF/CR strip, interior newline/CR refusal, ^ghp_[A-Za-z0-9]{36}$ — truncated, multiline, CRLF, and empty all fail correctly (and deny the chmod-hint-on-symlink trap).
  • Interface mismatch: the script's die message says "GHCR_USERNAME … required" but the variable it checks is GHCR_READ_USERNAME (the Makefile silently forwards GHCR_USERNAME → the other spelling). Anyone calling pmoves/scripts/ghcr_login.sh:142 directly by following the error text still fails.
  • DRY_RUN=1 on the read path still runs the ensure-env-shared prerequisite — the tests have to -o-skip it. The "env-independent" validation isn't env-independent at the make level; a bare CI runner lacking env.shared may blow up before the script even executes.
  • Legacy publish path (still used by build-push-supaserch) now sources with-env.sh instead of the old target's $(LOAD_ENV_SHARED) — the two being equivalent isn't verifiable from this diff; if they differ, publish flow behavior shifts silently.
  • Tests: the diff defines 16 test_ functions (pmoves/tests/test_ghcr_login.py:247-399), not 9.
  • stub_docker_path is passed to 3 tests but is not defined anywhere in this diff (no conftest included). If it's not already in the repo, those tests error at collection and the "9 tests all passing" claim was never exercised.
  • Minor: the recipe expands $(GHCR_READ_TOKEN_FILE)/$(GHCR_USERNAME) into a double-quoted shell env-prefix; a value containing " breaks out (operator-controlled, same pattern as codex.mk's existing $(PERMISSIONS)/$(OUT)). Indirect command substitution "$${GHCR_USERNAME:-...}", tilde handling (bare ~ fails, ~user mangles), and stat fallbacks are acceptable — they fail closed.

SECURITY / TOPOLOGY

  • The login script and tests are clean: no IPs, ports, hostnames, or credentials in any added line. Token reaches docker via --password-stdin only, never argv; { set +x; } 2>/dev/null kills tracing before any token handling and supplements it so no die message prints token content (paths/modes only). Tests use fabricated tokens (ghp_x*36), never real ones. ghcr.io is the only network identifier.
  • One disclosure-adjacent item, not a network-topology leak: the CRUSH-GLM52 register row (line 33 of the AGNOTE hunk) puts node hardware inventory (nvme1n1/nvme2n1, 60G volume count, 8.4G free, 76G moved to JuiceFS) and a data-loss incident (five pmoves_comfyui-* volumes deleted, rendered outputs unrecoverable) into a public repo. No IPs, ports, or secrets — but ops-state exposure. It's also completely unmentioned in the PR body: undisclosed scope creep on a diff that is otherwise well-disclosed. Its TTL expired 2026-09-25 before this 10-01 PR.

VERDICT

REQUEST_CHANGES — the new script is genuinely careful (stdin-only, 0600+uid+shape validation, xtrace off, dry-run), and the codex.mk fix is correct, but the diff buries an unrelated, undisclosed CRUSH-GLM52 row with an ops-incident disclosure in a public register, the test count contradicts what's on disk (9 claimed, 16 present), and the stub_docker_path fixture is absent from the diff, which puts the "all passing" claim in doubt; fix those (drop or disclose-and-justify the stray row, surface the fixture or its conftest, correct the claims) and the remaining findings are minor polish.

reviewer chain
tier reviewer model outcome detail
1 spark-local - not-configured SPARK_REVIEW_URL is not set
2 kilo-primary kilo/z-ai/glm-5.3 ok review produced
3 kilo-alternate - not-reached

_ lane: fleet-review chain (self-hosted kvm4) - spark-local (when online) -> kilo-primary -> kilo-alternate _

@POWERFULMOVES POWERFULMOVES left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delta review of #3248: 7407a27 → d9cf795 (11a0164 fixes, d9cf795 merges main)

Verdict: CHANGES-REQUIRED (1×P2), for the merge commit only. All of 11a0164's script fixes verify. The merge, however, does not equal main plus the PR.

[P2] contract-correctness: the merge duplicates a register row (pmoves/docs/AGENTS/AGNOTE4482PHI.t1.md)

  • The 2026-09-22T15:30:32Z CLAIM CRUSH-GLM52 (Knuckles) infra/knuckles-nvme-omarchy-storage row is present once on main (line 3249 of 3264) and twice at d9cf795 (lines 3241 and 3251 of 3266).
  • Main relocated that row after the merge-base, where it sat at line 3231. The PR side's NOTE was appended directly after the old position, so the resolution kept both copies.
  • Result: git diff origin/main d9cf795c -- …PHI.t1.md is +2 lines: the duplicated CLAIM plus the intended NOTE. It should be +1.
  • A duplicated CLAIM is register state the PR never meant to write. It also adds a second docker volume rm occurrence to the anchors ratchet: main 1 → head 2.
  • Fix: delete the copy at line 3241 (the stale PR-side position), keeping the NOTE row. The register diff vs main should then be exactly the one NOTE line.
  • The rest of the merge is clean:
    • git diff --stat origin/main d9cf795c has 7 files, equal to the PR's file set (4eb1610 ∪ 7407a27 ∪ 11a0164).
    • Every PR file except the Makefile and the register has a blob identical to 11a0164.
    • The Makefile's diff vs main is only the docker-login hunk (+3/−10). Its delta from 11a0164 is main's own changes.

Your items, re-measured at d9cf795 (fabricated tokens; fake docker; never ~/.docker)

  1. xtrace: fixed. { set +x; } 2>/dev/null is line 30, before any token read on either path; with-env.sh contains no set -x/xtrace/trap. Token occurrences in the output:

    Probe Before (7407a27) Now
    bash -x 3 0
    SHELLOPTS=xtrace make docker-login (real path) 2 0
    SHELLOPTS=xtrace make docker-login DRY_RUN=1 2 0
    bash -o xtrace -o functrace — 0
    BASH_ENV file containing set -x (runs before line 30, then is switched off) — 0
    legacy chain with GHCR_TOKEN and xtrace exported — 0

    Re-enabling: no function or subshell in the script sets -x, and subshells inherit "off". The residual vector is an env file sourced by with-env.sh (legacy path only) containing set -x, or a DEBUG trap planted via BASH_ENV. Both need control of the environment or of trusted env files, so they are out of scope (P3, note only).

  2. Owner check: fails closed. On a real foreign owner (root-owned /etc/hostname) it is refused with uid 1000, file uid 0. With stat forced to fail (a shim on PATH), owner is empty and the script refuses with file uid unknown, rc=1.

  3. Symlink: refused before the mode check (line 53, before -f, owner and mode), with the message "must be a regular file, not a symlink" and no chmod hint.

  4. Token parsing (IFS= read -r -d '', then strip one LF and one CR, then a CR/LF case guard):

    • Accepted: the valid token, the token with no LF, and the token with CRLF.
    • Refused as a non-PAT: trailing space, leading space, tab, pad+1, short−2, missing first 2 chars, and an empty file.
    • Refused as "exactly one line": a token split across 2 lines, two token lines, a double LF, and a lone CR mid-token.
    • NUL mid-token and NUL trailing: refused, "contains a NUL byte".
    • Exported GHCR_TOKEN decoy: the source still reports GHCR_READ_TOKEN_FILE.
  5. The 7 new or changed tests fail at 7407a27. I ran 11a0164's test file against 7407a27's script in a throwaway worktree: 7 failed, 9 passed. By cause:

    • 4 behavioural: owner accepted (0 == 1), split token accepted, and the token leaked under bash -x and under make+SHELLOPTS.
    • 3 message-only: not_0600 and 0400 were already refused before and now differ only in wording. The symlink was already refused, but with the misleading chmod hint, so that UX fix is real.
    • The owner test fakes id -u (non-root can't chown). My real-uid probe above covers the gap.
    • At d9cf795: 16 passed. shellcheck -S warning is clean.

Class summary:

  • reasoning gap: clean
  • semantic-naming drift: clean
  • contract-correctness: 1×P2 (the merge's duplicate register row)
  • defense-in-depth: clean, apart from the P3 note on env-file/BASH_ENV-planted tracing

POWERFULMOVES and others added 4 commits October 2, 2026 05:31
…beats env overrides

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… GHCR PAT docs

- tests/test_ghcr_login.py: fabricated tokens + fake docker on PATH; asserts
  token only on stdin, never argv/stdout/stderr; 0600 + classic-shape refusals;
  read file beats exported GHCR_TOKEN/GH_PAT_PUBLISH.
- mk/codex.mk: "$$(CONFIRM)" was shell command substitution, so the documented
  gh-app-token ALL=1 CONFIRM=1 always exited 3.
- LOCAL_TOOLING_REFERENCE: replace the never-existing docker-login-ghcr.
- GITHUB_APP: GHCR_TOKEN is not App-replaceable (GitHub Packages = classic PAT only).
- register NOTE correcting the 2026-05-23 fine-grained-PAT GHCR advice.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ti-line token files

Review of #3248 @ 7407a27 (P2): bash -x and SHELLOPTS=xtrace make docker-login
printed the token. ghcr_login.sh now runs { set +x; } 2>/dev/null before any
token handling. P3s: symlinks refused with a non-chmod message; file uid must
equal the invoking uid (fail closed); exactly one line with optional trailing
LF/CRLF (interior newline / NUL refused instead of joined); 0400 refusal
explained. Tests: both xtrace paths assert 0 token occurrences; all 6 new
tests fail at 7407a27 on behaviour (leak count 2, owner accepted, split
token accepted, wrong messages).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The rebase union kept both copies: main's current wording (with the
"blocked once patterned" clause and the volume-reset road) and this
branch's carried stale copy of the older wording. The stale copy also
trips the command-anchors ratchet twice (its docker volume rm mentions
sit outside the baseline). Deletes the stale copy only; the canonical
row and the lane's NOTE row are untouched. Register repair directed by
B850-CLAUDE 2026-10-01.
@POWERFULMOVES
POWERFULMOVES force-pushed the fix/ghcr-read-access-knuckles branch from d9cf795 to 3f29d8c Compare October 2, 2026 09:35
@github-actions

github-actions Bot commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

Fleet review: NO-REVIEWER-AVAILABLE

Every reviewer tier failed or was unavailable, so this PR has NOT been reviewed by the fleet lane. This is could-not-measure, not a pass.

tier reviewer model outcome detail
1 spark-local - not-configured SPARK_REVIEW_URL is not set
2 kilo-primary kilo/z-ai/glm-5.3 failed kilo run failed (exit 1)
3 kilo-alternate kilo/z-ai/glm-5.2 failed kilo run failed (exit 1)

_ lane: fleet-review chain (self-hosted kvm4) - spark-local (when online) -> kilo-primary -> kilo-alternate _

@github-actions

github-actions Bot commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

Fleet review: NO-REVIEWER-AVAILABLE

Every reviewer tier failed or was unavailable, so this PR has NOT been reviewed by the fleet lane. This is could-not-measure, not a pass.

tier reviewer model outcome detail
1 spark-local - not-configured SPARK_REVIEW_URL is not set
2 kilo-primary kilo/z-ai/glm-5.3 failed kilo run failed (exit 1)
3 kilo-alternate kilo/z-ai/glm-5.2 failed kilo run failed (exit 1)

_ lane: fleet-review chain (self-hosted kvm4) - spark-local (when online) -> kilo-primary -> kilo-alternate _

@POWERFULMOVES
POWERFULMOVES merged commit 023f164 into main Oct 2, 2026
34 of 35 checks passed
@POWERFULMOVES
POWERFULMOVES deleted the fix/ghcr-read-access-knuckles branch October 2, 2026 09:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation governance AGNOTE register / agent definitions / damage-control hooks

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant