The shell snapshot is hashed, then reopened to source it

Open
#256 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
52/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
bash, typescript
Domain
cli, security

Research direction

Read the fork change in PR #255, especially commits 8c443d04d3 and b1c5e383c2, and trace pin_snapshot through run_setup. Reproduce the timeout-triggered rebuild and inspect how the snapshot is hashed and sourced. Done means the session executes the exact bytes that were hashed, so a file swap cannot leave snapshotChanged false.

Written by the indexing model from the issue text.

Description

The fork's pin_snapshot hashes the shell snapshot, then source reopens the file by path. A writer that lands between the two during a core rebuild gets its bytes sourced under a hash that says nothing changed, so snapshotChanged stays false and the gate keeps reviewing.

rebuild (after a timeout) ─▶ hash snapshot ─▶ (writer swaps file) ─▶ source <path> ─▶ baseline taken
                                             ▲ window: the start of run_setup

Exploiting it needs a write to $TMPDIR/omp-shell-snapshots-<uid>/ racing a core rebuild, which the agent can force with a timeout. The window is the gap between two syscalls, not a review round trip.

Fix: read the snapshot bytes once and source exactly those bytes (feed them to the session as a script rather than source '<path>'), so the pin and the sourced text cannot diverge.

Found by the Opus security review of the fork change for https://github.com/STRML/omp-classifier/pull/255 (fork commits 8c443d04d3 and b1c5e383c2).

Dominant language
TypeScript
Stars
1
Forks
1
Avg merge
49m
Merged PRs (30d)
82

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from STRML/omp-classifier

All issues in STRML/omp-classifier

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.