fix: protect security contract files from autofix deletion - #1328
fix: protect security contract files from autofix deletion#1328seonghobae wants to merge 14 commits into
Conversation
|
Warning Review limit reachedNext included review available in 25 minutes. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Addressed Devin's current-head finding: protected security-contract deletion/rename validation now runs in its own unconditional step after conflict resolution, so |
|
Resolved Devin's informational thread on rename detection. The guard intentionally inspects the unstaged worktree: a rename appears as deletion of the protected old path before staging, so the D branch rejects it; R* remains defensive for staged/alternate diff contexts. No source change was needed. |
|
The current-head hourly contract exposed a pre-existing Strix model drift: workflow fallbacks emitted gpt-5.4 while the authoritative tests require gpt-5.6-luna. Restored the consistent default, no-NIM fallback, and fallback chain at exact head 1c0ae26. Targeted contract tests (3) pass, including the protected conflict-mode guard. |
|
Exact current HEAD b2ecfc1 fixes the actionable exact-head-path-policy failure. Root cause: the preceding Strix workflow contract commit changed the private/default and fallback model from gpt-5.4 to gpt-5.6-luna, while scripts/ci/test_strix_quick_gate.sh still asserted the old gpt-5.4 strings. Updated five assertions to the live gpt-5.6-luna contract. Local evidence at this HEAD: uv run pytest tests/test_strix_nvidia_nim_not_found_fallback.py tests/test_required_workflow_queue_contract.py::test_nvidia_nim_defaults_preserve_existing_fallbacks_without_secret tests/test_opencode_agent_contract.py::test_autofix_worker_resolves_merge_conflicts_fail_closed -q (17 passed); bash -n scripts/ci/test_strix_quick_gate.sh; git diff --check. Full shell regression is running with a bounded timeout; no secrets or provider calls are used. |
|
Exact current HEAD 306de72a6c9bb74d00701471d61d53a0ebbcbe1d contains the complete stale-contract repair. The Strix quick-gate self-test had three additional OpenCode candidate-pool assertions still requiring openai/gpt-5.4; all three now assert the live openai/gpt-5.6-luna fallback. The earlier four Strix fallback assertions were already corrected in b2ecfc1. Local static evidence: bash -n scripts/ci/test_strix_quick_gate.sh and git diff --check pass. The full shell regression is running with a bounded timeout; hosted required checks are re-queued for this exact HEAD. |
|
Exact current HEAD 936b93bf52f1d875a635ce9c95d7155bd30a865f closes the remaining current-head review contract gaps.
Local evidence at this HEAD: Strix required workflow smoke passed; targeted OpenCode autofix contract pytest passed; bash -n and git diff --check passed. The informational model-pattern and staged-diff review threads are addressed; protected review/checks remain authoritative. |
|
Exact-head hosted verification completed for 936b93b: |
|
Exact current HEAD 923feea0f8b9c06a6b594222c96e21c741c2b88b fixes Devin's actionable YAML issue. The protected-file guard now uses space indentation for |
|
Exact-head hosted revalidation for 923feea is SUCCESS: |
|
Fresh protected-main comparison identifies a causal regression outside this PR's security-contract scope. Protected The causal repair belongs on this branch: restore only the Strix workflow/default/fallback values and their Strix-specific assertions to protected-main RED is the protected-main smoke contract rejecting this head's |
|
Exact-head failure evidence for |
|
Current-head evidence update for
|
| while IFS=$'\t' read -r status _; do | ||
| case "$status" in | ||
| D|R*) | ||
| echo "::error::Autofix cannot delete or rename protected security-contract path: $protected_path" | ||
| exit 1 | ||
| ;; | ||
| esac | ||
| done < <(git diff HEAD --name-status -- "$protected_path") |
There was a problem hiding this comment.
📝 Info: exit inside while loop works via process substitution
exit 1 inside the loop terminates the step because the loop is fed by process substitution, not a pipe. A pipe would run the loop in a subshell and let the step pass. The chosen form is correct.
Was this helpful? React with 👍 or 👎 to provide feedback.
| protected_security_paths=( | ||
| "backend/core/local_http.py" | ||
| "backend/core/url_validation.py" | ||
| "backend/tests/test_local_http.py" | ||
| "backend/tests/test_url_validation.py" | ||
| "docs/doctoring/local-http-origin-port-validation.md" | ||
| ) |
There was a problem hiding this comment.
📝 Info: Protected paths live only in sibling repos
The hardcoded protected paths do not exist in this repo; the workflow runs in each sibling repo's context. Where the files are absent, git diff yields nothing and the loop is a harmless no-op, so no false positives.
Was this helpful? React with 👍 or 👎 to provide feedback.
Root cause
The central PR autofix validates that changed files are in the review allowlist, but it did not protect security-contract files from deletion or rename. A repeated Bolt optimization therefore removed URL/loopback validation, its 45 regression cases, and the RFC doctoring record when unrelated review automation ran.
Change
Verification
uv run pytest tests/test_opencode_agent_contract.py::test_autofix_worker_resolves_merge_conflicts_fail_closed -qpasses.git diff --checkpasses.No merge bypass or secret changes.