You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The build recipe in the root Justfile caches the registry tag list at a
fixed, predictable path:
skopeo list-tags "docker://ghcr.io/${IMAGE_VENDOR:-${REPO_ORG}}/${target_image}">/tmp/repotags.json 2>/dev/null \
||echo (empty tag list) >/tmp/repotags.json
if [[ $(jq "any(.Tags[]; contains(\"${ver}\"))" /tmp/repotags.json)=="true" ]];then
Three problems with the fixed path:
Concurrent builds clobber each other. Two just build runs for
different target_image values in the same checkout (or by different users
on the same host) race on one file, so the tag-collision check can consult
the other image list and pick a version that already exists.
Predictable path in a shared directory. Anything that pre-creates /tmp/repotags.json as a symlink redirects the write, and an attacker who
controls the file content controls whether a point release is appended.
Test hygiene. The path is not overridable, so any unit test that
exercises the recipe mutates the host /tmp — the BATS suite in PR [quality] test: BATS coverage for Justfile build and tag-images recipes #296
sandboxes the Justfile, the Containerfile, PATH and the podman/skopeo
argv, but cannot sandbox this one write.
Finding
The
buildrecipe in the rootJustfilecaches the registry tag list at afixed, predictable path:
Three problems with the fixed path:
just buildruns fordifferent
target_imagevalues in the same checkout (or by different userson the same host) race on one file, so the tag-collision check can consult
the other image list and pick a version that already exists.
/tmp/repotags.jsonas a symlink redirects the write, and an attacker whocontrols the file content controls whether a point release is appended.
exercises the recipe mutates the host
/tmp— the BATS suite in PR [quality] test: BATS coverage for Justfile build and tag-images recipes #296sandboxes the
Justfile, theContainerfile,PATHand the podman/skopeoargv, but cannot sandbox this one write.
Recommendation
Use a per-invocation temp file with cleanup:
and substitute
${repotags}at the three use sites. No behavioural change forcallers; it also makes the recipe fully sandboxable under test.
Note the recipe body has no
set -euo pipefail, so a failingjqin thisblock does not abort the build — worth adding at the same time.
This is a production-code change, so it is deliberately not included in the
quality PR.
Priority
Related
Justfilebuild/tag-imagesFiled by quality agent (hold-gated mode)
🐝 Hive Agent:
quality| Instance:hosted-projectbluefin-knuckle-gjvq| SHA:c111e0d— hive: agent=quality backend=copilot model=claude-opus-5