Skip to content

fix(desktop-proof): preserve trusted script bytes on Windows - #725

Merged
SUaDtL merged 1 commit into
mainfrom
codex/desktop-boundary-eol-determinism
Aug 31, 2026
Merged

SUaDtL merged 1 commit into
mainfrom
codex/desktop-boundary-eol-determinism

Conversation

@SUaDtL

@SUaDtL SUaDtL commented Aug 31, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Keep the trusted desktop broker, UI driver, and route probe byte-identical to their tracked Git blobs after a fresh Windows checkout with core.autocrlf=true.
  • Add a regression that builds a temporary Git repository, performs a real fresh checkout, compares literal checkout blobs with tracked blobs, and runs the trusted desktop-boundary validator.
  • Preserve the existing manifest and trusted script bytes. This changes checkout policy and test coverage only.

Why

The protected runner checked out the three trusted PowerShell scripts with CRLF line endings. Their tracked blobs and installed copies were still correct, but the working-tree byte hashes no longer matched the manifest, so validation stopped before protected proof dispatch.

This is a prerequisite for #711.

Verification

  • Required RED: the new test reported literal-byte mismatches for all three trusted scripts in a fresh core.autocrlf=true checkout.
  • Focused GREEN: the unchanged regression passed after the exact-path LF rules were added.
  • Desktop boundary suite: 35 tests passed.
  • Codex resource suite: 156 tests passed, 1 skipped.
  • CI impact suite: 61 tests passed.
  • Hook suite: 1,401 tests passed.
  • All other test commands declared in .codearbiter/tech-stack.md passed.
  • check_codex_skill_resources.py --desktop-boundary-contract-only --json returned PASS with the original broker, driver, probe, and contract hashes.
  • Security, coverage, and architecture review returned zero findings. ADR-0011 and ADR-0031 remain confirmed.

Coverage note

