Skip to content
Closed
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
1 change: 1 addition & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions languages/golang/encrypt/guest/Cargo.lock

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

1 change: 1 addition & 0 deletions packages/eql/Cargo.lock

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

5 changes: 4 additions & 1 deletion packages/eql/tests/encryption/tests/json_tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1906,9 +1906,12 @@ fn postgres_hostile_answers_are_refused_by_the_client() {
cipher.decrypt_as(JsonTreeSubtree::from_key(key, rows), column()),
)
};
// Refused: as the wrong entry, or at the cipher. Under the cascading
// tags (spike) a row the chain misplaces fails to authenticate, since
// its parent's AAD covers its tag.
let wrong = |result: Result<Value, Error>, what: &str| {
assert!(
matches!(result, Err(Error::JsonWrongEntry { .. })),
matches!(result, Err(Error::JsonWrongEntry { .. }) | Err(Error::Aead)),
"{what}: {result:?}"
);
};
Expand Down
2 changes: 2 additions & 0 deletions packages/stack-encrypt/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ vitaminc-normalize = { workspace = true }
vitaminc-ore = { workspace = true }
vitaminc-prf = { workspace = true }
vitaminc-protected = { workspace = true }
# Spike (#1357): the CSPRNG that shuffles a document's stored entry order.
vitaminc = { workspace = true }
# `dynamic` only: serde over the transport frame, which reads a binding's
# control data (statistics, options, a plan) into typed messages.
vitaminc-aead-frame = { workspace = true, optional = true, features = ["serde"] }
Expand Down
10 changes: 10 additions & 0 deletions packages/stack-encrypt/src/cipher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -592,6 +592,16 @@ impl<K> StackCipher<K> {
&self.kms
}

/// The loaded state of the keyset with `id`, if this cipher has loaded
/// it: what opening a JSON document with its root open needs, since the
/// client walks the document's chain itself (spike, cascading tags).
pub(crate) fn loaded_keyset(&self, id: Uuid) -> Option<Arc<KeysetState>> {
match self.keysets().get(&IdentifiedBy::Uuid(id)) {
Lookup::Hit(state) => Some(state),
Lookup::Stale(_) | Lookup::Miss(_) => None,
}
}

fn keysets(&self) -> std::sync::MutexGuard<'_, KeysetCache> {
// The cache holds no invariant a panic mid-update could break (an
// insert is two map writes, and a stale name entry only points at
Expand Down
Loading
Loading