Repository navigation
feat(sandbox): add quarantined patch validation #65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from 109 commits
Commits
Show all changes
136 commits
Select commit
Hold shift + click to select a range
42c2b67
test(sandbox): define quarantined patch validation contract
seonghobae 2fd5f8b
feat(sandbox): implement quarantined patch validation
seonghobae 28b6d58
feat(sandbox): export patch validation API
seonghobae 8d3f3c9
fix(sandbox): preserve nofollow patch path semantics
seonghobae 7d1fb3a
test(sandbox): close patch validator safety branches
seonghobae de2bab9
fix(sandbox): reject raw backslash patch paths before tokenization
seonghobae 641420b
docs(doctoring): record quarantined patch validation boundary
seonghobae 86052b5
docs(sandbox): explain quarantined patch validation
seonghobae f6a289d
docs(changelog): record quarantined patch validation
seonghobae c83fb48
docs(changelog): restore undici release-gate wording
seonghobae acd9c0b
test(sandbox): expose exact-source and patch handoff races
seonghobae 235b7e8
test(sandbox): expose hidden patch and evidence boundaries
seonghobae 76c059e
fix(sandbox): close patch metadata and mount injection gaps
seonghobae be89ea9
fix(sandbox): bind exact source and bounded result artifact
seonghobae b4db02d
test(sandbox): verify safe staging and bounded metadata parsing
seonghobae ef87aa3
test(sandbox): assert private staged patch and output mount
seonghobae 8a16a92
test(sandbox): reject non-exact source worktrees
seonghobae 7e61a23
docs(sandbox): document staged patch and bounded result evidence
seonghobae b8c17b9
docs(doctoring): bind staged patch and result trust boundaries
seonghobae 71e885e
ci: repair PR 65 reviewer coverage test-first
seonghobae b1b00fa
chore(ci): remove temporary self-modifying repair workflow
seonghobae 795b940
test(sandbox): reject dirty and unverifiable source snapshots
seonghobae 2f0608b
fix(sandbox): reject dirty exact-head source snapshots
seonghobae 5d3da44
docs(sandbox): require clean exact-head Git snapshots
seonghobae fe15128
docs(doctoring): require clean exact-head source evidence
seonghobae 5045cc4
test(sandbox): hide Git credentials from untrusted validation
seonghobae 13b33e2
fix(sandbox): mask Git control metadata from untrusted code
seonghobae 93fe83d
docs(sandbox): document Git metadata credential mask
seonghobae 6ff8029
docs(doctoring): record Git metadata credential mask
seonghobae b044062
ci: reject dirty PR 65 source worktrees
seonghobae f3d42e3
chore(ci): remove temporary dirty-source repair workflow
seonghobae e531bde
test(sandbox): expose source snapshot race
seonghobae 0a2dbf5
chore(pr65): stage exact-source snapshot repair
seonghobae d5f6d78
fix(pr65): make source snapshot repair script executable
seonghobae 2a064be
ci(pr65): run exact-source snapshot repair once
seonghobae 2c7a3f8
chore(ci): remove invalid PR repair workflow
seonghobae c1c3f12
chore(sandbox): remove temporary PR repair script
seonghobae 712125f
ci(pr65): verify exact-commit source snapshot repair
seonghobae 8584d1e
chore(ci): remove invalid self-modifying repair workflow
seonghobae e0b9a33
fix(sandbox): mount exact committed source snapshot
seonghobae 4643980
test(sandbox): cover exact source snapshot failures
seonghobae 86f9388
docs(sandbox): document exact committed source snapshot
seonghobae 816387e
docs(doctoring): record exact committed source boundary
seonghobae bd64670
test(sandbox): specify bounded archive extraction
seonghobae 841d475
test(sandbox): complete archive boundary regressions
seonghobae ea4786c
fix(sandbox): bound exact-source archive extraction
seonghobae 6521891
docs(sandbox): specify bounded archive extraction
seonghobae c884296
docs(doctoring): record archive extraction boundary
seonghobae 247072f
test(sandbox): cover archive collision failures
seonghobae 542867c
test(sandbox): isolate exact source from local Git attributes
seonghobae caa94a0
test(sandbox): reproduce raw-tree and bounded-output gaps
seonghobae 004b14f
fix(sandbox): isolate Git control metadata from exact snapshots
seonghobae ca012c6
test(sandbox): cover isolated Git control failure boundaries
seonghobae 59e5616
test(sandbox): exercise malformed archive after isolated control setup
seonghobae 82abd4f
fix(sandbox): bound patch evidence to one host result file
seonghobae 3cea7ad
test(sandbox): target the single bounded result-file mount
seonghobae 299dd78
test(sandbox): target bounded result file in metadata isolation
seonghobae 4938886
test(sandbox): verify one bounded result-file channel
seonghobae 6d9fd53
docs(sandbox): document isolated raw Git tree and result file
seonghobae ac385ee
docs(doctoring): record isolated Git attribute boundary
seonghobae cbbf712
docs(changelog): record isolated Git tree and result boundary
seonghobae cad5be4
docs(doctoring): keep repository citations APA-only
seonghobae cbf749e
test(sandbox): allow realistic artifacts under fsize cap
seonghobae b98a263
fix(sandbox): preserve realistic file writes under bounded validation
seonghobae 5f57f2c
docs(sandbox): separate workspace and evidence file-size ceilings
seonghobae 9a200bc
docs(doctoring): separate process and evidence size ceilings
seonghobae 03af3f6
test(sandbox): parse exact result mount boundary
seonghobae 01e8c5e
test(sandbox): expose post-hunk path-smuggling boundary
seonghobae 2c843cf
fix(sandbox): parse unified hunk boundaries before path checks
seonghobae 7b848d0
test(sandbox): cover unified hunk parser boundaries
seonghobae be2ba58
test(sandbox): bind secondary paths to primary diff identity
seonghobae f220803
fix(sandbox): bind auxiliary paths to counted diff identity
seonghobae 34362d0
test(sandbox): reject existing symlink and gitlink index modes
seonghobae 37d8191
test(sandbox): fail closed on provenance and hunk edges
seonghobae 51c6717
docs(changelog): record exact hunk path and mode boundaries
seonghobae cf8d0e5
ci(sandbox): stage exact validation-contract repair
seonghobae e92ceea
ci(sandbox): run exact validation-contract repair
seonghobae 8e3b020
test(sandbox): forbid untrusted result evidence writes
seonghobae f327efb
fix(sandbox): enforce exact provenance and bounded evidence
seonghobae 920086d
chore(security): remove self-modifying PR repair workflow
seonghobae 15e951d
chore(sandbox): remove transient repair mutator
seonghobae a99350e
test(sandbox): remove superseded host-evidence contract
seonghobae 2d48b43
test(sandbox): bound prearchive tree and result channel
seonghobae e68e88d
test(sandbox): model post-stat result growth
seonghobae 229c2b3
test(sandbox): isolate legacy unit boundaries explicitly
seonghobae 740daa5
test(sandbox): remove trust-boundary bypass fixtures
seonghobae 9de2da5
test(sandbox): modernize runner fixtures without bypasses
seonghobae e8294f4
test(sandbox): authenticate adversarial runner fixtures
seonghobae 9b5a6ef
test(sandbox): require canonical repository paths
seonghobae a3ce5c6
test(sandbox): authenticate direct result-file fixture
seonghobae aad5390
test(sandbox): model exact-tree preflight in archive fixtures
seonghobae 3ce8041
fix(sandbox): validate canonical metadata and exact tree before archive
seonghobae 477f0a7
test(sandbox): bind source-integrity doubles to prearchive tree checks
seonghobae 5bbe221
test(sandbox): close exact-tree and parser branch coverage
seonghobae 471efa3
test(sandbox): preserve hunk-before-header regression after no-diff gate
seonghobae 93b0766
test(sandbox): cover descriptor sentinel cleanup branch
seonghobae f676886
docs(sandbox): align patch validation contract with exact-tree preflight
seonghobae c604f92
docs(doctoring): record exact-tree and single-result evidence rationale
seonghobae 9febe3c
test(sandbox): require bounded streaming Git evidence
seonghobae c88bd75
fix(sandbox): stream hostile Git evidence within hard bounds
seonghobae 3f17418
test(sandbox): isolate archive fixtures from streaming tree process
seonghobae 2b626da
test(sandbox): model streamed status command failure
seonghobae b36c9c3
test(sandbox): model streamed exact-tree process failures
seonghobae 5027f64
test(sandbox): cover bounded Git streaming failure branches
seonghobae 2680812
test(sandbox): close final bounded-stream coverage edges
seonghobae 59c726d
docs(sandbox): document bounded Git stream collection
seonghobae 9e03b17
docs(doctoring): justify bounded Git evidence streaming
seonghobae 89b4e5c
test(sandbox): expose trailing mode token bypass
seonghobae 0a703e3
ci: verify and repair strict mode metadata parsing
seonghobae dc65698
chore(workflows): remove invalid self-modifying repair automation
seonghobae 609333f
fix(reviewer): parse patch mode metadata exactly
seonghobae 31371cc
docs(reviewer): document exact mode metadata parsing
seonghobae ad7a63c
docs(doctoring): record mode-metadata fail-closed decision
seonghobae 0c60dea
docs(changelog): record strict mode metadata parsing
seonghobae 44e3cb8
docs(changelog): preserve unrelated audit wording
seonghobae ae509a7
test(sandbox): require canonical ASCII exact-tree metadata
seonghobae 36ad5bb
fix(sandbox): require canonical ASCII exact-tree metadata
seonghobae e6f5b47
docs(sandbox): specify canonical exact-tree metadata
seonghobae 8f9c802
docs(doctoring): justify canonical ASCII tree grammar
seonghobae 1e836fa
docs(changelog): record canonical ASCII tree grammar
seonghobae 7c9090e
test(sandbox): preserve canonical git size padding
seonghobae df9829a
test(sandbox): define canonical git size padding grammar
seonghobae 67d57ae
fix(sandbox): parse canonical git long-size padding
seonghobae 1deb46b
docs(sandbox): document canonical git size padding
seonghobae e682978
docs(doctoring): reconcile git long-size padding grammar
seonghobae 5d63605
docs(changelog): reconcile git long-size padding finding
seonghobae dd5813a
test(sandbox): reject borrowed Git object databases
seonghobae 757c467
test(sandbox): bind exact tree to archive bytes
seonghobae 5da28df
test(sandbox): remove unused archive-binding import
seonghobae a586e18
fix(sandbox): bind exact Git tree to extracted bytes
seonghobae d59159c
test(sandbox): cover Git blob identity failure edges
seonghobae d29abd4
test(sandbox): cover absent descriptor cleanup branch
seonghobae 3e074a9
docs: bind patch validation source identity
seonghobae 19f038d
docs: doctor exact-tree identity boundary
seonghobae 552a6dd
docs: record authenticated source contract
seonghobae 5c2e676
docs: preserve unrelated changelog text
seonghobae File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
137 changes: 137 additions & 0 deletions
137
.github/workflows/one-shot-noema-mode-metadata-repair.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,137 @@ | ||
| name: One-shot Noema mode metadata repair | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - feat/quarantined-patch-validation | ||
| paths: | ||
| - .github/workflows/one-shot-noema-mode-metadata-repair.yml | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| concurrency: | ||
| group: one-shot-noema-mode-metadata-repair | ||
| cancel-in-progress: false | ||
|
|
||
| jobs: | ||
| repair: | ||
| if: >- | ||
| github.repository == 'ContextualWisdomLab/noema' && | ||
| github.actor == 'seonghobae' && | ||
| github.ref == 'refs/heads/feat/quarantined-patch-validation' | ||
| permissions: | ||
| contents: write | ||
| runs-on: ubuntu-24.04 | ||
| timeout-minutes: 25 | ||
| steps: | ||
| - name: Harden runner | ||
| uses: step-security/harden-runner@bf7454d06d71f1098171f2acdf0cd4708d7b5920 # v2.20.0 | ||
| with: | ||
| egress-policy: audit | ||
|
|
||
| - name: Checkout exact trigger without persisted credentials | ||
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | ||
| with: | ||
| ref: ${{ github.sha }} | ||
| fetch-depth: 1 | ||
| persist-credentials: false | ||
|
|
||
| - name: Apply the minimal strict mode-metadata fix | ||
| shell: bash --noprofile --norc -e -o pipefail {0} | ||
| run: | | ||
| python - <<'PY' | ||
| from pathlib import Path | ||
|
|
||
| path = Path("reviewer/noema_reviewer/patch_validation.py") | ||
| source = path.read_text(encoding="utf-8") | ||
|
|
||
| old_pattern = '''PATCH_MODE_PATTERN = re.compile( | ||
| r"^(?:old mode|new mode|new file mode|deleted file mode) (120000|160000)$", | ||
| re.MULTILINE, | ||
| ) | ||
| INDEX_MODE_PATTERN = re.compile( | ||
| ''' | ||
| new_pattern = '''PATCH_MODE_PATTERN = re.compile( | ||
| r"^(?:old mode|new mode|new file mode|deleted file mode) (120000|160000)$", | ||
| re.MULTILINE, | ||
| ) | ||
| FILE_MODE_METADATA_PATTERN = re.compile( | ||
| r"^(?:old mode|new mode|new file mode|deleted file mode) ([0-9]{6})$" | ||
| ) | ||
| INDEX_MODE_PATTERN = re.compile( | ||
| ''' | ||
|
|
||
| old_branch = ''' if line.startswith(("old mode ", "new mode ", "new file mode ", "deleted file mode ")): | ||
| if current_source_path is None or current_diff_has_hunk: | ||
| raise ValueError("patch contains misplaced mode metadata") | ||
| if not line.endswith((" 100644", " 100755")): | ||
| raise ValueError("patch contains an unsupported file mode") | ||
| continue | ||
| ''' | ||
| new_branch = ''' if line.startswith(("old mode ", "new mode ", "new file mode ", "deleted file mode ")): | ||
| if current_source_path is None or current_diff_has_hunk: | ||
| raise ValueError("patch contains misplaced mode metadata") | ||
| match = FILE_MODE_METADATA_PATTERN.fullmatch(line) | ||
| if match is None: | ||
| raise ValueError("patch contains malformed mode metadata") | ||
| mode = match.group(1) | ||
| if mode in {"120000", "160000"}: | ||
| raise ValueError("patch contains a symlink or gitlink mode") | ||
| if mode not in {"100644", "100755"}: | ||
| raise ValueError("patch contains an unsupported file mode") | ||
| continue | ||
| ''' | ||
|
|
||
| if source.count(old_pattern) != 1: | ||
| raise SystemExit("mode pattern anchor is not unique") | ||
| if source.count(old_branch) != 1: | ||
| raise SystemExit("mode branch anchor is not unique") | ||
| source = source.replace(old_pattern, new_pattern, 1) | ||
| source = source.replace(old_branch, new_branch, 1) | ||
| path.write_text(source, encoding="utf-8") | ||
| PY | ||
| git diff --check | ||
|
|
||
| - name: Set up Python | ||
| uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 | ||
| with: | ||
| python-version: "3.11" | ||
|
|
||
| - name: Install hash-pinned reviewer dependencies | ||
| shell: bash --noprofile --norc -e -o pipefail {0} | ||
| run: >- | ||
| python -m pip install --disable-pip-version-check --require-hashes --no-deps | ||
| -r reviewer/requirements-ci-hashes.txt | ||
|
|
||
| - name: Verify full reviewer suite, coverage, docstrings, and compilation | ||
| shell: bash --noprofile --norc -e -o pipefail {0} | ||
| run: | | ||
| cd reviewer | ||
| python -m pytest | ||
| python -m interrogate --fail-under 100 noema_reviewer | ||
| python -m compileall -q noema_reviewer tests | ||
| cd .. | ||
| git diff --check | ||
|
|
||
| - name: Publish only the verified production fix | ||
| env: | ||
| EXPECTED_HEAD: ${{ github.sha }} | ||
| SOURCE_BRANCH: feat/quarantined-patch-validation | ||
| PUSH_TOKEN: ${{ github.token }} | ||
| shell: bash --noprofile --norc -e -o pipefail {0} | ||
| run: | | ||
| test "$(git rev-parse HEAD)" = "$EXPECTED_HEAD" | ||
| remote_head="$(git ls-remote origin "refs/heads/${SOURCE_BRANCH}" | cut -f1)" | ||
| test "$remote_head" = "$EXPECTED_HEAD" | ||
| git config user.name "github-actions[bot]" | ||
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | ||
| git add reviewer/noema_reviewer/patch_validation.py | ||
| git diff --cached --check | ||
| git diff --cached --quiet && { echo 'No production fix generated.' >&2; exit 1; } | ||
| git commit -m "fix(sandbox): reject malformed file-mode metadata" | ||
| auth_header="$(printf 'x-access-token:%s' "$PUSH_TOKEN" | base64 | tr -d '\n')" | ||
| echo "::add-mask::$auth_header" | ||
| git -c http.extraheader="AUTHORIZATION: basic ${auth_header}" \ | ||
| push --force-with-lease="refs/heads/${SOURCE_BRANCH}:${EXPECTED_HEAD}" \ | ||
| origin "HEAD:refs/heads/${SOURCE_BRANCH}" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.