Commit Graph
4 Commits
Author SHA1 Message Date
salman 2e01232afd Exclude the archive lock marker from the downloaded results archive 2026-09-26 16:38:35 +02:00
salman 5a8bd70957 Harden singleTrimSP.cgi: traversal fix, watchdog, pruner, archive lock, caps
- P0 path-traversal fix: run-name class is dot-free with \z anchors, so
  '.', '..', and %0A-trailing values can never escape TRIMSP_TMPROOT. The
  deployed path allowlist is derived from the configured root instead of the
  old hardcoded /tmp prefix.
- Replacing external  with an alarm() watchdog that kills the
  engine's whole process group (setpgrp + kill KILL -pid), matching
  muSRFlow; describe_result maps -2/-1/signal to 124/127/128+sig.
- prune_stale_jobs() ages out dirs (TrimSP.cfg marker only), orphaned .tgz,
  and leaked per-request logs; safe in shared /tmp (symlinks skipped,
  remove_tree safe mode, never touches non-trimsp dirs).
- Archive is serialized per run with flock (.trimsp-lock); per-point engine
  runs stay concurrent.
- Symlink/non-dir run dirs refused; mode 0700 so results are not
  world-readable. read/download also reject symlinked targets.
- Request caps: MAX_REQUEST_LINES 20000, MAX_REQUEST_BYTES 4 MiB -> 413.
- action=health deployment self-check; env overrides TRIMSP_BIN, TMPROOT,
  CMD_TIMEOUT, JOB_MAXAGE (sed anchor for the binary path kept intact).
- Wire contract preserved: ok/phase/message/exitCode/archiveUrl/log JSON,
  text read, gzip download, real HTTP statuses. No TrimSPweb.js change.
- New tests/cgi-tests.sh drives the real CGI offline (18 cases: traversal,
  %0A, escaping round-trip, success/fail/hang engine, 124 watchdog, archive+-
  download, pruner, symlink refusal, 413). deploy-web.sh now verifies the
  sed substitution embedded the selected engine path.
2026-09-26 16:32:38 +02:00
salman 8061f389fe Improve web results and diagnostics 2026-08-27 21:42:31 +02:00
salman 1f6ecc7982 Modernize scan workflow and web deployment 2026-08-27 19:24:27 +02:00