Skip to content

Commit 7d43ee4

Browse files
committed
Enforce repository I/O security boundary
1 parent 155ce60 commit 7d43ee4

76 files changed

Lines changed: 41713 additions & 3423 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/validate.yml

Lines changed: 43 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,18 @@ jobs:
4444
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
4545
with:
4646
fetch-depth: 0
47+
persist-credentials: false
4748
- uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6
4849
with:
4950
python-version: ${{ matrix.python-version }}
51+
- name: Harden ephemeral Linux runner home chain
52+
if: runner.os == 'Linux'
53+
shell: bash
54+
run: |
55+
set -euo pipefail
56+
mapfile -d '' -t account_home_chain < <(python -I -S -B -c 'import os, pathlib, pwd; home = pathlib.Path(pwd.getpwuid(os.geteuid()).pw_dir); current = pathlib.Path(home.anchor); chain = [current]; [(chain.append(current := current / component)) for component in home.parts[1:]]; print(*(str(path) for path in chain), sep="\0", end="\0")')
57+
sudo setfacl --remove-all --remove-default -- "${account_home_chain[@]}"
58+
sudo chmod go-w -- "${account_home_chain[@]}"
5059
- name: Run the short dependency-free gate
5160
run: make check-fast
5261
- name: Run dependency-free unit contracts
@@ -72,9 +81,18 @@ jobs:
7281
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
7382
with:
7483
fetch-depth: 0
84+
persist-credentials: false
7585
- uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6
7686
with:
7787
python-version: ${{ matrix.python-version }}
88+
- name: Harden ephemeral Linux runner home chain
89+
if: runner.os == 'Linux'
90+
shell: bash
91+
run: |
92+
set -euo pipefail
93+
mapfile -d '' -t account_home_chain < <(python -I -S -B -c 'import os, pathlib, pwd; home = pathlib.Path(pwd.getpwuid(os.geteuid()).pw_dir); current = pathlib.Path(home.anchor); chain = [current]; [(chain.append(current := current / component)) for component in home.parts[1:]]; print(*(str(path) for path in chain), sep="\0", end="\0")')
94+
sudo setfacl --remove-all --remove-default -- "${account_home_chain[@]}"
95+
sudo chmod go-w -- "${account_home_chain[@]}"
7896
- name: Run Goal and Apply behavior gates
7997
run: make check-behavior
8098

@@ -85,9 +103,18 @@ jobs:
85103
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
86104
with:
87105
fetch-depth: 0
106+
persist-credentials: false
88107
- uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6
89108
with:
90109
python-version: "3.13"
110+
- name: Harden ephemeral Linux runner home chain
111+
if: runner.os == 'Linux'
112+
shell: bash
113+
run: |
114+
set -euo pipefail
115+
mapfile -d '' -t account_home_chain < <(python -I -S -B -c 'import os, pathlib, pwd; home = pathlib.Path(pwd.getpwuid(os.geteuid()).pw_dir); current = pathlib.Path(home.anchor); chain = [current]; [(chain.append(current := current / component)) for component in home.parts[1:]]; print(*(str(path) for path in chain), sep="\0", end="\0")')
116+
sudo setfacl --remove-all --remove-default -- "${account_home_chain[@]}"
117+
sudo chmod go-w -- "${account_home_chain[@]}"
91118
- name: Run package contract and extraction gates
92119
run: make check-package
93120
- name: Run public release privacy validation
@@ -129,10 +156,13 @@ jobs:
129156
test -f "$tmpdir/plugin/.codex-plugin/plugin.json"
130157
test ! -e "$tmpdir/plugin/tests"
131158
test ! -e "$tmpdir/source/CodexQB/.git"
132-
cd "$tmpdir/source/CodexQB"
133-
CODEXQB_VALIDATE_SKIP_UNITTESTS=1 \
134-
CODEXQB_VALIDATE_SKIP_BEHAVIOR_SMOKE=1 \
135-
bash scripts/validate.sh
159+
python3 -I -S -B scripts/run_extracted_validation.py \
160+
--expected-head "$GITHUB_SHA" \
161+
--zip "$tmpdir/CodexQB-source-worktree.zip" \
162+
--root "$tmpdir/source/CodexQB" \
163+
--profile static \
164+
--skip-unit-tests \
165+
--skip-behavior-smoke
136166
137167
required:
138168
name: required / CodexQB
@@ -161,9 +191,18 @@ jobs:
161191
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
162192
with:
163193
fetch-depth: 0
194+
persist-credentials: false
164195
- uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6
165196
with:
166197
python-version: "3.13"
198+
- name: Harden ephemeral Linux runner home chain
199+
if: runner.os == 'Linux'
200+
shell: bash
201+
run: |
202+
set -euo pipefail
203+
mapfile -d '' -t account_home_chain < <(python -I -S -B -c 'import os, pathlib, pwd; home = pathlib.Path(pwd.getpwuid(os.geteuid()).pw_dir); current = pathlib.Path(home.anchor); chain = [current]; [(chain.append(current := current / component)) for component in home.parts[1:]]; print(*(str(path) for path in chain), sep="\0", end="\0")')
204+
sudo setfacl --remove-all --remove-default -- "${account_home_chain[@]}"
205+
sudo chmod go-w -- "${account_home_chain[@]}"
167206
- name: Install release validation dependencies
168207
run: python -m pip install --requirement requirements-ci.txt
169208
- name: Run strict release validation

