Skip to main content

Jscad Stl Validator

@magistr/jscad-stl-validatorv2026.08.01.1· 1d agoMODELS
01README

STL file validator — checks triangle count, degenerate faces, bounding box

02Release Notes

2026.08.01.1

Fixes the HIGH-severity path-traversal / arbitrary-file-read finding (LB1) in validateFile, tracked in the LOCAL jscad-stl-validator-latent-bugs issue-lifecycle model (NEVER a swamp.club Lab issue). validateFile is an operator-supplied-absolute-path method by design; this fix is defense in depth for any future less-trusted exposure.

Behavior change: validateFile now rejects any filePath that is not absolute, and any filePath containing a literal . or .. path segment — previously such a path (e.g. a traversal-shaped path) was read verbatim with no confinement at all. The traversal/absolute-path check runs BEFORE any filesystem access, so a traversal attempt against a nonexistent target is still refused as a policy violation, never silently masked by a "file not found" error. Legitimate callers passing a clean absolute path (as shown in this README's examples) are unaffected.

  • Added extensions/models/jscad/safe_path.ts — a new infrastructure guard, resolveStlPath, implementing the always-on checks above plus canonicalization via Deno.realPath. The pure domain service jscad/stl_validator.ts stays BYTE-FROZEN; path safety is an infrastructure concern, kept out of the domain service.
  • Added an OPT-IN allowedRoots global argument (default [], read via context.globalArgs — never the per-call arguments) that confines validateFile to one or more operator-set root directories, using canonicalized (Deno.realPath'd) separator-boundary prefix matching so a sibling directory sharing a name prefix (/rootFOO vs. /root) or a symlinked root cannot be mistaken for containment. Empty allowedRoots (the default) preserves the historical unconfined contract.
  • extensions/models/jscad_stl_validator.ts: validateFile now resolves args.filePath through resolveStlPath before calling Deno.readFile. Error messages still key to the ORIGINAL args.filePath (not the canonicalized path), so the existing missing-file/directory-path Cannot read "<path>" throw-tests stay green; policy violations get a distinct Refusing to read "<path>": ... message. Model version bumped to 2026.08.01.1.
  • manifest.yaml version bumped to 2026.08.01.1 in sync; added extensions/models/jscad/safe_path_test.ts to additionalFiles. deno.json's check task extended to typecheck jscad/safe_path.ts + jscad/safe_path_test.ts.
  • Test suite: added extensions/models/jscad/safe_path_test.ts (11 unit tests covering reject-relative, reject-./..-segment including the nonexistent-traversal-target ordering guarantee, accept-clean-absolute, allowedRoots accept/reject, separator-boundary /rootFOO-vs-/root, symlink-escape rejection, and root/target canonicalization). Flipped the LB1 "../ traversal path read verbatim" pin in jscad_stl_validator_adversarial_test.ts to assert rejection; relabeled the "no base dir, two unrelated roots both succeed" pin from a HIGH bug-pin to a regression:-prefixed default-contract test (still asserts both calls succeed — that is the intended behavior when allowedRoots is not configured). Added allowedRoots accept/deny cases plus a test proving a smuggled per-call args.allowedRoots has no effect to jscad_stl_validator_methods_test.ts. All prior binary/ASCII happy paths and the missing-file/directory-path throw-path tests are unchanged and still green.
  • README.md: documented the validateFile operator-trust boundary and the opt-in allowedRoots confinement, including the residual "report reflects file bytes" oracle risk to keep in mind when narrowing allowedRoots.
  • LB2/LB3/LB4/LB5 remain pinned as characterized (not fixed) latent bugs — out of scope for this fix, tracked in the same issue-lifecycle model. The sibling jscad-stl-slicer extension shares the same unconfined-path pattern; deliberately NOT fixed here — tracked as its own follow-up.
03Models1
@magistr/jscad-stl-validatorv2026.08.01.1extensions/models/jscad_stl_validator.ts

Global Arguments

ArgumentTypeDescription
allowedRootsarrayOptional operator-set confinement roots for validateFile. When
fn validate(cadModelName: string, version?: number)
Validate the STL output stored by a @magistr/jscad-cad model instance
ArgumentTypeDescription
cadModelNamestringName of the @magistr/jscad-cad model whose stored output STL to validate
version?numberData version to validate (defaults to latest)
fn validateFile(filePath: string)
Validate an STL file at an absolute path on disk
ArgumentTypeDescription
filePathstringAbsolute path to the STL file to validate

Resources

report(infinite)— STL validation report
04Previous Versions4
2026.07.16.2

Release 2026.07.16.2 — align model versions with manifests

Maintenance release across the @magistr extensions. For most packages this carries no functional change: the only edit is the model's version: field, brought back in line with its manifest version so the published model type version and the package version no longer drift.

Functional changes in this release are limited to:

  • anime-cron: normalizeTitle now strips a ": subtitle" suffix and a trailing parenthesized year before comparison, fixing dedup false-misses where the torrent title carries a subtitle or year that the AniList romaji does not.

  • arckit: first publish. Standalone ArcKit port — a 12-phase architecture governance state machine with 65 bundled templates, driven by a bundled skill.

Also tracks three extensions (kaiten, observability-agent, music-library) that previously existed only as untracked working-tree directories, recovered from stashes.

Added 1, removed 1 models

2026.05.25.1

Merge pull request #5 from umag/extensions/jscad-stl-pair

extensions: add 15 more @magistr extensions + auto-discover CI

2026.04.04.2
2026.04.04.1
05Stats
A
100 / 100
Downloads
4
Archive size
15.7 KB
  • Has README or module doc2/2earned
  • README has a code example1/1earned
  • README is substantive1/1earned
  • Most symbols documented1/1earned
  • No slow types (deprecated)1/1earned
  • Dependencies pass trust audit2/2earned
  • Has description1/1earned
  • Platform support declared (or universal)2/2earned
  • License declared1/1earned
  • Verified public repository2/2earned
06Platforms
07Labels