Skip to content

Commit 981360f

Browse files
committed
test(stack-encrypt): say #1363 corrected the probe comment, and give assertions messages
After the merge of #1363, json_tree_subtree's comment says the server "can pick it out"; mod.rs and the doc comment of a_read_gives_away_its_bound_and_its_probes still quoted the old claim as standing. Both now say it was corrected. The test's assert_eq! calls gain the messages the rust-testing convention asks for, and mod.rs names the two harness tests that show features no mutant can reach do fire. Claude-Session: https://claude.ai/code/session_01N7bCqa3ZVJMcEE99RzVqEu
1 parent faff233 commit 981360f

2 files changed

Lines changed: 28 additions & 12 deletions

File tree

‎packages/stack-encrypt/tests/json_leakage/calibration.rs‎

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -419,9 +419,9 @@ mod the_harness {
419419
/// so `N = 64`, at two), the probe is the last token at its level and
420420
/// finds the element where the path's other tokens find the leaf below
421421
/// it, and which tokens find a node says which elements hold the rest of
422-
/// the path. `json_tree_subtree`'s comment that "the server cannot tell
423-
/// a probe from any other token" is true of a token's bytes and of
424-
/// nothing else.
422+
/// the path. `json_tree_subtree`'s comment once said "the server
423+
/// cannot tell a probe from any other token", which is true of a token's
424+
/// bytes and of nothing else; #1363 corrected it.
425425
#[test]
426426
fn a_read_gives_away_its_bound_and_its_probes() {
427427
let runtime = runtime();
@@ -444,23 +444,36 @@ mod the_harness {
444444
],
445445
};
446446
let observed = real_world(&runtime, &cipher, &world);
447-
assert_eq!(distinguishers::token_counts(&observed), [65, 4161]);
447+
assert_eq!(
448+
distinguishers::token_counts(&observed),
449+
[65, 4161],
450+
"one wildcard level sends N + 1 tokens, two send N² + N + 1"
451+
);
448452
// 4,161 is also one level at a bound of 4,160; which tokens find a
449453
// node (the 65th finds `$.items[0].tags[64]`'s absence, not an
450454
// item) is what tells the reading apart.
451455
assert_eq!(
452456
distinguishers::bound_recovery(&observed),
453-
[vec![(1, 64)], vec![(1, 4160), (2, 64)]]
457+
[vec![(1, 64)], vec![(1, 4160), (2, 64)]],
458+
"the count alone gives the bound"
454459
);
455460
let price = &distinguishers::wildcard_positions(&observed)[0];
456461
let price = price.as_ref().expect("a wildcard read");
457462
// No items; three, the second without a price; seventy, the
458463
// second without a price, longer than the bound.
459-
assert_eq!(price[0], (vec![], false, None));
460-
assert_eq!(price[1], (vec![0, 2], false, None));
464+
assert_eq!(price[0], (vec![], false, None), "no items, no hits");
465+
assert_eq!(
466+
price[1],
467+
(vec![0, 2], false, None),
468+
"three items, the second without a price"
469+
);
461470
let mut most: Vec<usize> = (0..64).collect();
462471
most.retain(|&i| i != 1);
463-
assert_eq!(price[2], (most, true, Some(true)));
472+
assert_eq!(
473+
price[2],
474+
(most, true, Some(true)),
475+
"seventy items: the probe finds the element, under another selector"
476+
);
464477
}
465478

466479
/// `distinguishers::cross_kind_equalities` can fire: it is empty on the

‎packages/stack-encrypt/tests/json_leakage/mod.rs‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,10 @@
9292
//! on a column whose rows vary, which is the page's claim that the stored
9393
//! order reveals each row's shape; and on the real scheme a wildcard
9494
//! read's token list gives its bound and its probes away
95-
//! (`a_read_gives_away_its_bound_and_its_probes`).
95+
//! (`a_read_gives_away_its_bound_and_its_probes`). Two features no mutant
96+
//! can reach are shown to fire: `cross_kind_equalities` on a world whose
97+
//! token is a stored selector, and `token_derivability` on a read of a
98+
//! position past every row's array.
9699
//!
97100
//! # What the profile found
98101
//!
@@ -115,13 +118,13 @@
115118
//! Against the SQL's own comment, not the page:
116119
//!
117120
//! 2. **A probe is told from the other tokens.** `json_tree_subtree`'s
118-
//! comment says "the server cannot tell a probe from any other token".
121+
//! comment said "the server cannot tell a probe from any other token".
119122
//! It cannot from the token's bytes, but the probe is the last token at
120123
//! its level, the count gives the bound away (65 tokens is one level at
121124
//! `N = 64` and nothing else), and a probe that finds something finds
122125
//! the element, whose selector differs from the leaf the path's other
123-
//! tokens find. `a_read_gives_away_its_bound_and_its_probes`. The leakage
124-
//! page does not repeat the claim; the comment is left to #1363.
126+
//! tokens find. `a_read_gives_away_its_bound_and_its_probes`. #1363
127+
//! corrected the comment, which now says the server "can pick it out".
125128
//!
126129
//! The three findings against the page as it stood before #1363 (an
127130
//! ordering term's length, equal values at two ordered paths, UTF-8 byte

0 commit comments

Comments
 (0)