Makefile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ SHELL := /bin/bash
22
PYTHON ?= python3
33
NO_BYTECODE = PYTHONDONTWRITEBYTECODE=1
44
PLATFORM_POLICY ?= auto
5+
CODEXQB_SKILL_ROOT := $(abspath plugins/codexqb/skills/codexqb)
6+
CODEXQB_LAUNCHER := $(CODEXQB_SKILL_ROOT)/scripts/skill_launcher.py
57

68
.PHONY: check check-fast check-static check-unit check-platform check-schema check-behavior check-package check-public-privacy check-release test export-plugin export-source export-plugin-worktree export-source-worktree export-source-package export-sanitized export-sanitized-worktree export-sanitized-source-package
79

@@ -27,8 +29,8 @@ check-platform:
2729
@set -euo pipefail; \
2830
tmpdir="$$(mktemp -d)"; \
2931
trap 'rm -rf "$$tmpdir"' EXIT; \
30-
$(NO_BYTECODE) $(PYTHON) plugins/codexqb/skills/codexqb/scripts/doctor.py --json > "$$tmpdir/doctor.json"; \
31-
$(NO_BYTECODE) $(PYTHON) plugins/codexqb/skills/codexqb/scripts/doctor.py; \
32+
$(NO_BYTECODE) $(PYTHON) -I -S -B "$(CODEXQB_LAUNCHER)" --active-skill-md "$(CODEXQB_SKILL_ROOT)/SKILL.md" --controller doctor -- --json > "$$tmpdir/doctor.json"; \
33+
$(NO_BYTECODE) $(PYTHON) -I -S -B "$(CODEXQB_LAUNCHER)" --active-skill-md "$(CODEXQB_SKILL_ROOT)/SKILL.md" --controller doctor --; \
3234
probe_output="$$( $(NO_BYTECODE) $(PYTHON) tests/platform/run_mount_identity_probe.py )"; \
3335
echo "$$probe_output"; \
3436
if [[ "$(PLATFORM_POLICY)" == "required" && "$$probe_output" != *"status=ready "* ]]; then \
@@ -71,7 +73,7 @@ check-release:
7173
$(NO_BYTECODE) $(PYTHON) scripts/verify_package_manifest.py --root "$$tmpdir/plugin" --strict-artifact --expected-artifact-type plugin; \
7274
test -f "$$tmpdir/plugin/.codex-plugin/plugin.json"; \
7375
$(NO_BYTECODE) $(PYTHON) scripts/verify_package_manifest.py --root "$$tmpdir/source/CodexQB" --strict-artifact --expected-artifact-type source; \
74-
cd "$$tmpdir/source/CodexQB" && CODEXQB_VALIDATE_SKIP_UNITTESTS=1 CODEXQB_VALIDATE_SKIP_BEHAVIOR_SMOKE=1 bash scripts/validate.sh
76+
$(NO_BYTECODE) $(PYTHON) -I -S -B scripts/run_extracted_validation.py --expected-head "$$(git rev-parse --verify HEAD)" --zip "$$tmpdir/CodexQB-source-release.zip" --root "$$tmpdir/source/CodexQB" --profile static --skip-unit-tests --skip-behavior-smoke
7577

7678
# Legacy full discovery remains available for maintainers. Gate-aware CI uses
7779
# the explicit targets above so schema/package/platform behavior cannot drift.

0 commit comments

Comments
 (0)