Commit Graph
2 Commits
Author SHA1 Message Date
Dragan SpiridonovandRuflo & AQE 58604dabce fix(security): keep the old command-injection reach; bound the comment stripper
Adversarial review of the first commit (a Claude devil's-advocate agent and three
Codex rounds) found inputs main reports that it dropped, a ReDoS, and quadratic paths.

- Command injection is main's rule again (child_process ... exec), tested after
  comment stripping, so execSync is reported and no execFile shape is exempt: env,
  node -e, python -c, bash.exe, options variables and exec passed as a value were all
  bypasses. The execFile callback regex that backtracked catastrophically is gone.
- Carried block comments continue only through comment-looking lines; regex literals
  are read as code (bounded to 200 chars); '://' is never a comment. Lines are built
  from parts with a 12-char tail, so the stripper is linear.
- SQL placeholders: only param/placeholder names, params/values/args.length, numbers
  and loop letters, in value position, outside single- or double-quoted SQL text, in
  one left-to-right pass that skips escapes. pageNum, userIdx, req.body.length and
  quoted placeholders are reported.
- Spec: 26 tests, including every reviewer input and linear-time checks; each of ten
  source mutations fails at least one test.

Co-Authored-By: Ruflo & AQE
Claude-Session: https://claude.ai/code/session_01CGoza3gyxBjpaiMPhGHcHs
2026-10-10 18:13:04 +02:00
Dragan SpiridonovandRuflo & AQE 3b4b91fcd5 fix(security): scan code patterns without the false positives seen on a real tree
`ruflo security scan --depth deep` on a 10-repo checkout reported 10 high findings,
all false: `child_process.execFile` named in comments, numbered pg placeholders
(`$${paramCount}`) as SQL injection, and a Playwright report bundle. Mediums
included "retrieval (" read as eval and istanbul/Playwright assets.

- eval needs a word start; window.eval still matches.
- Command injection is any exec/execSync/execFile use (call, ?.(), .call/.apply/
  .bind, ['exec'], passed as a value), except execFile of a literal non-shell
  program with a literal argv and no shell or options variable. execSync, which
  `exec[^S]` skipped, is now reported.
- A counter-shaped pg placeholder where SQL takes a value, outside SQL quotes, is
  not interpolation; quoted or value-shaped `$${...}` still is. The SQL test runs in
  linear time.
- Comment text is stripped before matching (strings respected); a block comment
  carries only from a line-start opener that closes later.
- istanbul prettify/sorter/block-navigation/lcov-report next to a coverage marker,
  and Playwright trace/data next to index.html, are skipped. Folder names are looked
  up in a Map.

Co-Authored-By: Ruflo & AQE
Claude-Session: https://claude.ai/code/session_01CGoza3gyxBjpaiMPhGHcHs
2026-10-10 17:30:34 +02:00