This repository has no coverage tooling for .github/scripts/*.py, as documented in .codearbiter/tech-stack.md. The Stage 2 numeric coverage floor therefore uses the documented no-tooling exemption. The regression exercises the real Git checkout and validator behavior without mocks.

Release impact

No shipped plugin payload changed, so no package has an affected version to advance. The commit includes the required repository CHANGELOG: record.

Tradeoff and boundaries

Conflict hierarchy Level 2 applies: byte correctness at the trusted boundary takes priority over the convenience of a broad *.ps1 rule. The LF contract names exactly three files so unrelated PowerShell checkout behavior remains unchanged.

This PR does not authorize merge, tag, release, publication, or deployment.

Ref: ADR-0031

Fresh Windows checkouts with core.autocrlf=true rewrote the trusted broker, driver, and probe after checkout, so literal-byte validation failed before protected proof dispatch. Bind only those three trust-boundary paths to LF and prove the real validator in a fresh checkout.

CHANGELOG: Fresh Windows checkouts now preserve the trusted desktop boundary's tracked bytes so protected proof validation can proceed.

Ref: ADR-0031
@coderabbitai

coderabbitai Bot commented Aug 31, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: 1d56291d-b594-49d0-ac6d-17e1afd01ba7

📥 Commits

Reviewing files that changed from the base of the PR and between c7d3911 and 9fa6178.

📒 Files selected for processing (2)
  • .gitattributes
  • .github/scripts/test_codex_desktop_boundary.py

Included review availability: Your plan provides up to 2 included reviews per hour; 1 remains after this review.

📜 Recent review details
⏰ Context from checks skipped due to timeout. (3)
  • GitHub Check: [CHECK] | [CORE] | Hook contract <os: windows-latest>
  • GitHub Check: [CHECK] | [CORE] | Hook contract <os: macos-latest>
  • GitHub Check: [CHECK] | [CDX ] | Skill resource evidence contract
🧰 Additional context used
🪛 ast-grep (0.45.2)
.github/scripts/test_codex_desktop_boundary.py

[error] 393-398: Command coming from incoming request
Context: subprocess.run(
["git", "ls-files", "-z"],
cwd=REPO_ROOT,
capture_output=True,
check=True,
)
Note: [CWE-78] Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection').

(subprocess-from-request)


[error] 415-415: Command coming from incoming request
Context: subprocess.run(command, cwd=source, check=True, capture_output=True)
Note: [CWE-78] Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection').

(subprocess-from-request)


[error] 417-424: Command coming from incoming request
Context: subprocess.run(
[
"git", "-c", "core.autocrlf=true", "clone", "--quiet",
"--no-local", str(source), str(checkout),
],
check=True,
capture_output=True,
)
Note: [CWE-78] Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection').

(subprocess-from-request)


[error] 428-434: Command coming from incoming request
Context: subprocess.run(
["git", "rev-parse", f"HEAD:{relative}"],
cwd=checkout,
text=True,
capture_output=True,
check=True,
)
Note: [CWE-78] Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection').

(subprocess-from-request)


[error] 435-441: Command coming from incoming request
Context: subprocess.run(
["git", "hash-object", "--no-filters", relative],
cwd=checkout,
text=True,
capture_output=True,
check=True,
)
Note: [CWE-78] Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection').

(subprocess-from-request)


[error] 446-458: Command coming from incoming request
Context: subprocess.run(
[
sys.executable,
str(checkout / ".github" / "scripts" / "check_codex_skill_resources.py"),
"--desktop-boundary-contract-only",
"--json",
],
cwd=checkout,
text=True,
capture_output=True,
timeout=60,
check=False,
)
Note: [CWE-78] Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection').

(subprocess-from-request)


[error] 415-415: Use of unsanitized data to create processes
Context: subprocess.run(command, cwd=source, check=True, capture_output=True)
Note: [CWE-78] Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection').

(os-system-unsanitized-data)

🪛 Ruff (0.16.2)
.github/scripts/test_codex_desktop_boundary.py

[error] 395-395: Starting a process with a partial executable path

(S607)


[error] 416-416: subprocess call: check for execution of untrusted input

(S603)


[error] 418-418: subprocess call: check for execution of untrusted input

(S603)


[error] 419-422: Starting a process with a partial executable path

(S607)


[error] 429-429: subprocess call: check for execution of untrusted input

(S603)


[error] 430-430: Starting a process with a partial executable path

(S607)


[error] 436-436: subprocess call: check for execution of untrusted input

(S603)


[error] 437-437: Starting a process with a partial executable path

(S607)


[error] 447-447: subprocess call: check for execution of untrusted input

(S603)

🔇 Additional comments (2)
.gitattributes (1)

38-42: LGTM!

.github/scripts/test_codex_desktop_boundary.py (1)

30-34: LGTM!

Also applies to: 387-460


📝 Walkthrough

Summary by CodeRabbit

  • Chores

    • Standardized line endings for trusted desktop automation scripts to improve consistency across development environments and checkouts.
  • Tests

    • Added validation to ensure trusted scripts retain their exact contents when repositories are checked out with automatic line-ending conversion enabled.
    • Confirmed desktop boundary checks continue to pass after cross-platform checkout operations.

Walkthrough

The change enforces LF endings for three trusted PowerShell scripts and adds a test that verifies their bytes remain unchanged after an autocrlf=true clone.

Changes

Trusted desktop boundary

Layer / File(s) Summary
Line-ending contract and checkout validation
.gitattributes, .github/scripts/test_codex_desktop_boundary.py
.gitattributes forces LF endings for three trusted scripts. The test compares their tracked blob hashes with hashes from an autocrlf=true clone and runs the desktop boundary checker.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 9fa61

The change preserves trusted script bytes during Windows checkouts and adds regression coverage without altering shipped behavior; no actionable merge-blocking risk remains.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 1 files. (1 skipped: 1 … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: preserving trusted PowerShell script bytes during Windows checkout.
Description check ✅ Passed The description directly explains the checkout policy change, regression test, motivation, verification, and scope.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 1 files. (1 skipped: 1 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/desktop-boundary-eol-determinism

Warning

Central YAML configuration was ignored because it failed validation, so its settings were not applied. Fix the errors below and re-run the review:
Validation error: Too big: expected string to have <=250 characters at "tone_instructions"


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@SUaDtL
SUaDtL merged commit 309a6dd into main Aug 31, 2026
43 checks passed
@SUaDtL
SUaDtL deleted the codex/desktop-boundary-eol-determinism branch August 31, 2026 03:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant