Skip to content

Commit 869a0b3

Browse files
committed
fix(nextgen-evangelist): least-privilege deno perms + drop generated sample.js
Address #533 review findings: - Hypatia js_deno_all_perms (CWE-250): the orchestrator spawned sub-tools with `deno run -A` (all perms). Replaced with --allow-read --allow-run --allow-write (the union the tools need); usage docs updated to --allow-read --allow-run. - Semgrep detect-non-literal-regexp on deno-esm-spike/sample.js: that file is GENERATED --deno-esm output whose prelude uses new RegExp(<non-literal>). Generated code is not hand-edited; dropped sample.js + gitignored it, documented regeneration, and recorded the prelude-RegExp as a codegen finding. Orchestrator re-verified green end-to-end with the new flags. https://claude.ai/code/session_01WoKhFQePiRsAj7aqnxbG8s
1 parent af747e6 commit 869a0b3

6 files changed

Lines changed: 21 additions & 473 deletions

File tree

proposals/nextgen-evangelist/README.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ guide-linked readiness report
8888

8989
== Verified end-to-end (the orchestrator output)
9090

91-
`deno run -A evangelist/evangelist.mjs /tmp/evangelist-demo manifest.json`
91+
`deno run --allow-read --allow-run evangelist/evangelist.mjs /tmp/evangelist-demo manifest.json`
9292
(demo target = the three idaptik kernels + `SecurityRank.affine` +
9393
`Kernel_IO.affine`) produced:
9494

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Generated AffineScript -> Deno-ESM output (regenerate via README Step 1).
2+
# Not committed: compiler output; its prelude tripped a Semgrep non-literal-RegExp
3+
# (ReDoS) finding -- a codegen concern, not source.
4+
sample.js

proposals/nextgen-evangelist/deno-esm-spike/README.adoc

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ This spike is the minimal end-to-end demonstration of that path.
3434
[cols="1,3"]
3535
|===
3636
| `sample.affine` | Minimal AffineScript: two `pub fn`s (`add`, `clamp_band`), pure integer arithmetic, no `extern`/host calls — so the only thing under test is the *export shape*.
37-
| `sample.js` | Generated by the compiler with `--deno-esm`. A drop-in ES module (committed here as the captured trial artefact).
37+
| `sample.js` | Generated by `--deno-esm` (Step 1). *Not committed* (gitignored): it is compiler output, and its prelude tripped a Semgrep non-literal-RegExp finding. Regenerate it before running the driver.
3838
| `driver.mjs` | Plain-JavaScript (`.mjs`, NOT TypeScript) Deno consumer: `import { add, clamp_band } from "./sample.js"` then asserts five results.
3939
|===
4040

@@ -116,6 +116,8 @@ Observations, honestly:
116116

117117
[source]
118118
----
119+
$ # sample.js is gitignored compiler output -- regenerate it first (Step 1):
120+
$ /home/user/affinescript/_build/default/bin/main.exe compile --deno-esm -o sample.js sample.affine
119121
$ deno run ./driver.mjs
120122
deno-esm-spike driver: importing AffineScript-compiled ESM
121123
typeof add = function
@@ -159,3 +161,8 @@ the estate "no new TypeScript" policy end to end.
159161
and `extern fn` -> host-call lowering are documented by `--help` but NOT
160162
exercised by this spike — a follow-up spike should confirm those export
161163
shapes too before the harness migration relies on them.
164+
. The generated runtime prelude calls `new RegExp(<non-literal>)`, which
165+
Semgrep flags as a potential ReDoS (`detect-non-literal-regexp`). Because
166+
this is *generated* code, the fix belongs in the AffineScript codegen
167+
(hardcode the prelude's regexes, or omit the unused shim) — which is also
168+
why `sample.js` is gitignored here rather than committed.

0 commit comments

Comments
 (0)