Add the §2 eval gate, on green, and prove it can fail - #8
Merged
Merged
Conversation
DS §2 says built output MUST be free of runtime code generation and that `scripts/no-eval.sh` MUST run in CI against it. This repo shipped neither the script nor the step, so the rule had no instrument here. Estate context: 11 Node repos ship a `build` script and 7 already run this scan. This is the last of the 4 that did not (tgwab-standards#173). MEASURED, NOT INHERITED. The two repos already gated under #173 are LAN Astro sites and nothing about their result carries here — inheriting a scan result across repos is the failure that issue was filed against. Built from origin/main (c7f4561) and scanned: npm ci (prepare runs the build) -> lint (0) -> test (0) dist: 1 file, markdownwizard-tools.iife.js, 46,037 bytes ./scripts/no-eval.sh dist eval-free: OK exit 0 AND PROVED ABLE TO FAIL. Planting one file in dist: ::error::runtime code-generation found in dist (CSP has no 'unsafe-eval') dist/__ctl__/x.js:1:const f = new Function("a","return a"); eval("1"); exit 1 Removing it returns the run to green. So the gate goes on green because nothing eval-shaped reaches the bundle, not because the scan is lenient. SCOPE, STATED SO A GREEN RUN IS NOT READ AS MORE THAN IT IS — and this one is specific to a published package rather than a site. The `files` list ships BOTH `src` and `dist`, and the default export is `"." : "./src/index.js"`, so a consumer writing `import … from 'markdownwizard-tools'` gets the SOURCE. Only the `./iife` subpath resolves to what this scan covers. Nothing is hiding there: src/ scans clean today, all 8 files, exit 0. But whether §2's target should widen for a package whose default export is source is a STANDARDS question, not one this repo should answer by quietly editing its own step. Raised in tgwab-standards#173. Widening to `dist src` is a one-word change and is green today if that is the ruling. No placement subtlety: `prepare` is the build, so `npm ci` produces dist and the scan has the bundle to read wherever it sits after that. It is placed after `test` to keep the §15 gates contiguous. Refs MichalAFerber/tgwab-standards#173 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016beCydw4C9VrgL9eHzGUG2
MichalAFerber
marked this pull request as ready for review
September 7, 2026 09:37
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
DS §2 says built output MUST be free of runtime code generation, and that
scripts/no-eval.shMUST run in CI against it. This repo shipped neither the script nor the step.Estate context: 11 Node repos ship a
buildscript and 7 already run this scan. This is the last of the 4 that did not. Tracked in MichalAFerber/tgwab-standards#173.Measured, not inherited
The two repos already gated under #173 are LAN Astro sites. Nothing about their result carries here — inheriting a scan result across repos is precisely the failure that issue was filed against. Built from
origin/main(c7f4561):npm ci(prepareruns the build) →lint→testmarkdownwizard-tools.iife.js, 46,037 bytes./scripts/no-eval.sh disteval-free: OK (dist)— exit 0Proved able to fail
Removing the planted file returns the run to green. The gate goes on green because nothing eval-shaped reaches the bundle, not because the scan is lenient.
Scope — and this one is specific to a published package
Worth reading before treating a green check here as full coverage:
fileslist ships bothsrcanddist."." : "./src/index.js".So a consumer writing
import … from 'markdownwizard-tools'gets the source; only the./iifesubpath resolves to what this scan covers.no-eval.sh distdoes not cover the path most consumers use.Nothing is hiding there —
src/scans clean today, all 8 files, exit 0. But whether §2's target should widen for a package whose default export is source is a standards question, and this repo should not answer it by quietly editing its own step. Raised in MichalAFerber/tgwab-standards#173. If the ruling is to widen,dist srcis a one-word change and is green today.Placement
No subtlety:
prepareis the build, sonpm ciproducesdistand the scan has the bundle to read from that point on. It sits aftertestto keep the §15 gates contiguous.Refs MichalAFerber/tgwab-standards#173
🤖 Generated with Claude Code
https://claude.ai/code/session_016beCydw4C9VrgL9eHzGUG2