Skip to content

fix(evals): escape backslashes in --live prompt quoting - #68

Merged
devin-ai-integration[bot] merged 3 commits into
mainfrom
devin/1795451120-eval-shell-escape
Nov 23, 2026
Merged

devin-ai-integration[bot] merged 3 commits into
mainfrom
devin/1795451120-eval-shell-escape

Conversation

@shmindmaster

@shmindmaster shmindmaster commented Nov 23, 2026 •

Copy link
Copy Markdown
Owner

What changes

Fixes CodeQL alert js/incomplete-sanitization #1 in scripts/run-evals.mjs.

run-evals.mjs --live prints a claude -p "<prompt>" command per eval case. The prompt was quoted with .replace(/"/g, '\\"'), which left backslashes alone: a prompt containing \" or ending in \ broke out of the double-quoted argument, and $/backticks would expand if the line were pasted into a shell.

  • New exported shellDoubleQuote(value) escapes \, ", $ and ` for a POSIX double-quoted argument; runLive uses it.
  • main() now runs only when the script is executed directly, so the helper can be imported by tests. Every existing caller spawns the script, so behavior is unchanged.
  • tests/run-evals-live.test.mjs round-trips values through sh -c 'printf %s "..."', including the unsanitized case a\"; echo injected; " and a trailing backslash.

Current --live output is byte-identical for today's prompts (none contain those characters).

Evidence

  • docker compose run --build --rm verify, gate and drill pass (verify: ALL GREEN, 16 steps; gate: RELEASE ALLOWED; drill: 2/2 deliberate regressions blocked). With the new test against the old run-evals.mjs, verify's test step fails.
  • Positive and refusal paths are covered where relevant
  • A changed or new guard has a mutation that proves it can fail — n/a, eval-harness display helper, not an inspection guard
  • Generated data was changed through its generator — n/a, no data changes
  • No secrets, customer data, proprietary prompts, or real operational records are included

Boundary impact

none


Product Engineer opened this PR for Sarosh
Implemented in session Fix heatlot incomplete sanitization CodeQL alert
Review with Devin · Open in Devin Desktop


Code scanning on this PR

CodeQL analysis of refs/pull/68/merge (head 5984d34): 0 results (main currently has 1, alert #1 js/incomplete-sanitization at scripts/run-evals.mjs:267). No open alerts on the PR ref.

Test output (in the dev image)

$ node --test tests/run-evals-live.test.mjs
# pass 2
# fail 0
$ docker compose run --rm verify
ALL GREEN — 16 steps, every one at its expected exit code.
$ docker compose run --rm gate
RELEASE ALLOWED — every check at or above its floor.

Review follow-ups: the entry-point check resolves symlinks (91d9f54), and evals/README.md says the --live commands are POSIX shell syntax (5984d34).

…complete-sanitization)

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration

Copy link
Copy Markdown
Contributor

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

@devin-ai-integration devin-ai-integration Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin autoapproved this pull request: Small eval-command quoting fix preserves existing prompts and adds shell round-trip tests.
Warning: CI status and off-thread reviewer findings are unavailable, so green-CI and reviewer-flag instructions were not applied.

shmindmaster and others added 2 commits November 23, 2026 16:39
…evals

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 2 findings. Devin automatically fixed all 2 findings.

Fixed by Devin (2)
  • Silent skip through symlinked entry points — Entry-point check now compares realpathSync of argv[1] and the module path; verified node /tmp/symlink.mjs --live runs.
  • Unstated shell requirement for live prompts — Pre-existing (old " escaping was POSIX-only too); evals/README.md now states the printed commands use POSIX shell quoting for bash/zsh, not PowerShell.

View findings in Devin Review · Follow Devin's work

Devin Review

@devin-ai-integration
devin-ai-integration Bot merged commit a5fbd7b into main Nov 23, 2026
3 of 4 checks passed
@shmindmaster
shmindmaster deleted the devin/1795451120-eval-shell-escape branch November 24, 2026 23:46
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