@@ -94,8 +94,8 @@ if supplied != "sha256:" + hashlib.sha256(canonical).hexdigest(): raise SystemEx
9494if "sha256:" + hashlib.sha256(executor_path.read_bytes()).hexdigest() != request["protocol"]["executor_digest"]: raise SystemExit("guest bootstrap: executor digest mismatch")
9595if request["protocol"]["guest_digest"] != sys.argv[3]: raise SystemExit("guest bootstrap: guest digest mismatch")
9696repo = request["repository"]
97- if repo.get("source_mode") not in ("public-github-https", "private-parent-bundle") or not repo.get("remote", "").startswith("https://github.com/"): raise SystemExit("guest bootstrap: source mode mismatch")
98- if repo.get("source_mode") == "private-parent-bundle":
97+ if repo.get("source_mode") not in ("public-github-https", "private-parent-bundle", "private-exact-bundle" ) or not repo.get("remote", "").startswith("https://github.com/"): raise SystemExit("guest bootstrap: source mode mismatch")
98+ if repo.get("source_mode") in ( "private-parent-bundle", "private-exact-bundle") :
9999 if not repo.get("input_blob") or not repo.get("snapshot_digest") or not repo.get("snapshot_bytes"): raise SystemExit("guest bootstrap: private snapshot binding is incomplete")
100100else:
101101 if repo.get("input_blob") is not None or repo.get("snapshot_bytes") != 0: raise SystemExit("guest bootstrap: public source carries private staging")
@@ -145,7 +145,7 @@ runuser -u fmrunner -- git -C /work/repo remote add origin "$REMOTE"
145145# repository as dubious (CVE-2022-24765); scope the exception through the
146146# environment exactly as the validation cell guest does.
147147export GIT_CONFIG_COUNT=1 GIT_CONFIG_KEY_0=safe.directory GIT_CONFIG_VALUE_0=/work/repo
148- if [ " $SOURCE_MODE " = private-parent-bundle ]; then
148+ if [ " $SOURCE_MODE " = private-parent-bundle ] || [ " $SOURCE_MODE " = private-exact-bundle ] ; then
149149 [ " $INPUT_BLOB " = " $( read_request repository.input_blob) " ] || { echo " guest bootstrap: private snapshot blob mismatch" >&2 ; exit 125; }
150150 SNAPSHOT=$BASE /snapshot.bundle
151151 TOKEN_FILE=$BASE /input-token
@@ -184,10 +184,15 @@ for value in json.load(open(sys.argv[1],encoding="utf-8"))["repository"].get("so
184184PY
185185while IFS= read -r ancestor; do
186186 [ -n " $ancestor " ] || continue
187- run_bootstrap_network runuser -u fmrunner -- git -C /work/repo fetch --depth=1 origin " $ancestor "
188- [ " $( git -C /work/repo rev-parse FETCH_HEAD) " = " $ancestor " ] || { echo " guest bootstrap: source ancestor identity mismatch" >&2 ; exit 125; }
189- git -C /work/repo cat-file -e " $ancestor ^{commit}" || { echo " guest bootstrap: source ancestor is absent" >&2 ; exit 125; }
187+ if [ " $SOURCE_MODE " = public-github-https ]; then
188+ run_bootstrap_network runuser -u fmrunner -- git -C /work/repo fetch --depth=1 origin " $ancestor "
189+ [ " $( git -C /work/repo rev-parse FETCH_HEAD) " = " $ancestor " ] || { echo " guest bootstrap: source ancestor identity mismatch" >&2 ; exit 125; }
190+ git -C /work/repo cat-file -e " $ancestor ^{commit}" || { echo " guest bootstrap: source ancestor is absent" >&2 ; exit 125; }
191+ fi
190192done < " $BASE /source-ancestors"
193+ if [ " $SOURCE_MODE " = private-parent-bundle ] || [ " $SOURCE_MODE " = private-exact-bundle ]; then
194+ /usr/bin/python3 " $EXECUTOR " --verify-private-source-ancestors " $REQUEST " /work/repo
195+ fi
191196[ " $( git -C /work/repo rev-parse HEAD) " = " $COMMIT " ] && [ " $( git -C /work/repo rev-parse ' HEAD^{tree}' ) " = " $TREE " ] || { echo " guest bootstrap: source identity mismatch" >&2 ; exit 125; }
192197# Repository tests compare the snapshot against the default branch through
193198# the refs/remotes/origin view (generation 051 ground truth: a behavior
@@ -238,13 +243,19 @@ while IFS=$'\t' read -r url file bytes digest; do
238243 fetch_exact " $url " " /work/home/.fm-runner-tools/wheelhouse/$file " " $bytes " " $digest "
239244done < " $BASE /wheels.tsv"
240245chown -R fmrunner:fmrunner /work/home/.fm-runner-tools
241- [ " sha256:$( sha256sum /work/repo/tools/agent-fleet/uv.lock | awk ' {print $1}' ) " = " $( read_request protocol.agent_fleet_python.lock_digest) " ] || { echo " guest bootstrap: lock mismatch" >&2 ; exit 125; }
242- # The run-command handler's download directory is root-only, so the
243- # unprivileged uv invocations must not inherit it as their working
244- # directory (uv's config discovery reads ./uv.toml and refuses on EACCES).
245- cd /work/repo
246- runuser -u fmrunner -- /work/home/.fm-runner-tools/uv/uv venv --python /usr/bin/python3 /work/repo/tools/agent-fleet/.venv > /dev/null
247- runuser -u fmrunner -- env UV_OFFLINE=1 UV_NO_INDEX=1 /work/home/.fm-runner-tools/uv/uv pip install --python /work/repo/tools/agent-fleet/.venv/bin/python --offline --no-index --find-links /work/home/.fm-runner-tools/wheelhouse pytest ruff > /dev/null
246+ LOCK_DIGEST=$( read_request protocol.agent_fleet_python.lock_digest)
247+ if [ " $LOCK_DIGEST " != None ]; then
248+ [ " sha256:$( sha256sum /work/repo/tools/agent-fleet/uv.lock | awk ' {print $1}' ) " = " $LOCK_DIGEST " ] || { echo " guest bootstrap: lock mismatch" >&2 ; exit 125; }
249+ # The run-command handler's download directory is root-only, so the
250+ # unprivileged uv invocations must not inherit it as their working
251+ # directory (uv's config discovery reads ./uv.toml and refuses on EACCES).
252+ cd /work/repo
253+ runuser -u fmrunner -- /work/home/.fm-runner-tools/uv/uv venv --python /usr/bin/python3 /work/repo/tools/agent-fleet/.venv > /dev/null
254+ runuser -u fmrunner -- env UV_OFFLINE=1 UV_NO_INDEX=1 /work/home/.fm-runner-tools/uv/uv pip install --python /work/repo/tools/agent-fleet/.venv/bin/python --offline --no-index --find-links /work/home/.fm-runner-tools/wheelhouse pytest ruff > /dev/null
255+ elif [ -s " $BASE /wheels.tsv" ]; then
256+ echo " guest bootstrap: unbound Python wheels" >&2
257+ exit 125
258+ fi
248259
249260python3 - " $REQUEST " /work/repo << 'PY '
250261import hashlib,json,pathlib,sys
0 commit comments