Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ This policy covers the `@cachekit-io/cachekit` and `@cachekit-io/cachekit-core-t

This SDK does not implement LZ4. `ByteStorage.unpack` in both bindings —
`cachekit-core-ts` (NAPI, native) and `cachekit-core-wasm` (Workers) — is a thin
wrapper over cachekit-core's `ByteStorage::retrieve` → `StorageEnvelope::extract`,
wrapper over cachekit-core's `ByteStorage::retrieve_data` → `StorageEnvelope::extract`,
which bounds the decompressed output at `min(512 MiB, 1000 × compressed_len)`
_before_ decompressing. The envelope's self-declared `original_size` is not
trusted, and the xxHash3-64 checksum is unkeyed so it does not gate a forging
Expand Down
4 changes: 2 additions & 2 deletions packages/cachekit-core-ts/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/cachekit-core-ts/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ crate-type = ["cdylib"]
# binding runs every call on the JS thread and needs none of napi4's features.
napi = { version = "3", default-features = false, features = ["napi3", "dyn-symbols"] }
napi-derive = "3"
cachekit-core = { version = "0.7.0", features = ["encryption"] }
cachekit-core = { version = "0.7.5", features = ["encryption"] }
Comment thread
27Bslash6 marked this conversation as resolved.
Resolved
# Cache-key BLAKE2b-256 (blake2b256Hex). The 0.10 line builds on the digest 0.10
# that cachekit-core's sha2 and hmac already bring in, so it adds this one crate;
# 0.11 would add a second digest stack. It is also the line cachekit-core's own
Expand Down
4 changes: 2 additions & 2 deletions packages/cachekit-core-ts/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,9 @@ impl ByteStorage {
env: &'env Env,
packed: Uint8Array,
) -> Result<Uint8ArraySlice<'env>> {
let (data, _format) = self
let data = self
.inner
.retrieve(&packed)
.retrieve_data(&packed)
.map_err(|e| Error::new(Status::GenericFailure, e.to_string()))?;
copy_to_js(env, &data)
}
Expand Down
4 changes: 2 additions & 2 deletions packages/cachekit-core-wasm/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/cachekit-core-wasm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ wasm-bindgen = "=0.2.121"
# accept Uint8Array[] (previous master keys) across the boundary. Exact-pinned
# to the release paired with wasm-bindgen 0.2.121 above.
js-sys = "=0.3.98"
cachekit-core = { version = "0.7.0", features = ["encryption"] }
cachekit-core = { version = "0.7.5", features = ["encryption"] }
# Wipes the owned previous-master-key staging buffers and the cache-key hash
# input on drop (the NAPI crate borrows and never copies; this crate must copy
# out of JS memory). Already in the tree transitively via cachekit-core — same
Expand Down
3 changes: 1 addition & 2 deletions packages/cachekit-core-wasm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,7 @@ impl ByteStorage {
/// Unpack data, verifying xxHash3-64 integrity and decompressing LZ4.
pub fn unpack(&self, packed: &[u8]) -> Result<Vec<u8>, JsError> {
self.inner
.retrieve(packed)
.map(|(data, _format)| data)
.retrieve_data(packed)
.map_err(|e| JsError::new(&e.to_string()))
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
* invalidation-event decoder. Spec: protocol/spec/interop-mode.md#decode-bounds.
* The bounds themselves are `assertDecodeDepth`. The
* ByteStorage envelope is decoded in Rust instead: `unpack` reaches
* cachekit-core's `ByteStorage::retrieve`, which pre-scans the envelope bytes
* before decoding them (cachekit-core 0.7.0 and later). The envelope entry
* cachekit-core's `ByteStorage::retrieve_data`, which checks every length the
* envelope declares against its bytes before reading them, and pre-scans any
* envelope its one-pass decode declines (cachekit-core 0.7.5). The envelope entry
* point is covered in both lanes: the NAPI `unpack` here, and the wasm
* `unpack` inside workerd in test/workers/decode-bounds.workers.test.ts. Both
* share their assertions through test/fixtures/decode-bounds-vectors.ts.
Expand Down
Loading