Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
147 commits
Select commit Hold shift + click to select a range
1481952
Bind ordinary mixed-runtime supervise executables
Meta-Develop Sep 25, 2026
0df267e
Merge current main into mixed-runtime task branch
Meta-Develop Sep 25, 2026
8b445eb
Bind explicit role-model overrides to authored runtimes
Meta-Develop Sep 26, 2026
a222ea5
Merge commit 'c06b937dc258a6c8a87052c5ec1368f033f64e89' into codex/ne…
Meta-Develop Sep 26, 2026
17e6195
Route Codex nested workers through managed parent turns
Meta-Develop Sep 27, 2026
6a85648
Bridge managed parent requests through the Codex app server
Meta-Develop Sep 27, 2026
ce4ae58
Fix managed parent admission after runtime selection
Meta-Develop Sep 28, 2026
29940ee
Merge current main into mixed-runtime executable branch
Meta-Develop Sep 28, 2026
4a5a711
Merge updated mixed-runtime base into role selection branch
Meta-Develop Sep 28, 2026
a66fc1c
Merge current token-budget guard into mixed-runtime bindings
Meta-Develop Sep 28, 2026
2f8fe2f
Merge token-budget guard into role runtime selection
Meta-Develop Sep 28, 2026
6cc23fc
Merge live usage guard and preserve managed parent failure evidence
Meta-Develop Sep 28, 2026
a4c5c01
fix: reject placeholder prices for real-provider budgets
Meta-Develop Sep 28, 2026
26195d9
fix: preserve verified model allocation through cost reporting
Meta-Develop Sep 28, 2026
27d2ba5
fix: preserve successful unqualified Codex transport
Meta-Develop Sep 28, 2026
1b857f4
Preflight declared Researcher source inputs before provider dispatch
Meta-Develop Sep 28, 2026
de5a3da
Merge reviewed provider reporting correction
Meta-Develop Sep 28, 2026
ed7014a
Bind observed model identity in priced accounting fixtures
Meta-Develop Sep 28, 2026
078a396
Merge reviewed priced fixture correction
Meta-Develop Sep 28, 2026
79b6710
Parse Gemini CLI native JSON telemetry without granting authority
Meta-Develop Sep 28, 2026
7cde662
fix: observe supervised readonly Codex auditors
Meta-Develop Sep 28, 2026
ff7d08e
Honor verified source inputs in readonly Researcher viability checks
Meta-Develop Sep 28, 2026
a324bae
Preserve the messaging appendix after source-input context
Meta-Develop Sep 28, 2026
03debe0
Settle Grok usage from private native subprocess captures
Meta-Develop Sep 29, 2026
254cbce
Verify Researcher source visibility before Codex generation
Meta-Develop Sep 29, 2026
6e6860d
Integrate bound Grok usage with immutable Researcher inputs
Meta-Develop Sep 29, 2026
871a514
Integrate explicit executables for mixed runtime supervision
Meta-Develop Sep 29, 2026
e66870b
Integrate managed parent control with bounded nested workers
Meta-Develop Sep 29, 2026
98b4a00
fix: append typed worker execution journals
Meta-Develop Sep 30, 2026
ac9ad9c
Interrupt managed worker turns at observed token grants
Meta-Develop Sep 30, 2026
54f9b4d
Merge managed runtime foundation with current main
Meta-Develop Sep 30, 2026
bf77155
Remove generated runtime reports from the source tree
Meta-Develop Oct 5, 2026
a866c6c
Implement managed-account adaptive orchestration
Meta-Develop Oct 12, 2026
fbf9cc0
Explain inventory timeouts without dirty-tree recovery advice
Meta-Develop Oct 12, 2026
89f832a
Merge main worktree fixes into orchestration implementation
Meta-Develop Oct 12, 2026
765d11c
Prepare private account fixtures on Unix platforms
Meta-Develop Oct 12, 2026
9284dfe
Keep account catalog and Claude binding portable
Meta-Develop Oct 12, 2026
382aee8
Authorize model-less deterministic fake bindings
Meta-Develop Oct 12, 2026
7195b41
Isolate injected autopilot fixtures from CAM discovery
Meta-Develop Oct 12, 2026
0b0627b
CAM platform boundaries and positive fixture portability
Meta-Develop Oct 12, 2026
9d5ba08
Runtime fixture corrections and protocol-specific Grok ACP contract
Meta-Develop Oct 12, 2026
fd7203d
Generated assessment carriers, strict schema declaration and canonica…
Meta-Develop Oct 12, 2026
16a5c30
Deterministic Fake experiment execution, workspace binding and positi…
Meta-Develop Oct 12, 2026
c658978
Provider-neutral CLI expectation and literal README contract
Meta-Develop Oct 12, 2026
5d1ef68
Prompt wording within the unchanged child bootstrap ceiling
Meta-Develop Oct 12, 2026
ef7894d
Source-bound Nix package and CI provisioning
Meta-Develop Oct 12, 2026
e38a984
test(ci): update package gate receipts and surface safety preflight f…
Meta-Develop Oct 12, 2026
f523ed9
test(cam): isolate authority and command provider fixtures [skip ci]
Meta-Develop Oct 12, 2026
a60421d
test(grok): align ACP fixtures with the supported contained process c…
Meta-Develop Oct 12, 2026
81cadb1
test(autopilot): bind licensed cascade fixtures to the selected audit…
Meta-Develop Oct 12, 2026
990b857
test(sandbox): align runtime projections and diagnose resolver trust …
Meta-Develop Oct 12, 2026
36837a3
fix(cursor): report nonsecret metadata for refused offline checks [sk…
Meta-Develop Oct 12, 2026
ca7bb17
test(supervise): prepare attached capture fixtures through the manage…
Meta-Develop Oct 12, 2026
c15db01
test(supervise): derive fixture task assessments under frozen policy …
Meta-Develop Oct 12, 2026
9f0e426
fix(merge): carry validated task assessment into account review selec…
Meta-Develop Oct 12, 2026
91c7352
fix(selection): use DecisionRef accessors for task assessment
Meta-Develop Oct 12, 2026
ec5fb24
Update quinn-proto to the patched release [skip ci]
Meta-Develop Oct 12, 2026
7792303
Isolate the trusted resolver projection fixture [skip ci]
Meta-Develop Oct 12, 2026
6ffd903
Validate tampered follow-up metadata before refusal [skip ci]
Meta-Develop Oct 12, 2026
93a0e6c
Declare dependent API work in role authority fixture [skip ci]
Meta-Develop Oct 12, 2026
161efec
Capture bounded Supervisor failures before the full shard [skip ci]
Meta-Develop Oct 12, 2026
f27e1a4
Deliver Cursor sign-in instructions to the account manager
Meta-Develop Oct 12, 2026
4029449
test(account-manager): assert redaction through public login status […
Meta-Develop Oct 12, 2026
3d081ee
test(supervise): align routing fixtures with loaded policy [skip ci]
Meta-Develop Oct 12, 2026
c7f9fee
test(cursor): classify sealed check failures without raw output [skip…
Meta-Develop Oct 12, 2026
446a4cf
fix(schema): close generated routing policy carriers
Meta-Develop Oct 12, 2026
207ef37
test(cursor): classify exact sealed refusal framing without raw outpu…
Meta-Develop Oct 13, 2026
02fcf4d
test(supervise): align CLI fixture with the current routing contract …
Meta-Develop Oct 13, 2026
4b0d93f
test(supervise): bind positive fixtures to genuine assessed selection…
Meta-Develop Oct 13, 2026
0f8739f
test(ci): run reviewed supervisor discriminators before broad coverage
Meta-Develop Oct 13, 2026
de5abfb
fix(tests): resolve supervisor fixture types and module paths
Meta-Develop Oct 13, 2026
5f7dae6
fix(ci): align supervisor fixtures and retain safe helper diagnostics
Meta-Develop Oct 13, 2026
4ccf39d
Model semantic contention with a valid supervised plan
Meta-Develop Oct 13, 2026
1ad0007
Keep native launch provenance outside isolated user namespaces
Meta-Develop Oct 13, 2026
ad6c886
Disable Grok CLI background update checks in managed launches
Meta-Develop Oct 13, 2026
d51742b
Package the Grok account setup CLI in the source-bound Linux build
Meta-Develop Oct 13, 2026
ab3f4ed
Align CI fixtures with sealed native launch preparation
Meta-Develop Oct 13, 2026
8ebe325
Fix native execution Clippy diagnostics
Meta-Develop Oct 13, 2026
c5414e5
Finalize messaging before sealing dispatch grants
Meta-Develop Oct 13, 2026
d72381e
Supply validated task assessments to positive selection fixtures
Meta-Develop Oct 13, 2026
e0ac7fa
Supply isolated CAM observations to positive supervise fixtures
Meta-Develop Oct 13, 2026
b75b797
Give direct execution fixtures explicit catalogued role identities
Meta-Develop Oct 13, 2026
03d130c
Apply CI formatting to reviewed supervisor changes
Meta-Develop Oct 13, 2026
ed5ff39
Select fixture roles before validation gate corrections
Meta-Develop Oct 13, 2026
64bd299
Reach report symlink refusal through an explicitly selected fixture
Meta-Develop Oct 13, 2026
4035a2d
Declare complete routing inputs in regression fixtures
Meta-Develop Oct 13, 2026
d602c18
Identify isolated proc fixture startup refusal stage
Meta-Develop Oct 13, 2026
0e0a13f
Retain endpoint addresses on closure assertion failure
Meta-Develop Oct 13, 2026
889f002
Bind licensed source fixtures to routing assessments
Meta-Develop Oct 13, 2026
fc6678e
Grant user namespaces to the exact CI libtest executable
Meta-Develop Oct 13, 2026
beda933
Repair CI fixtures for rest gating and sealed runtime contracts
Meta-Develop Oct 14, 2026
25c8f33
Keep sealed test binaries bounded and bind native usage fixtures
Meta-Develop Oct 14, 2026
0f6f7b5
Qualify Cursor confinement kind in quota fixture
Meta-Develop Oct 14, 2026
cebf786
Align Grok argv test expectations with update guard
Meta-Develop Oct 14, 2026
fb0c0b5
Resolve trusted supervisor test fixture prerequisites
Meta-Develop Oct 14, 2026
9de1d65
Align supervisor fixtures with loaded selection and direct workers
Meta-Develop Oct 14, 2026
12c204f
Fix supervisor fixture identities and pending assignment scopes
Meta-Develop Oct 14, 2026
dccf03b
Fix independent review lens selection and launch timing
Meta-Develop Oct 14, 2026
f0a2ebe
Fix review quota runtime string conversion
Meta-Develop Oct 14, 2026
e24248e
Mask the Nix daemon directory in strict process isolation
Meta-Develop Oct 14, 2026
5f03cab
Bind selected accounts and default efforts in test fixtures
Meta-Develop Oct 14, 2026
98f1398
Observe selected secondary providers in scheduler fixtures
Meta-Develop Oct 14, 2026
461c4d0
Update rustls to patched 0.23.46
Meta-Develop Oct 14, 2026
0dd743d
Carry assessed selector decisions into cycle proof fixtures
Meta-Develop Oct 14, 2026
e743ed3
Partition supervise library tests into bounded complete shards
Meta-Develop Oct 14, 2026
a6a035a
Retain selected account custody in licensed source fixtures
Meta-Develop Oct 14, 2026
8da4388
Align existing CI consumer tests with four library shards
Meta-Develop Oct 14, 2026
0da2c4d
Supply managed selection authority to positive review fixtures
Meta-Develop Oct 14, 2026
bf14d72
Apply loaded routing review and retry tradeoffs to candidate scores
Meta-Develop Oct 14, 2026
8edd9fe
Initialize optional Git info through authenticated worktree metadata
Meta-Develop Oct 14, 2026
28545ae
Bind managed parent workspace access to the actual attempt purpose
Meta-Develop Oct 14, 2026
4a96783
Pass ordinary purpose to the nested Worker launch binder
Meta-Develop Oct 14, 2026
a144b1d
Coordinate explicit terminal Worker overlaps and bind selected fixtur…
Meta-Develop Oct 14, 2026
3e6122e
Assert exact review lens effort over assignment fallback
Meta-Develop Oct 14, 2026
40720ac
Emit canonical default metadata for generated nested Workers
Meta-Develop Oct 14, 2026
b7acba4
Bind unknown-access review fixture to a labelled eligible prior
Meta-Develop Oct 14, 2026
276bbc6
Preserve planning gaps and repair managed orchestration fixtures
Meta-Develop Oct 14, 2026
76ae489
Seal writable confinement after launch command finalization
Meta-Develop Oct 14, 2026
9d0a640
Assess remaining replans and admit orchestration test fixtures
Meta-Develop Oct 14, 2026
89aba37
Diagnose Grok owner authentication and bind verified test launches
Meta-Develop Oct 15, 2026
d7d8dc4
Preserve owned selection and source evidence in supervisor fixtures
Meta-Develop Oct 15, 2026
16c7726
Admit Grok's inner bubblewrap in the ExternalGrok systemd profile
Meta-Develop Oct 15, 2026
98c82ab
Repair stale supervise fixtures for owned selection and custody
Meta-Develop Oct 15, 2026
ef110d8
Merge Grok bubblewrap profile parity into usable test repairs
Meta-Develop Oct 15, 2026
8ea997c
Default bare instructions to the Codex runtime and add a Linux quicks…
Meta-Develop Oct 15, 2026
266ce25
Merge bare-instruction runtime default and quickstart
Meta-Develop Oct 15, 2026
221d528
Repair plan-runtime, quota-refresh and gate-classifier fixtures
Meta-Develop Oct 15, 2026
df554f5
Repair remaining supervise Linux fixtures against current authority c…
Meta-Develop Oct 15, 2026
707b8f0
Add current Codex priors: gpt-6.1-sol baseline and prohibited GPT-6 A…
Meta-Develop Oct 15, 2026
b898bb3
Assert per-assignment budget halts and restore the all-frontier profi…
Meta-Develop Oct 15, 2026
8817814
Release the concurrent release-error fixture only after the scheduler…
Meta-Develop Oct 15, 2026
4c76d3b
Give shared supervise test helpers distinct run ids per caller
Meta-Develop Oct 15, 2026
4cf7326
Date operator prior fixtures relative to the bundled priors
Meta-Develop Oct 15, 2026
cc724c2
Accept literal single-file create and append goals end to end
Meta-Develop Oct 15, 2026
bc74d12
Treat an absent implicit CAM endpoint as CAM not configured
Meta-Develop Oct 15, 2026
717ddf7
Keep a local-auth Codex primary eligible when CAM is not configured
Meta-Develop Oct 15, 2026
7edbe58
Disable native delegation for direct Codex Workers and allow local-au…
Meta-Develop Oct 15, 2026
47b5085
Fall back to a component walk when openat2 is unavailable for worker …
Meta-Develop Oct 15, 2026
15dfaa2
Keep earlier selector seals when entering a review lens scope
Meta-Develop Oct 15, 2026
830f599
Bind the parent process record to review lens evidence by digest
Meta-Develop Oct 15, 2026
978c9b6
Recheck the admitted CAM endpoint before releasing a launch
Meta-Develop Oct 15, 2026
68870ba
Attribute worker changes by wrapper observation instead of model flags
Meta-Develop Oct 15, 2026
da71f91
Bind the endpoint-appearance test socket through the short-path helper
Meta-Develop Oct 16, 2026
893ad07
Give bounded-status cleanup its own budget and keep scans within theirs
Meta-Develop Oct 16, 2026
5b23682
Canonicalize journal-append wrapper commands in worker reports
Meta-Develop Oct 16, 2026
7b54069
Accept Codex moderation notices and report missing worker reports as …
Meta-Develop Oct 16, 2026
f57624f
Document the Linux operator path for Codex and Grok workers
Meta-Develop Oct 16, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
274 changes: 274 additions & 0 deletions .github/scripts/configure-github-hosted-root-libtest-userns.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,274 @@
#!/usr/bin/env bash
# GitHub-hosted Ubuntu only: ADD a unique maco-ci AppArmor userns profile for
# the source-built root libtest ELF. Do not run on developer or self-hosted hosts.
set -euo pipefail

if [[ "$#" -ne 0 ]]; then
printf '%s\n' "usage: $0" >&2
exit 1
fi

readonly PARSER=/usr/sbin/apparmor_parser
readonly ABI_FILE=/etc/apparmor.d/abi/4.0
readonly PROFILE_NAME=maco-ci-github-hosted-root-libtest
readonly PROFILES_FS=/sys/kernel/security/apparmor/profiles
readonly PYTHON=/usr/bin/python3
readonly ROOT_PACKAGE_NAME=multi-agent-coding-orchestrator
readonly ROOT_LIB_TARGET_NAME=multi_agent_coding_orchestrator

die() {
printf '%s\n' "$*" >&2
exit 1
}

os_release_id() {
awk -F= '$1=="ID" { gsub(/"/, "", $2); print $2; exit }' /etc/os-release
}

kernel_profiles() {
# securityfs may report readable mode bits while still requiring privilege.
sudo -n cat -- "${PROFILES_FS}"
}

profile_name_loaded() {
local listing="$1"
awk -v name="${PROFILE_NAME}" '$1==name { found=1 } END { exit found ? 0 : 1 }' \
<<<"${listing}"
}

artifact_fingerprint() {
stat -c 'uid=%u gid=%g mode=%a inode=%i size=%s' -- "$1"
sha256sum -- "$1"
}

[[ "${GITHUB_ACTIONS:-}" == true ]] || \
die "refusing: GITHUB_ACTIONS is not true"
[[ "${RUNNER_ENVIRONMENT:-}" == github-hosted ]] || \
die "refusing: RUNNER_ENVIRONMENT is not github-hosted; self-hosted is unsupported"
[[ "$(uname -s)" == Linux ]] || die "refusing: host is not Linux"
[[ -r /etc/os-release ]] || die "refusing: /etc/os-release is unreadable"
[[ "$(os_release_id)" == ubuntu ]] || die "refusing: host is not Ubuntu"

[[ -x "${PARSER}" && -f "${PARSER}" && ! -L "${PARSER}" ]] || \
die "refusing: AppArmor parser is not available at ${PARSER}"
[[ -f "${ABI_FILE}" && ! -L "${ABI_FILE}" ]] || \
die "refusing: AppArmor abi file is missing at ${ABI_FILE}"

[[ -x "${PYTHON}" && -f "${PYTHON}" ]] || \
die "refusing: python3 is not available at ${PYTHON}"

if [[ -n "${CARGO_TARGET_DIR+x}" ]]; then
die "refusing: CARGO_TARGET_DIR override is set; default target/debug/deps is required"
fi

[[ -n "${GITHUB_WORKSPACE:-}" && -d "${GITHUB_WORKSPACE}" ]] || \
die "refusing: GITHUB_WORKSPACE is not a usable directory"
workspace="$(realpath -e "${GITHUB_WORKSPACE}")"
[[ "${workspace}" == "${GITHUB_WORKSPACE}" ]] || \
die "refusing: GITHUB_WORKSPACE is not canonical"
root_manifest="${workspace}/Cargo.toml"
[[ -f "${root_manifest}" && ! -L "${root_manifest}" ]] || \
die "refusing: root manifest is not a regular file at ${root_manifest}"
[[ "$(realpath -e "${root_manifest}")" == "${root_manifest}" ]] || \
die "refusing: root manifest is not the canonical path"

[[ -n "${RUNNER_TEMP:-}" && -d "${RUNNER_TEMP}" ]] || \
die "refusing: RUNNER_TEMP is not a usable directory"

cd -- "${workspace}"

metadata_out="$(mktemp "${RUNNER_TEMP}/maco-ci-root-libtest-metadata.XXXXXX")"
metadata_err="$(mktemp "${RUNNER_TEMP}/maco-ci-root-libtest-metadata-err.XXXXXX")"
discover_out="$(mktemp "${RUNNER_TEMP}/maco-ci-root-libtest-discover.XXXXXX")"
discover_err="$(mktemp "${RUNNER_TEMP}/maco-ci-root-libtest-discover-err.XXXXXX")"
remove_cargo_temps() {
rm -f -- "${metadata_out}" "${metadata_err}" "${discover_out}" "${discover_err}"
}

set +e
cargo +1.94.1 metadata --locked --no-deps --format-version 1 \
>"${metadata_out}" 2>"${metadata_err}"
metadata_status=$?
set -e
if [[ "${metadata_status}" -ne 0 ]]; then
cat -- "${metadata_err}" >&2
remove_cargo_temps
die "cargo +1.94.1 metadata failed with status ${metadata_status}"
fi
printf 'cargo +1.94.1 metadata status=%s\n' "${metadata_status}"

set +e
cargo +1.94.1 test --locked --lib --no-run --message-format=json \
-p multi-agent-coding-orchestrator \
>"${discover_out}" 2>"${discover_err}"
discover_status=$?
set -e
if [[ "${discover_status}" -ne 0 ]]; then
cat -- "${discover_err}" >&2
remove_cargo_temps
die "cargo +1.94.1 test --no-run failed with status ${discover_status}"
fi
printf 'cargo +1.94.1 test --locked --lib --no-run --message-format=json -p %s status=%s\n' \
"${ROOT_PACKAGE_NAME}" "${discover_status}"

set +e
artifact="$("${PYTHON}" -I -B - "${metadata_out}" "${discover_out}" "${workspace}" \
"${ROOT_PACKAGE_NAME}" "${ROOT_LIB_TARGET_NAME}" <<'PY'
import json
import pathlib
import re
import sys

metadata_path, discover_path, workspace, package_name, target_name = sys.argv[1:6]
ws = pathlib.Path(workspace)
if not ws.is_absolute():
raise SystemExit("refusing: workspace is not absolute")
ws = ws.resolve(strict=True)
meta = json.loads(pathlib.Path(metadata_path).read_text(encoding="utf-8"))
meta_ws = pathlib.Path(meta["workspace_root"]).resolve(strict=True)
if meta_ws != ws:
raise SystemExit(f"refusing: metadata workspace_root is not the owned root repo ({meta_ws})")
manifest = (ws / "Cargo.toml").resolve(strict=True)
if manifest != ws / "Cargo.toml":
raise SystemExit("refusing: root manifest is not canonical")
root = None
for pkg in meta["packages"]:
mp = pathlib.Path(pkg["manifest_path"]).resolve(strict=True)
if mp != manifest:
continue
if root is not None:
raise SystemExit("refusing: multiple packages share the canonical root manifest")
root = pkg
if root is None:
raise SystemExit("refusing: canonical root manifest has no metadata package")
if root.get("name") != package_name:
raise SystemExit(
f"refusing: root package name is {root.get('name')!r}, expected {package_name!r}"
)
package_id = root.get("id")
if not isinstance(package_id, str) or not package_id or "\n" in package_id:
raise SystemExit("refusing: root package id is not a single-line string")
members = meta.get("workspace_members")
if not isinstance(members, list) or package_id not in members:
raise SystemExit("refusing: root package id is not an exact workspace member")
target_directory = pathlib.Path(meta["target_directory"])
if not target_directory.is_absolute() or target_directory != ws / "target":
raise SystemExit(
f"refusing: CARGO_TARGET_DIR override/nondefault path {target_directory}"
)

matches = []
for raw in pathlib.Path(discover_path).read_text(encoding="utf-8").splitlines():
if not raw:
continue
try:
msg = json.loads(raw)
except json.JSONDecodeError as exc:
raise SystemExit(f"refusing: cargo json line is not an object: {exc}") from exc
if not isinstance(msg, dict):
raise SystemExit("refusing: cargo json line is not an object")
if msg.get("reason") != "compiler-artifact":
continue
profile = msg.get("profile")
if not isinstance(profile, dict) or profile.get("test") is not True:
continue
executable = msg.get("executable")
if not isinstance(executable, str) or executable == "":
continue
target = msg.get("target")
if not isinstance(target, dict):
continue
kind = target.get("kind")
if not isinstance(kind, list) or "lib" not in kind:
continue
if target.get("name") != target_name:
continue
if msg.get("package_id") != package_id:
continue
matches.append(executable)
if len(matches) != 1:
raise SystemExit(
f"refusing: expected exactly one root libtest compiler-artifact, found {len(matches)}"
)
exe = matches[0]
if not re.fullmatch(r"(?:/[A-Za-z0-9._+-]+)+", exe):
raise SystemExit("refusing: artifact path is not a single safe AppArmor path token")
print(f"root libtest package_id={package_id}", file=sys.stderr)
print(exe)
PY
)"
parse_status=$?
set -e
if [[ "${parse_status}" -ne 0 || -z "${artifact}" ]]; then
cat -- "${discover_err}" >&2
remove_cargo_temps
die "root libtest compiler-artifact parse failed with status ${parse_status}"
fi
remove_cargo_temps

[[ "${artifact}" == /* ]] || die "refusing: artifact path is not absolute"
[[ -e "${artifact}" ]] || die "refusing: ${artifact} does not exist"
[[ ! -L "${artifact}" ]] || die "refusing: ${artifact} is a symlink"
[[ -f "${artifact}" && -x "${artifact}" ]] || \
die "refusing: ${artifact} is not a regular executable"
canonical="$(realpath -e "${artifact}")"
[[ "${canonical}" == "${artifact}" ]] || \
die "refusing: ${artifact} is not the canonical path (${canonical})"

deps_dir="${workspace}/target/debug/deps"
[[ "$(dirname -- "${canonical}")" == "${deps_dir}" ]] || \
die "refusing: artifact is not under default ${deps_dir}"
cur="${canonical}"
while :; do
[[ ! -L "${cur}" ]] || die "refusing: ${cur} is a symlink"
[[ "${cur}" == "${workspace}" ]] && break
[[ "${cur}" != "/" ]] || die "refusing: ${canonical} is not under ${workspace}"
cur="$(dirname -- "${cur}")"
done

[[ "$(stat -c '%u' "${canonical}")" == "$(id -u)" ]] || \
die "refusing: ${canonical} is not owned by the current runner uid"
mode="$(stat -c '%a' "${canonical}")"
(( (8#${mode} & 8#022) == 0 )) || \
die "refusing: ${canonical} is group- or world-writable"
"${PYTHON}" -I -B -c 'import sys; f=open(sys.argv[1],"rb"); sys.exit(0 if f.read(4)==b"\x7fELF" else 1)' \
"${canonical}" || die "refusing: ${canonical} is not an ELF"

fingerprint_before="$(artifact_fingerprint "${canonical}")"
printf 'root libtest artifact path=%s\n' "${canonical}"
printf 'root libtest artifact identity before add:\n%s\n' "${fingerprint_before}"

profile_file="$(mktemp "${RUNNER_TEMP}/maco-ci-root-libtest-userns.XXXXXX")"
trap 'rm -f -- "${profile_file}"' EXIT
[[ "$(stat -c '%u %a' "${profile_file}")" == "$(id -u) 600" ]] || \
die "refusing: profile tempfile is not exclusively owned"

cat >"${profile_file}" <<EOF
abi <abi/4.0>,

profile maco-ci-github-hosted-root-libtest ${canonical} flags=(default_allow) {
userns,
}
EOF

"${PARSER}" --skip-kernel-load --skip-cache --skip-read-cache -- "${profile_file}"

listing="$(kernel_profiles)"
if profile_name_loaded "${listing}"; then
die "refusing: kernel already has profile ${PROFILE_NAME}; ADD would conflict"
fi
printf 'AppArmor profile %s loaded_before_add=no\n' "${PROFILE_NAME}"

sudo -n "${PARSER}" --add --skip-cache --skip-read-cache -- "${profile_file}"

listing="$(kernel_profiles)"
profile_name_loaded "${listing}" || \
die "AppArmor profile ${PROFILE_NAME} was not present after parser add"
printf 'AppArmor profile %s loaded_after_add=yes\n' "${PROFILE_NAME}"

fingerprint_after="$(artifact_fingerprint "${canonical}")"
[[ "${fingerprint_before}" == "${fingerprint_after}" ]] || \
die "refusing: root libtest artifact changed after profile add"
printf 'root libtest artifact identity after add:\n%s\n' "${fingerprint_after}"

printf 'configured %s userns for %s\n' "${PROFILE_NAME}" "${canonical}"
40 changes: 40 additions & 0 deletions .github/scripts/install-github-hosted-ci-nix.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/usr/bin/env bash
# Only the GitHub-hosted ephemeral Linux runner may run this installer.
set -euo pipefail
test "$RUNNER_ENVIRONMENT" = github-hosted
test "$RUNNER_OS" = Linux
test "$RUNNER_ARCH" = X64
test ! -e /nix
test ! -e /etc/nix
umask 077
lane="$(mktemp -d "$RUNNER_TEMP/nix-package.XXXXXXXX")"
archive="$lane/nix-2.35.2-x86_64-linux.tar.xz"
# SHA256 published in https://releases.nixos.org/nix/nix-2.35.2/install.
env -i PATH=/usr/bin:/bin /usr/bin/curl --disable \
--fail --show-error --location --proto '=https' --proto-redir '=https' \
--connect-timeout 15 --max-time 300 --retry 0 \
--output "$archive" \
https://releases.nixos.org/nix/nix-2.35.2/nix-2.35.2-x86_64-linux.tar.xz
printf '%s %s\n' \
0c3960a9792331a22081c3c7a5d8465db9b17c50b3acdf18587fa4c6f2cb1158 \
"$archive" | sha256sum --check --strict
# Preserve public store readability inside the private transport lane.
(umask 022; tar --extract --xz --file "$archive" --directory "$lane" --no-same-owner)
mkdir -m 0700 "$lane/home"
cat > "$lane/nix.conf" <<'CONF'
experimental-features = nix-command flakes
sandbox = true
max-jobs = 1
cores = 1
allow-import-from-derivation = false
CONF
# Only the verified official installer runs with ephemeral runner root.
# The daemon installer still edits system profiles in this Nix version.
sudo -n /usr/bin/env -i \
HOME=/root USER=root LOGNAME=root \
PATH=/usr/sbin:/usr/bin:/sbin:/bin \
TMPDIR="$lane" NIX_SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt \
/bin/sh "$lane/nix-2.35.2-x86_64-linux/install" \
--daemon --yes --no-modify-profile --no-channel-add \
--daemon-user-count 1 --nix-extra-conf-file "$lane/nix.conf" < /dev/null
printf 'lane=%s\n' "$lane" >> "$GITHUB_OUTPUT"
Loading
Loading