Skip to content

Harden local review preflight against hidden Unicode control channels - #115

Open
d1vyanshu-kumar wants to merge 2 commits into
prooflinedev:mainfrom
d1vyanshu-kumar:hidden-unicode-preflight
Open

d1vyanshu-kumar wants to merge 2 commits into
prooflinedev:mainfrom
d1vyanshu-kumar:hidden-unicode-preflight

Conversation

@d1vyanshu-kumar

@d1vyanshu-kumar d1vyanshu-kumar commented Nov 29, 2026 •

Copy link
Copy Markdown

Threat model

Local review is a security boundary: source and paths are rendered to a human reviewer, a terminal, and downstream tooling before they are uploaded. Hidden Unicode can make the rendered representation materially differ from the byte sequence being reviewed. This includes bidirectional controls, Unicode Tags, selected zero-width characters, and variation-selector payload channels.

Change

  • Refuse added patch content and newly introduced paths containing stealth Unicode before any review upload.
  • Render Unicode Tags, selected zero-width characters, and variation-selector runs as visible <U+XXXX> markers in terminal annotations. Existing bidi-control sanitization remains intact.
  • Reject stealth Unicode in SARIF result paths.
  • Permit a single variation selector, which is legitimate in normal emoji and text presentation.
  • Permit deletion-only remediation, so an existing hidden character can be removed without the preflight blocking the fix.
  • Canonicalize the executable recorded by agent install; this fixes macOS /var versus /private/var path inconsistency found by the end-to-end integration suite.

Who benefits

  • Engineers submitting local changes get a precise failure before a deceptive or accidentally copied hidden character reaches a review system.
  • Human reviewers and security reviewers see an explicit code-point marker in terminal annotations instead of reviewing text whose rendered form can conceal meaningful bytes.
  • Teams using coding agents and AI-generated patches gain a local safeguard against invisible prompt-injection or obfuscation payloads entering normal review workflows.
  • Platform and CI maintainers receive unambiguous SARIF paths and a deterministic pre-upload control that does not depend on every downstream consumer implementing Unicode-aware rendering.

Scope and trade-offs

The preflight examines only added patch lines and new paths. It intentionally does not rewrite raw JSON, MCP payloads, or SARIF message text: those are machine-readable channels where mutation could change payload semantics. An allow-path escape hatch does not waive stealth-Unicode findings.

Verification

Passed locally with the repository-pinned Rust 1.100.0 toolchain:

  • cargo fmt --check
  • cargo clippy --locked --all-targets -- -D warnings
  • cargo test --locked
  • cargo test --locked --all-targets

Focused coverage verifies detection before HTTP, diagnostics that do not echo raw hidden characters, removal-only remediation, hidden filenames, and hook warning/blocking modes.

cargo deny check remains for GitHub Actions. This PR changes neither dependencies nor Cargo.lock.

@d1vyanshu-kumar

Copy link
Copy Markdown
Author

Hey @mohsen1, this PR is ready for review when you have a moment.

Here is a sc walkthrough showing a hidden-Unicode tag injection slipping past git diff and being blocked locally by proofline review before any upload, along with the full fmt / clippy / cargo test --locked checks passing.

Screenshot 2026-11-29 at 3 15 33 PM

This branch has not been deployed

No deployments
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