Skip to content

Commit a4fdde9

Browse files
mikolalysenkoclaude
andcommitted
test(vex): label cargo lock shapes in assert messages
CodeQL's default setup raised 14 new `rust/cleartext-logging` alerts on this branch, all in `assert_attested`'s panic messages. The SARIF code flows start at the `uuid` reads inside `cargo_tag::tag_version`'s `format!` (CodeQL's name heuristics classify any `uid`/`uuid`-named identifier as sensitive), pass through the test's `tagged_version(U)` wrapper into the `copy`/`locked` strings of `cargo_vendored_a_attests_in_every_lock_version`, and end in the `what` label interpolated into every assertion message of the helper. A Socket patch uuid is a public identifier, so the alerts are false positives, but they gate the PR and no CodeQL config file exists to exclude tests. Break the path where the value entered the messages: the loop now labels its two cases `tagged` / `untagged` instead of embedding the tagged version strings, and `assert_attested` documents that `what` is a shape label so the next test does not reintroduce the flow. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
1 parent eec2c51 commit a4fdde9

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

  • crates/socket-patch-cli/tests/e2e_vex_lockfile

‎crates/socket-patch-cli/tests/e2e_vex_lockfile/cargo.rs‎

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,9 @@ type Shape = dyn Fn(&Fx);
377377

378378
/// Exactly one statement: `purl` fixed by `uuid`'s GHSA (CVE alias), with the
379379
/// provenance `marker`; exit 0; a `verified` event carrying the vuln; the
380-
/// manifest is never written.
380+
/// manifest is never written. `what` is a shape label, never a tagged
381+
/// version: CodeQL classifies every `uuid`-derived string as sensitive and
382+
/// flags it in panic messages (`rust/cleartext-logging`).
381383
fn assert_attested(fx: &Fx, run: &Run, purl: &str, uuid: &str, marker: &str, what: &str) {
382384
assert_eq!(run.code, Some(0), "{what}: {}", run.env);
383385
assert_eq!(run.env["status"], "success", "{what}: {}", run.env);
@@ -1178,20 +1180,20 @@ fn cargo_vendored_a_attests_in_every_lock_version() {
11781180
write_cargo_vendored(&fx, U, CargoVendored::Inline, PATCHED_RS);
11791181
// The tagged copy + tagged lock (v5), and the pre-tag shape: an
11801182
// untagged copy with its untagged lock entry.
1181-
for (copy, locked) in [
1182-
(tagged_version(U), tagged_version(U)),
1183-
(CRATE_VERSION.to_string(), CRATE_VERSION.to_string()),
1183+
for (shape, at) in [
1184+
("tagged", tagged_version(U)),
1185+
("untagged", CRATE_VERSION.to_string()),
11841186
] {
1185-
fx.put(&copy_toml, copy_at(&copy));
1186-
fx.put("Cargo.lock", cargo_lock_at(version, &locked, ""));
1187+
fx.put(&copy_toml, copy_at(&at));
1188+
fx.put("Cargo.lock", cargo_lock_at(version, &at, ""));
11871189
let run = fx.vex(&["--proxy-url", &api.uri()]);
11881190
assert_attested(
11891191
&fx,
11901192
&run,
11911193
CARGO_PURL,
11921194
U,
11931195
"vendored",
1194-
&format!("lock v{version} at {locked}, copy at {copy}"),
1196+
&format!("lock v{version}, {shape} copy and lock entry"),
11951197
);
11961198
assert!(warning_codes(&run).is_empty(), "v{version}: {}", run.env);
11971199
}

0 commit comments

Comments
 (0)