Skip to content

recipher-value-napi lost its mutation, CRAP and dependency checks in the move from vitaminc, and Biome skips it — restore them and add fuzzing #1797

Todo

Description

@coderdan

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.js and the four tests/*.cjs suites) fails Biome's formatter and four lint rules as written, so chore(recipher-js): the JavaScript value bridge lives beside the addon #1794 excluded value-napi/ in biome.json to keep the copy unchanged. wrappers.js is 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-js turns a stored value into JSON and back (crate/src/json.rs). Both are parsers of untrusted input, which is what docs/fuzzing.md says should be fuzzed. vitaminc fuzzed only its Go bindings, so no target exists to copy.
  • No unused-dependency check. udeps.yml covers the auth, profile and stack-auth-wasm binding crates, and not these two.
  • The conformance corpus can drift. value-napi/tests/testdata/value-conformance.json is 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-js could 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:

  1. Bring the JavaScript under Biome. Reformat the copied files, fix or justify the four lint findings, and remove the value-napi line from biome.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.
  2. Add the two crates to the mutation gate. Add them to .cargo/mutants.toml and mutants.yml, with Node on the runner so the test addon is rebuilt from the mutated source, as vitaminc did.
  3. 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.
  4. 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.
  5. Add the workspace to udeps.yml.
  6. 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.md does for the other detached workspaces.
  7. 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.
  8. 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.json has no exclusion for value-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

Activity

  1. added
    enhancement
    Rust
    github-actions
    on Nov 24, 2026
  2. self-assigned this
    on Nov 24, 2026
  3. coderdan commented on Nov 25, 2026

    @coderdan
    ContributorAuthor

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

RustSDKenhancementgithub-actions

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions