eval spawn gate ignores a spawn's own cwd argument

Open
#14 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
52/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Domain
security

Research direction

Start at gateEval and compare its cwd handling with resolveToCwd. Trace the listed Python, JavaScript, and Ruby spawn forms, then verify that literal cwd values are resolved from ctx.cwd and used in both the dialog record and cache key, while non-literals remain opaque.

Written by the indexing model from the issue text.

Description

bug ready-for-agent

gateEval builds its permission dialog and its cache key from ctx.cwd, ignoring a cwd the spawn passes for itself.

exec("rm -rf .", { cwd: "/" })

extracts as rm -rf . and is shown to the human, and sent to the classifier, as running in the session's working directory. The plugin's own header states that the native-resolved cwd is part of the identity of a judgement, so the same spawn re-run against a different directory can also reuse a verdict earned somewhere else.

Both halves need the spawn's own cwd:

  • subprocess.run(cmd, cwd="/") and subprocess.Popen(..., cwd=...)
  • exec(cmd, { cwd: "/" }), spawn(file, args, { cwd })
  • Ruby Dir.chdir blocks and system(..., chdir: "/")

Read it where it is a literal, resolve it against ctx.cwd the way resolveToCwd does for bash, and put it in both the dialog record and the cache key. Where it is not a literal, the spawn should read as opaque: a command judged against the wrong directory is a command judged on the wrong question.

Found during review of #12.

Dominant language
TypeScript
Stars
0
Forks
1
Avg merge
1h 20m
Merged PRs (30d)
32

Contributor guide

No contributing guide indexed for this repository

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.