Skip to content

test(workspace): run only the programs the service issues - #7

Merged
georgiedekker merged 2 commits into
mainfrom
lane/exec-allowlist
Nov 14, 2026
Merged

georgiedekker merged 2 commits into
mainfrom
lane/exec-allowlist

Conversation

@georgiedekker

Copy link
Copy Markdown
Contributor

CodeQL flags tests/unit/workspace_server.py:65 as py/command-line-injection. It is a fair reading of the code even though the caller is our own test: the stand-in ran whatever argv was posted to it, with nothing constraining what program that was.

Fix. _exec now checks argv[0] against ALLOWED_PROGRAMS — find, cat, python, which are exactly the three the service under test issues (reads in scan_runner.py and dependency_inventory.py, plus the python -c inspect step). Anything else raises and the handler answers 403 with the reason.

The refusal is deliberate over a silent fallback: a regression that starts shelling out to a new program should fail the test here, not quietly run it.

This is a real constraint, not a suppression — the server can no longer execute an arbitrary program.

Verified locally:

  • ruff check: clean
  • full suite: 2910 passed, 5 skipped, 66 deselected, coverage 93.19% (gate is 85%)

🤖 Generated with Claude Code

georgiedekker and others added 2 commits November 14, 2026 07:57
The stand-in executed whatever argv the caller posted. CodeQL flags that
as py/command-line-injection, and it is a fair reading of the code even
though the caller is our own test: nothing constrained it.

It now runs find, cat and python and refuses anything else with a 403,
so a regression that starts shelling out to a new program fails here
instead of executing it. The refusal is loud on purpose — a silent
fallback would let the test pass without exercising what it meant to.

Verified: ruff clean; full suite 2910 passed, 5 skipped, coverage 93.19%.

Co-Authored-By: Claude Code <noreply@anthropic.com>
@georgiedekker
georgiedekker merged commit ab1cdc9 into main Nov 14, 2026
7 checks passed
@georgiedekker
georgiedekker deleted the lane/exec-allowlist branch November 14, 2026 20:50
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