Repository navigation
Description
Background
@cipherstash/recipher is the TypeScript SDK on the Stack Encrypt engine (the Rust code that encrypts and decrypts values). Its Rust half is a small Cargo workspace at languages/typescript/packages/recipher-js with two crates:
recipher-js(crate/), the Node addon.recipher-value-napi(value-napi/), the value bridge: the code that reads a JavaScript value into the engine's value model and builds a JavaScript value back out of it. Every plaintext the SDK handles passes through it.
The value bridge was copied from cipherstash/vitaminc, where it was the crate vitaminc-aead-napi (#1794). The copy brought the source and its tests. It did not bring the quality checks that vitaminc's CI ran on it, because those live in vitaminc's workflows and config files.
Problem
The two crates are checked by one workflow, tests-recipher-js.yml, which runs cargo test, cargo fmt --check and clippy, then the Node suites. Everything below is missing.
Checks vitaminc ran on the value bridge that do not run here (verified against vitaminc at commit b3f69b12):
| Check | What it did in vitaminc | Here |
|---|---|---|
Mutation testing (cargo-mutants, --in-diff) |
Changed each line a PR touched and failed the PR when no test noticed. It rebuilt the test addon from the changed source, so the JavaScript-facing code was covered too | Not run. .cargo/mutants.toml and mutants.yml cover stack-auth and stack-encrypt only |
| CRAP gate (cargo-crap) | Failed a PR that added a complex function with little test coverage. It carried a list of the functions that need a live JavaScript engine and so always read as 0% covered | Not run. crap-crates.yml has no job for these crates, and the allow list was not copied |
| cargo-deny on the test addon's manifest | Checked the test addon's dependencies for advisories and licences | Not run. This repository has no cargo-deny workflow at all |
| cargo-vet on the test addon's manifest | Checked that each dependency version had been audited | Not run, and the supply-chain/ directory was removed in the copy. This repository does not use cargo-vet |
| Dependabot on the test addon's lockfile | Opened PRs for dependency updates | No entry. The same is true of the recipher-js workspace lockfile |
Checks that never existed for this code and probably should:
- Biome skips the copied directory. The copied JavaScript (
src/wrappers.jsand the fourtests/*.cjssuites) fails Biome's formatter and four lint rules as written, so chore(recipher-js): the JavaScript value bridge lives beside the addon #1794 excludedvalue-napi/inbiome.jsonto keep the copy unchanged.wrappers.jsis code the SDK ships and runs inside the user's process, and nothing lints it. - No fuzzing. The bridge parses text a caller supplies: a date, a timestamp, a decimal and a UUID (
value-napi/src/scalar.rs).recipher-jsturns a stored value into JSON and back (crate/src/json.rs). Both are parsers of untrusted input, which is whatdocs/fuzzing.mdsays should be fuzzed. vitaminc fuzzed only its Go bindings, so no target exists to copy. - No unused-dependency check.
udeps.ymlcovers theauth,profileandstack-auth-wasmbinding crates, and not these two. - The conformance corpus can drift.
value-napi/tests/testdata/value-conformance.jsonis a copy of vitaminc's shared vectors. Nothing fails when vitaminc's change. - The corpus is checked through the bridge's own test addon only. The SDK's real addon is never run against it, so a mapping change in
recipher-jscould disagree with the vectors and pass.
None of this fails today, and that is the risk: the value bridge is where a plaintext crosses between JavaScript and Rust, and it is now the least checked Rust in the SDK.
Proposal
In rough order of value for the effort:
- Bring the JavaScript under Biome. Reformat the copied files, fix or justify the four lint findings, and remove the
value-napiline frombiome.json. Two of the findings (noProto) are in tests that set__proto__on purpose, so they need a suppression with a reason, not a fix. - Add the two crates to the mutation gate. Add them to
.cargo/mutants.tomlandmutants.yml, with Node on the runner so the test addon is rebuilt from the mutated source, as vitaminc did. - Add a CRAP job for the workspace, and copy vitaminc's allow list for the functions that need a live JavaScript engine. vitaminc names each function instead of excluding whole files, so the pure functions beside them stay scored. Keep that.
- Add fuzz targets for the scalar text parsers and for the frame-to-JSON conversion, following
docs/fuzzing.md: a replay of the seed corpus on every PR and a longer run nightly. - Add the workspace to
udeps.yml. - Decide what to do about the lockfiles. Either add Dependabot entries for the workspace and the test addon, or write down that they are updated by hand, as
AGENTS.mddoes for the other detached workspaces. - Decide on cargo-deny and cargo-vet for the repository. vitaminc ran both. This repository runs neither, for any crate. That is a wider decision than this SDK, so this issue only records that the copy lost them.
- Run the conformance corpus against the SDK's own addon, and delete the copied file once aead-frame: ship the conformance corpus in the crate and fill its gaps; remove the Go bindings once Stack has its own vitaminc#473 ships the corpus inside a crate.
Items 1 to 3 restore what the code had before it moved. Items 4 to 8 are new.
Done when
biome.jsonhas no exclusion forvalue-napi/.- A PR that changes a line in either crate with no test that notices fails CI.
- The parsers of caller-supplied text have fuzz targets that CI replays.
Relationship to other work
- chore(recipher-js): the JavaScript value bridge lives beside the addon #1794 moved the value bridge here and added the Biome exclusion.
- docs(plans): the TypeScript SDK on Stack Encrypt, a core with EQL as an extension #1747 is the TypeScript SDK plan.
- aead-frame: ship the conformance corpus in the crate and fill its gaps; remove the Go bindings once Stack has its own vitaminc#473 proposes shipping the conformance corpus in a crate.
Activity
docs(plans): what steps 1 to 3 found, and the Rust quality gates
coderdan commentedon Nov 25, 2026
When these are added is now #1824: after the SDK's API settles, and before it is available to users. Cheap items such as Biome can go in any time.
docs(plans): what steps 1 to 3 found, and the Rust quality gates