Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Invisible Diff

Invisible Diff reviews only added Git source lines for Unicode text that can make code look different from what tools execute. It reports directional controls, invisible identifier characters, normalization collisions, and a deliberately narrow set of mixed Latin/Greek/Cyrillic lookalikes.

It is read-only, uses no network or credentials, and renders every suspicious character as an escaped code point. It never prints a raw directional control to the terminal.

Try It

The zero-argument demo includes one directional control, one invisible identifier character, one mixed-script lookalike, one normalization collision, and ordinary Hindi and Arabic prose that must remain unflagged:

rote play run https://play.modiqo.ai/karan68/invisible-diff@0.1.0

Expected headline: BLOCK, with one block and four review findings.

For local development, replace the public URI with ./main.ts.

Scan Real Changes

Pass an absolute repository path because Play steps execute from their own run workspace.

Staged changes:

rote play run ./main.ts mode=staged repo_path=/absolute/path/to/repo

Tracked and untracked working-tree changes:

rote play run ./main.ts mode=working-tree repo_path=/absolute/path/to/repo

A local commit range:

rote play run ./main.ts \
  mode=range \
  repo_path=/absolute/path/to/repo \
  base_ref=main \
  head_ref=HEAD

Refs are resolved to exact local commits before content is read. No fetch occurs. Staged and range modes read raw Git blobs; working-tree mode reads raw files and commit blobs. Git's Myers algorithm compares the two run-owned raw snapshots outside the inspected repository. Repository clean filters, text-conversion drivers, external diffs, fsmonitor hooks, and Git hooks do not participate.

The collection stage compresses one bounded changed-line snapshot, records its SHA-256 digest, and passes that immutable payload to all three parallel analyzers. They never reread the repository. Git-visible HEAD, refs, index bytes, status, and selected changed-source bytes must match before and after collection and again after adjudication; otherwise the result is INCOMPLETE.

Verdicts

  • BLOCK: at least one high-confidence directional control was added.
  • REVIEW: an invisible identifier character, mixed-script lookalike, or normalization collision needs a human decision.
  • CLEAN: no listed hazard was found and every selected added source line was scanned.
  • INCOMPLETE: some selected source content could not be read, represented, or scanned within the declared budget, or Git-visible source state changed.

CLEAN is intentionally narrow. It is not a general security verdict, does not inspect deleted or unchanged lines, and does not claim complete Unicode confusable coverage. Mixed-script detection requires Latin plus a bundled high-confidence Greek or Cyrillic lookalike inside an identifier-like code segment. Same-line quoted strings and language-appropriate line comments are excluded from identifier analysis; multiline lexical state is not reconstructed. Directional controls remain blocking anywhere on an added source line because comments and strings are part of the Trojan Source attack surface.

Common programming, shell, markup, and configuration suffixes are scanned. Documentation, generated binaries, ignored files, and non-source assets are outside the selected surface. Working-tree mode includes untracked non-ignored source files; staged and range modes follow Git's own patch surface.

Verified Gates

  • 23 focused engine and temporary-Git integration tests.
  • Rote validation passes with quality score 0.88.
  • Fixture-backed presentation lint passes.
  • The eight-stage demo returns BLOCK: one block, four reviews, complete coverage, and unchanged source.
  • A real WSL-to-Windows working-tree run scanned more than 2,000 added lines across 41 source files with complete coverage and unchanged source.
  • Hostile repository clean filters do not execute during fingerprinting or collection.
  • Analyzer inputs are one bounded, compressed, SHA-256-verified snapshot; analyzers never reread the repository.

Develop

python3 -m unittest discover -s resources/tests -v
rote play validate ./main.ts
rote play lint ./main.ts

About

Review added Git source lines for invisible Unicode hazards without executing repository code

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages