Skip to content

feat(scripts): move the pin mover into the repo, refusing to run when the check is green - #99

Merged
garymike merged 1 commit into
mainfrom
feat/move-image-pins-script
Oct 30, 2026
Merged

garymike merged 1 commit into
mainfrom
feat/move-image-pins-script

Conversation

@garymike

Copy link
Copy Markdown
Owner

The pin mover had been a throwaway script living outside the repo. It moved the pins correctly in #95 and #97, and an hour later it would have churned all five again for no benefit, because the one rule that makes it safe to use lived only in whoever last ran it.

The two scripts disagree, on purpose

script question after an unchanged rebuild
check-image-pins.py was the pinned image built from the current inputs? current
move-image-pins.py does the pin name one specific build? would move

Measured right after #98, a commit that touched no image input at all:

gha-toolbox            aa9916df163c  ->  ed362d762a8b     pin is current
iac-toolbox            e61590613c79  ->  3ace795fff20     pin is current
sast-toolbox           bf29784b2121  ->  bb81183ce924     pin is current
security-toolbox-base  f6964aa2a12a  ->  e3ceac518850     pin is current
skill-audit-toolbox    efe95ac44558  ->  f9eaa41c62f0     pin is current

Five new digests, five valid pins. Every rebuild does this, because the Dockerfiles apt-get install current packages. Running the mover on that state would repoint every caller at a functionally identical build, in files whose whole point is that they change only deliberately.

So it refuses while the check is green.

--force, and why it has to exist

The weekly rebuild exists to pick up base-image patches. Those change what callers run without changing any input this repo tracks, so the check stays green while the pinned image ages. Pulling them through to callers is a legitimate reason to move a pin, and refusing outright would block it.

--force makes that intent explicit instead of inferred, and the refusal message names it rather than leaving you to find it:

All five pins already name an image built from the current inputs, so there is
nothing for this script to correct. Refusing, because moving them anyway would
repoint every caller at a functionally identical build.

If you mean to pull BASE-IMAGE patches through to callers, which the check cannot
see because they change no input this repo tracks, say so:

    scripts/move-image-pins.py origin/main --force --apply

Safety kept from the throwaway version

  • Resolves the per-commit sha-<commit12> tag, never latest. Before fix(ci): serialize toolbox publishing; two builds could push latest at once #98's concurrency guard, two builds 25 seconds apart both pushed latest and the earlier run's push landed last for iac-toolbox. The guard makes that unlikely rather than impossible; the per-commit tag cannot race at all.
  • Verifies every resolved digest's build-inputs label against the repo's own fingerprint and writes nothing unless all five match, so a wrong digest cannot land even under --force.
  • Reuses check-image-pins.py for the registry chain rather than duplicating it, so the mover and the check cannot disagree about how a pin resolves.

Both paths were exercised before committing: the refusal wrote nothing and exited 1, and the --force dry run listed all five and wrote nothing.

Also

check-image-pins.py's failure messages now name the script that fixes them, so a red run says what to do rather than only what is wrong. Logic untouched; it still reports all five current.

… the check is green

The mover had been a throwaway script outside the repo, so the one rule that makes it safe to
use lived only in whoever last ran it. It moved the pins correctly twice today, and would
have churned them a third time an hour later for no benefit.

The two scripts answer different questions and routinely disagree:

  check-image-pins.py   was the pinned image built from the current inputs?   -> current
  move-image-pins.py    does the pin name one specific build?                 -> would move

Every rebuild publishes a new digest, because the Dockerfiles apt-get install current
packages, so "names the newest build" goes false within a week of every pin move while "built
from current inputs" stays true. Measured right after #98, whose commit touched no image
input: all five digests changed and all five pins stayed current. Running the mover on that
state would have repointed every caller at a functionally identical build.

So it refuses while the check is green. --force covers the one case the check is blind to on
purpose: the weekly rebuild exists to pick up BASE-IMAGE patches, which change what callers
run without changing any input this repo tracks, so the check stays green while the pinned
image ages. Pulling those through to callers is a real reason to move a pin, and it now has
to be stated rather than inferred.

Resolves the per-commit sha- tag rather than latest, and verifies every digest's build-inputs
label against the repo's own fingerprint before writing, so a wrong digest cannot land even
under --force. Both paths were exercised before this commit: refusal wrote nothing and exited
1, --force dry-run listed all five and wrote nothing.

check-image-pins.py's failure messages now name the script that fixes them, so a red run says
what to do rather than only what is wrong.
@garymike
garymike merged commit 7b5b9b9 into main Oct 30, 2026
9 checks passed
@garymike
garymike deleted the feat/move-image-pins-script branch October 30, 2026 21:58
garymike added a commit to garymike/security-agents that referenced this pull request Oct 30, 2026
Was bee631e, four commits behind. No toolchain change comes with this: those four were
garymike/security-workflows#99 (scripts and changelog), #100 (dropped the redundant PyJWT
override) and #101 (moved the image pins onto the images built without it). Both affected
images resolve PyJWT 2.15.1 with or without that override, which is what made it safe to drop,
so callers get the same tool versions either way.

What it does deliver is a smaller surface to reason about: the pinned images no longer carry a
--no-deps install defeating a constraint semgrep has since relaxed. Keeping the pin current
also means the next upstream change that DOES matter is a one-line diff rather than a catch-up.
garymike added a commit to garymike/skills that referenced this pull request Oct 30, 2026
Was bee631e, four commits behind. No toolchain change comes with this: those four were
garymike/security-workflows#99 (scripts and changelog), #100 (dropped the redundant PyJWT
override) and #101 (moved the image pins onto the images built without it). The skill-audit
gate this repo depends on resolves PyJWT 2.15.1 with or without that override, which is what
made it safe to drop, so the gate behaves identically.

What it does deliver is a smaller surface to reason about: the pinned skill-audit image no
longer carries a --no-deps install defeating a constraint semgrep has since relaxed. Keeping
the pin current also means the next upstream change that DOES matter, such as whichever
SkillSpector release first carries NVIDIA/SkillSpector#893, is a one-line diff rather than a
catch-up.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant