Resolve last advisory, derive version from package.json, give stele-core a test suite - #45
Merged
Merged
Conversation
…st stele-core **Dependabot.** #42 cleared the three stele-core advisories, including the Hono CORS ReDoS, which mattered here because that middleware is what guards /api/*. The last one was @babel/core, transitive via eslint-plugin-react-hooks — lint and build time only, never in bundle.html, hence LOW. Pinned with a pnpm override to ^7.29.7 rather than left open; the lockfile now resolves 7.29.7. **Version.** This was not an ambiguity, it was rot. v1.1.0 was tagged and released on 2026-06-06, package.json was bumped for it, and src/lib/version.ts was not — zero commits touched it between the two tags. Since STELE_VERSION is stamped into every narrative export as `steleVersion`, exports from the shipped 1.1.0 build claimed to be 1.0.0. package.json is authoritative because it is what the tag and release.yml publish against, so the constant is now injected from it by vite's `define` and cannot drift again. A test asserts the wiring holds, since a removed define would silently make it undefined rather than fail. **stele-core tests.** It had none — the reason it reached main with live type errors, and the reason the injectivity fix was only ever covered on the browser side. 39 cases over the chain encoding, the /api/* perimeter, the schema invariants, and the write-conflict classifier. No database needed: the chain is pure and the perimeter goes through Hono's request handler, so the suite runs in CI without a service container. node:test rather than vitest, deliberately. tsx is already a devDependency, so this adds zero packages to a security-sensitive service whose own review flagged install-time supply-chain risk. Mutation-tested rather than assumed: dropping the P2034 check fails 2, letting an empty API_SECRET fall open fails 1, reverting the chain to a delimiter join fails 1. The suite discriminates.
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.
Three things.
Dependabot — all clear
#42 cleared the three
stele-coreadvisories: Hono CORS ReDoS (which mattered specifically because that middleware guards/api/*), fast-uri host confusion, and find-my-way HTTP/2 DDoS. Verified against the newstele-coreCI job before merging.The last one was
@babel/core, transitive viaeslint-plugin-react-hooks— lint/build time only, never inbundle.html, hence LOW. Pinned with apnpm.overridesentry to^7.29.7rather than left open; the lockfile now resolves 7.29.7.Version — this was rot, not an ambiguity
The
1.1.0vs1.0.0split has been sitting in the journal as "needs a human decision on which is authoritative". It doesn't:v1.1.0was tagged and released 2026-06-06 (f1a5c2e chore: bump version to 1.1.0).git log v1.0.0..v1.1.0 -- src/lib/version.ts→ 0 commits. It was simply forgotten.package.jsonis authoritative because it's whatgit tag v*andrelease.ymlpublish against. The harm was concrete:STELE_VERSIONis stamped into every narrative export assteleVersion, so exports from the shipped 1.1.0 build claimed to be 1.0.0 — wrong provenance in the one artifact whose purpose is provenance.Fixed structurally rather than by editing a literal: vite
defineinjects it frompackage.json, so it can't drift again. A test guards the wiring, since a removeddefinewould make the constantundefinedrather than fail loudly.stele-core — 39 tests, no database
It had none. That's why it reached main with live type errors, and why the injectivity fix was covered on the browser side but not the server side.
Coverage: the chain encoding (injectivity witnesses, replay verification, session binding, client-supplied-hash rejection), the
/api/*perimeter (scheme handling, prefix/suffix tokens, fail-closed on unset and emptyAPI_SECRET, preflight passes untokened, non-/api/*untouched), the schema invariants (integrityHashstripped,secretsDetectedboolean-only), and the write-conflict classifier.No service container needed — the chain is pure and the perimeter runs through Hono's request handler.
node:test, not vitest, deliberately.tsxis already a devDependency, so this adds zero packages to a security-sensitive service whose own review flagged install-time supply-chain risk.Mutation-tested, not assumed: dropping the
P2034check fails 2 cases; letting an emptyAPI_SECRETfall open fails 1; reverting the chain to a delimiter join fails 1. Baseline 39/39.CI verified green on this branch (
tsc,stele-core).🤖 Generated with Claude Code