Files
TRIMSP/tests
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
..
2026-06-25 09:42:41 +02:00
2026-06-25 09:42:41 +02:00
2026-06-25 09:42:41 +02:00
2026-06-25 09:42:41 +02:00
2026-08-27 15:07:36 +02:00

Regression test set

The tests/ tree contains the 13 target configurations used as the reference regression set for the TRIM.SP-NL modernization. Together they contain 143 energy-configuration points.

The committed .out files intentionally retain the banner TrimSPNL v1.3.2: they are the historical RANLUX reference outputs used to check behavior-preserving refactoring. They should therefore not be mechanically regenerated or replaced when preparing a new release.

For changes intended to preserve behavior, current RANLUX output should agree with these references apart from nondeterministic timing fields and quantities affected by explicitly documented corrections. PCG32 and xoshiro256** generate different Monte Carlo histories and are therefore compared statistically rather than by bitwise output identity.

The configurations are:

  • 6element_plus_multilayer
  • 7layer_stack
  • SiO2_Al2O3_TiN_Si_4layer
  • thin_Au_Cr_Si
  • Au_Cr_Si_3layer
  • AlCoCrFeNiTi_6elements
  • SiO2_Si_2layer
  • SiO2_1layer
  • Si_1layer
  • thin_C_foil
  • thin_C_Au_C
  • Li8-Si_1layer
  • Li8-thin_C_Au_C

When running an individual case manually, copy the relevant input deck to a scratch directory first so the committed reference files are not overwritten. The transport executable accepts an optional RNG backend as its second argument, for example:

trimspNL run_basename ranlux
trimspNL run_basename pcg32
trimspNL run_basename xoshiro

Omitting the second argument selects RANLUX.