Skip to content

Audit hardening for 0.2.0 - #5

Merged
nkwib merged 2 commits into
mainfrom
fix/audit-0.2.0-hardening
Jun 10, 2026
Merged

Audit hardening for 0.2.0#5
nkwib merged 2 commits into
mainfrom
fix/audit-0.2.0-hardening

Conversation

@nkwib

@nkwib nkwib commented Jun 10, 2026

Copy link
Copy Markdown
Owner

Hardening pass from the 0.2.0 audit. No public API changes.

Fixes

  1. Stale version const (critical). src/version.ts still exported TOOLROUTE_VERSION = '0.1.0' while the package shipped as 0.2.0, so every runtime routerVersion diagnostic mislabelled the version. Bumped to '0.2.0' and added test/version.test.ts, which reads package.json via fs and asserts the const matches it so a future release cannot let it drift. The existing router.test.ts assertion is now pinned to the const too.
  2. node: prefix stripping (high). Added removeNodeProtocol: false to tsup.config.ts. The previous build rewrote node:module to bare module, which breaks Cloudflare Workers nodejs_compat. Verified the rebuilt dist/index.js and dist/index.cjs both keep node:module.
  3. Smoke in CI. Added a pnpm smoke step after build in .github/workflows/ci.yml (the dist-tarball consumer test).
  4. Docs site staleness.
    • Version badge is now generated from the root package.json via sync-content.mjs (src/lib/generated/version.js) and imported in Header.svelte and the landing hero, mirroring the sibling tapedeck site; corrected the 37 -> 40 test count.
    • Added the 0.2.0 changelog entry (ported from CHANGELOG.md).
    • Added the 6.0.193 / 0.2.0 weekly-cron row to the compatibility table.
    • Removed the stray toolroute@0.1.0 fragment glued to prose on the no-playground-in-v1 decision page.
    • Generated and committed static/og.png (the build:og output) referenced by og:image, which previously had only og.svg.
    • Refreshed routerVersion example output strings from toolroute@0.1.0 to 0.2.0 across the api, docs, decisions, hero, and before-after pages. Historical 0.1.0 changelog/compatibility rows were left intact.
  5. README known limitations. Documented two behaviours: a router instance holds one state.prev so concurrent runs sharing router.tools cross-contaminate the guard (use one router per run, or reset() between sequential runs); and entry tools are those with a non-empty nextAllowed, so a terminal tool can never be the first call (by design).
  6. Nit. package.json#repository.url -> git+https://github.com/nkwib/toolroute.git.
  7. CHANGELOG. Added an Unreleased section summarising the above.

Verification

All run on this branch:

  • pnpm typecheck — pass.
  • pnpm test — 41 tests pass (added the version test).
  • pnpm build — pass.
  • pnpm smoke — PASS; consumer reports routerVersion=toolroute@0.2.0+ai-sdk@6.0.200 and the guard fires.
  • grep -E "from ['\"]module['\"]" dist/index.js dist/index.cjs — no matches; both files import node:module.
  • docs-site: pnpm install --frozen-lockfile + pnpm build:og + pnpm build — pass; built index.html shows v0.2.0 and references og.png.

nkwib added 2 commits June 10, 2026 23:03
- Bump TOOLROUTE_VERSION to 0.2.0 to match package.json; the runtime
  routerVersion diagnostic was mislabelling every violation as 0.1.0.
- Add a unit test asserting TOOLROUTE_VERSION equals package.json#version
  (read via fs) so a release can no longer let the const drift, and pin
  the existing router.test.ts assertion to the const.
- Set removeNodeProtocol: false in tsup so dist keeps node: import
  prefixes; the previous build rewrote node:module to bare module and
  broke Cloudflare Workers nodejs_compat.
- Run pnpm smoke in CI after build (dist-tarball consumer test).
- Use the canonical git+https repository URL in package.json.
- Document two known limitations in the README: one router instance per
  concurrent run (shared state.prev cross-contaminates the guard) and
  entry tools requiring a non-empty nextAllowed.
- Add a CHANGELOG Unreleased section and correct the stale 37->40 test
  count in COMPATIBILITY.md.
- Generate the version badge from the root package.json via
  sync-content.mjs (writes src/lib/generated/version.js) and import it in
  Header.svelte and the landing hero, mirroring the sibling tapedeck site.
  Fix the stale 37->40 test count.
- Add the 0.2.0 entry to the changelog page (ported from CHANGELOG.md).
- Add the 6.0.193 / 0.2.0 weekly-cron row to the compatibility table.
- Remove the stray "toolroute@0.1.0" fragment glued to prose on the
  no-playground-in-v1 decision page.
- Commit the generated static/og.png (build:og output) referenced by the
  og:image meta tag, which previously only had og.svg.
- Refresh routerVersion example output strings from toolroute@0.1.0 to
  0.2.0 across the api, docs, decisions, hero, and before-after pages
  (historical 0.1.0 changelog/compatibility rows left intact).
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying toolroute with  Cloudflare Pages  Cloudflare Pages

Latest commit: b2abf35
Status: ✅  Deploy successful!
Preview URL: https://3f70904f.toolroute.pages.dev
Branch Preview URL: https://fix-audit-0-2-0-hardening.toolroute.pages.dev

View logs

@nkwib
nkwib merged commit d782d08 into main Jun 10, 2026
3 checks passed
nkwib added a commit that referenced this pull request Jun 10, 2026
Patch release with the audit-hardening fixes (PR #5): runtime
routerVersion now reports the correct package version, dist preserves
node: import prefixes for Cloudflare Workers, smoke wired into CI, and
two known limitations documented in the README.
nkwib added a commit that referenced this pull request Jun 22, 2026
nkwib added a commit that referenced this pull request Jun 22, 2026
Patch release with the audit-hardening fixes (PR #5): runtime
routerVersion now reports the correct package version, dist preserves
node: import prefixes for Cloudflare Workers, smoke wired into CI, and
two known limitations documented in the README.
@nkwib
nkwib deleted the fix/audit-0.2.0-hardening branch June 22, 2026 16:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant