Repository navigation
Conversation
|
Review skipped: 1693 files exceed the limit of 100 WalkthroughWarning Review details and warnings were omitted to fit the comment limit. |
🦋 Changeset detectedLatest commit: d6c5e27 The changes in this PR will be included in the next version bump. This PR includes changesets to release 27 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Mutation testing (cargo-mutants,
|
| caught | missed | unviable | timeout |
|---|---|---|---|
| 436 | 0 | 203 | 0 |
cargo-mutants exited with no surviving mutants recorded. The run may not have completed cleanly; check the workflow run logs.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a05affaaa5
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
freshtonic
left a comment
There was a problem hiding this comment.
I request changes for two release problems on the crates.io side. The code itself is in good shape, and every check I ran passes.
How I reviewed this
The diff is large because generated code is committed. I reviewed the generators and their templates, then I ran the drift checks to prove that the committed output matches them. I did not read each generated file.
- EQL codegen:
eql-codegenrenders the version-neutral SQL source two times (eql_v3andeql_v4) from theeql-domainscatalogue. It also generates the Rust payload types andeql_gen.go. - Go:
stashgengenerates the*_stash.gofiles and the goldens.
Checks run (in a worktree at a05affaaa)
- EQL:
cargo test -p eql-codegen(includes the Go parity test): pass.mise run types:check,codegen:parity,test:schemas:parity: pass.mise run build, with the installer completeness gate and the v4 isolation gate: pass.git statuswas clean after all of these.
- Rust and Go:
cargo fmt --check: pass.cargo clippy --workspace --all-features --all-targets -D warnings: pass.cargo test -p stack-guest-abi -p stack-encrypt --all-features: pass.
- Go guests and SDK:
- All five WASI guests build, and the import-surface checks pass.
go vet ./...andgo test ./...inlanguages/golang: pass.go generate ./...leaves no diff.
- I built the v3 bundle and compared it with the
@cipherstash/[email protected]tarball. Onlylints()and comments changed, so the claim "v3 SQL unchanged" holds. git merge-treeagainst currentmain: no conflicts.cargo publish --dry-run -p stack-encrypt-derive -p stack-encryptagainst crates.io: fails (see below).
Blocking
- stack-encrypt 0.3.0 cannot publish. The root release-plz line publishes every stack-* version that crates.io does not have, so merging this starts a publish of stack-encrypt 0.3.0. stack-encrypt requires
stack-kms0.1.0, and that is the only stack-kms version on crates.io. Butsrc/lib.rsre-exportsstack_kms::{diagnostic, ErrorPayload}, and these were added after the 0.1.0 release with no version bump. The packaged build fails withE0432: unresolved imports stack_kms::diagnostic, stack_kms::ErrorPayload.- Fix: bump stack-kms (for example to 0.2.0, with a CHANGELOG entry), and make stack-encrypt require that version.
- Note that the publish dry run on
main(tests-crates.yml) packages all five crates together, so stack-encrypt resolves the tree's stack-kms there. That step does not catch a stack-kms that crates.io lacks under the same version number.
- The stack-encrypt CHANGELOG has no 0.3.0 section.
Cargo.tomlsays 0.3.0, but about 850 lines, including a### Breakingsection, are still under## [Unreleased]. The root release-plz line only publishes and never rewrites the changelog, so 0.3.0 would ship under "Unreleased", as 0.1.0 did. Please rename the section to## [0.3.0] - <date>in this PR.
Non-blocking (see inline)
SchemaVersionis now generic. Rust does not apply a default const parameter in an expression, soSchemaVersion::CURRENTandSchemaVersion::default()stop compiling (E0284). The changeset ships this as a minor bump and says "plainSchemaVersionstill means v3".- The stored and single-bound query domain templates accept
"v": null. The range template already guards against this. - stack-encrypt will publish with an exact pin on
cllw-ore =0.5.2-rc.1. - There are some small nits: stale vitaminc version numbers in comments, a Go wipe path, an ADR reference, and the position of a
use.
Before you merge
eql-bindings now requires stack-encrypt 0.3.0. Its crates.io publish (publish_all_features) succeeds only after release-crates has published stack-encrypt 0.3.0, so blocker 1 must be fixed first. Otherwise the EQL crate publish fails too.
Checked and fine
- SQL renderer: it refuses literal
eql_v3/eql_v4names, unknown placeholders and unmatched blocks. - Range domains and
between: correct, with STRICT/IMMUTABLE accessors and an inlinablebetween. On non-superuser installs, the ORE range domains are disabled with the same NOT VALID CHECK as the single-bound ORE domains. - v4
ore_block_v2SQL: the layout offsets and the GF(2^128) doubling are correct, and errors do not echo the input bytes. - stack-guest-abi
stepandvalue: no new raw reads of host lengths, handles are never reused,MAX_OPENis enforced, and secrets areZeroizingwithOpaqueDebug. - Go step loop: every early exit after a pause aborts the operation and wipes the buffers.
maxPausedis tied to the Rust constant by a test. - Go public surface:
QueryTerm,VerifyandTargetLimitfollow the existingSeal/Openpattern, andMatchQuerynever prints its text. - CI: actions are pinned by SHA, both copies of the path filters were updated, and no release workflow changed.
- Changesets: the EQL changesets are minor, which is correct apart from the
SchemaVersionpoint.chacha20-0-10-2.mdmatches the lockfile moves. - Skills: no skill update is needed.
stash eql installstill installs v3 only, and no skill covers the Go SDK or Stack Encrypt.
Not blocking. The points in this review are still open, but they need not stop the merge.
… private `CipherTextBuilder`, `Nonce`, `NonceGenerator`, `RandomNonceGenerator` and `LocalCipherText::into_reader` were public so that a cipher in another crate could write and read the leaf layout. The only such cipher is now `aes::Aes256Cipher`, in this crate, so they are crate-private and built only with the `aes` feature. `LocalCipherText` and `WIRE_VERSION` stay public: stack-encrypt stores the leaf, and eql-bindings reads the version. `read_version_in`, which accepted older wire versions, is folded into `read_version`: nothing opens version 1 leaves any more. `append_target_plaintext_array` had no caller and is removed.
They were renamed to `Context` and `ContextPiece` in vitaminc 0.5 and kept for one transition. The published vitaminc-encrypt was the last thing that named `Aad`; nothing in the build depends on it now. stack-encrypt's re-export of both goes with them.
…f the plaintext aws-lc-rs's `seal_in_place_append_tag` appends the tag's space to the buffer before it encrypts (aws-lc-rs 1.18.0, `aead/unbound_key.rs:403`). A buffer with no spare room moves at that point, and the block it leaves holds the plaintext. The backend now makes the room first and wipes the old block before it is freed. Both heap-hygiene tests excluded that free by name, as a fault in a crate outside this repository. The backend is in vitaminc-aead now, so the exclusion goes. Before the fix, 14 of stack-encrypt's 49 heap-hygiene tests fail without the exclusion; with it, all 49 pass.
The nonce types are private now, so the README's nonce example no longer compiled. It names the cipher in the aes module where it named vitaminc-encrypt's.
The EQL encryption tests and the recipher-js test addon are separate Cargo workspaces, so the root cargo fmt did not reach them.
…ffer When a backend's seal returned an error, the buffer still held the plaintext, and the closure that called it dropped the buffer unwiped. Both backends now wipe and clear the buffer on any error. The test forces the error with a nonce of the wrong length, and runs on both backends.
Nothing here uses vitaminc-encrypt 0.10 now, so three crates.io vitaminc crates depend on vitaminc-aead, not four. The EQL heap test's module docs lose a stray empty line.
…to raw fields source.rs wrote Result<RawFields, NotARecord> out sixteen times. The type had the name SourceRecord before that name went to the record the plan checks.
…d the type is private The conversion from SourceRecordError to the dynamic Error moved to record/source.rs, and its test stayed in record.rs. That kept the struct and its fields visible to record, with two imports for tests alone. The test now sits in source.rs's tests, with a helper of its own for the one error variant it checks, so the struct and its fields are private.
NotARecord and SourceRecordError derive thiserror::Error, and nothing showed either message, so the text could change with no test failing. The test pins both. NotARecord names the kind of the value and never the value; SourceRecordError names no row, field or cause.
…crypted_records and encrypted_record The encrypt side says record (into_source_records, EncryptedRecord), and the stack-encrypt glossary lists row as a word to avoid for a field-by-field record. The decrypt side now matches. Both functions are private to the record module.
The backend tests ran under wasm-bindgen-test on wasm32. That runner is for wasm32-unknown-unknown in a JavaScript host. Nothing we ship targets wasm32-unknown-unknown: our wasm32 target is wasm32-wasip1, for the Go guests. Under WASI the standard test harness runs, so these tests are now plain #[test] functions on every target. This drops wasm-bindgen-test and the six crates under it from the crate's dev-dependencies. cargo vet had no audit for any of them.
…ackend The `aes` feature turned on aes-gcm on every target, so a native build compiled RustCrypto's AES-GCM next to aws-lc-rs and never used it. Its graph also brought generic-array's build script into the native build. aes-gcm is now declared per target, as vitaminc-encrypt 0.10 declared it. On native targets it is optional and only `_test-rust-crypto-backend` turns it on. On wasm32 it is a plain dependency. A feature turns on a dependency by name on every target that declares it. Cargo also refuses a second, renamed entry for the same crate. So `aes` cannot turn it on for wasm32 alone.
The workspace test run turns every feature on, `_test-rust-crypto-backend` included. So CI tested the AES cipher only with RustCrypto's aes-gcm, and never with aws-lc-rs, the backend native builds use. `test:vitaminc-aead:features` now also runs the crate's tests with `aes` alone (aws-lc-rs) and with `aes,_test-rust-crypto-backend` (RustCrypto).
wasm32-wasip1 is the target the Go guests build for, and on wasm32 the `aes` feature uses RustCrypto's aes-gcm. CI only checked that the crate compiles for that target. The new `vitaminc-aead-wasip1` job runs the crate's tests there, with wasmtime as the test runner. wasmtime 50.0.3 is pinned in mise.test.toml with the other test tools, as a prebuilt release. The task `test:vitaminc-aead:wasip1` skips the three trybuild tests: trybuild starts cargo as a child process, and a WASI program cannot start a process. The other test runs cover them on the host.
crates.io has yanked every pin-project-lite before 0.2.19, the root Cargo.lock's 0.2.17 included. cargo deny refuses a yanked version, and vitaminc-aead reaches pin-project-lite through futures-util. `next` is still on 0.2.17. `cargo update -p pin-project-lite` moves the root Cargo.lock to 0.2.19 and changes nothing else. The other Cargo workspaces still carry yanked versions, as `next` does; cargo deny does not read their lock files.
vitaminc-aead's `aes` feature uses aws-lc-rs on native targets. cargo deny refused it for two reasons. The licences of aws-lc-rs, aws-lc-sys and untrusted each need ISC. ISC is not on the allow list. It is a short permissive licence, like MIT. It is now allowed for those three crates only, so a new ISC crate is still reviewed. The build scripts of aws-lc-rs and aws-lc-sys were not allowed. The first checks the crate's features and passes on an include path. The second compiles and links the AWS-LC C library. deny.toml says what each one does beside its entry.
aws-lc-sys bundles the AWS-LC C library, its Rust bindings and the build script that compiles them: about 2.1 million lines. Nobody here can read that much code. cargo vet now trusts the account that publishes it, justsmth (Justin W Smith, crates.io user 156764), at safe-to-deploy. That accepts AWS's own review of its releases. The entry, its dates and the publisher record in imports.lock were written by `cargo vet trust`. The trust covers aws-lc-sys only. aws-lc-rs, the Rust layer vitaminc-aead calls, still needs an audit. The safe-to-run exemption for aws-lc-sys 0.44.0 is gone: the trust entry covers more than it did.
The AES cipher moved from vitaminc-encrypt 0.10 into vitaminc-aead. The root workspace no longer depends on vitaminc-encrypt 0.10.0. Cargo.lock holds only vitaminc-encrypt 0.5.1, for cts-common. The exemption covered nothing.
On wasm32, aes-gcm is now always a dependency of vitaminc-aead, not only with its `aes` feature. The credential guest builds vitaminc-aead without `aes`, so its Cargo.lock gains the edge from vitaminc-aead to aes-gcm. The lock already held aes-gcm 0.10.3, so no new crate comes in.
… feature CI runs the workspace tests with --all-features. That turned on `_test-rust-crypto-backend`, so the main test run used RustCrypto for every crate. It never tested aws-lc-rs, the backend that native builds use, except in vitaminc-aead's own tests. stack-encrypt's heap_hygiene test ran only against RustCrypto. A feature also cannot turn on a dependency for one target only. So aes-gcm was a plain dependency on wasm32. The Go auth guest compiled it through vitaminc-aead without using it, and cargo deny failed for recipher-frame and vitaminc-aead-derive on generic-array's build script. The `vitaminc_aead_rust_crypto` cfg replaces the feature. aes-gcm is now declared only for wasm32 and for builds with the cfg. `aes` turns it on with aws-lc-rs. A native build with --all-features now has aws-lc-rs and no aes-gcm. A wasm32 build has aes-gcm only with `aes`, so the auth guest's lock file loses the dependency again. `test:vitaminc-aead:features` adds the cfg to RUSTFLAGS and keeps the `-D warnings` that CI sets there. With it, the task runs vitaminc-aead's tests with `aes` and stack-encrypt's heap_hygiene test. So CI tests both backends on the host.
RustCrypto's aes-gcm depends on generic-array 0.14.7. The aes-gcm crate is the AES-256-GCM cipher on wasm32. cargo deny checks the graph for every target with every feature on. So with `aes` on, vitaminc-aead's graph has generic-array, and the check failed on its build script. The build script asks version_check for the rustc version. The version_check crate runs `rustc --version`. The script sets one cfg when the version is 1.41 or later. It does nothing else.
The cc crate runs the C compiler for build scripts. The aws-lc-sys build uses it, directly and through cmake, to compile the AWS-LC C library. The store had no audit or trust that covered cc 1.2.55 at safe-to-deploy. The crates.io user rust-lang-owner published cc up to 1.2.34. Later versions are published by the crates.io trusted publisher of the rust-lang/cc-rs repository. 1.2.55 is the version in the graph. So a trust of rust-lang-owner covers nothing here. This entry trusts github:rust-lang/cc-rs at safe-to-deploy instead. `cargo vet trust` wrote the entry and the publisher record for cc 1.2.55 in imports.lock. It also removed the safe-to-run exemption for cc 1.2.55. The trust entry covers that version at a higher level. The command also rewrote the rest of imports.lock for the whole workspace. Only the cc record is kept.
…dability refactor(stack-encrypt)!: clearer names and modules for the dynamic record path
…17 to 0.2.19 The aes feature brings aws-lc-rs into vitaminc-aead's graph, and the move off a yanked pin-project-lite brought 0.2.19. cargo vet needed both at safe-to-deploy. aws-lc-rs 1.18.0: the build script and every line with unsafe in src/ were read, 367 of 367. The notes record one defect, an out-of-bounds read from safe code in the streaming cipher API. It needs the legacy-des feature, which no crate here turns on. pin-project-lite 0.2.17 to 0.2.19: the whole diff was read. The changes make the macro reject more input, and add no unsafe operation. The safe-to-run exemption for aws-lc-rs 1.18.0 goes, because the audit covers it. imports.lock gains the imported audits that cover pkg-config 0.3.32. cargo vet writes those only when vetting passes.
aws-lc-rs 1.18.0 and aws-lc-sys before 0.45.0 are affected by GHSA-xv35-xp83-5wrf, an out-of-bounds write in StreamingDecryptingKey's padded decrypt. Nothing here calls that code, but vitaminc-aead's aes feature should not depend on a release with a known memory-safety bug. The same five lock files move as in #2053, which makes this change on main, with the same @cipherstash/auth changeset. Its native binaries link aws-lc-rs through stack-auth.
…e 1.18.0 notes The delta audit covers every changed line. No unsafe line, build-script change, dependency or feature was added. The changes at unsafe call sites close two bugs: the AEAD seal now checks that the buffer grew by the tag before AWS-LC writes to it, and the streaming cipher constructors check the IV before AWS-LC reads it. GHSA-xv35-xp83-5wrf itself is fixed in AWS-LC's EVP_DecryptUpdate, in aws-lc-sys 0.45.0, which the trusted publisher covers. The notes of the 1.18.0 audit now say what that reading missed: the advisory, and the AEAD seal's trust in the caller's buffer type. Neither is on vitaminc-aead's path, which passes a Vec.
feat(vitaminc-aead): the AES-256-GCM cipher moves into vitaminc-aead
Summary
This is the integration branch for a release candidate of EQL v4 and of Stack Encrypt's Rust and Go support. EQL is the SQL that lets PostgreSQL store and search encrypted values; EQL v4 is a second copy of it for values written by Stack Encrypt, the Rust encryption engine behind the Go SDK. The open pull requests for both are merged here first, so they can be tested together before any of them reaches
main.The release version is not decided yet.
Why a branch, not main
Some of this work depends on vitaminc and ore.rs code that is not yet on crates.io, so it pins those crates to a git commit.
stack-encryptandeql-bindingsare published crates, andcargo publishdrops those git pins, so nothing on this branch can be released until vitaminc 0.6 is published (cipherstash/vitaminc#389, which waits on cipherstash/vitaminc#463). Once it is, the git pins become crates.io versions and this branch merges tomainas a normal release.What lands here, in order
feat/aead-remove-legacy-traitsto one commit on vitamincmain, and takes vitaminc's breaking changes since then.Rules for this branch
rev, neverbranch. A branch is deleted when its stack merges.packages/eqlandpackages/stack-encrypt/fuzz. Two commits mean two copies of vitaminc's traits, and the code stops compiling.Changes
Verification
nextwas created frommainat 2a70a47. Nothing has been built yet, because nothing has changed.Related