Skip to content

Commit e173dd4

Browse files
ci: mark deliberate secret-shaped test fixtures for rust-secrets (#81)
standards' `rust-secrets` job becomes **blocking outside `./src`** on **2026-08-21** (warn-first window from standards#518). The lines tagged here are **genuine matches on genuine secret-shaped literals** — they are test data, not credentials. So they take an explicit, auditable per-line pragma rather than a pattern loophole that would weaken the gate for every repo in the estate. ```rust // scanner-allow: rust-secrets ``` ## Why a pragma and not a pattern change standards#523 already tightens the patterns to require an assignment **directly to a string literal** of length ≥ 8, which removes the real false positives estate-wide (lookups, path joins, prose). What remains here genuinely *is* an assignment of a secret-shaped literal — it just happens to be fixture data. Loosening the pattern to hide it would blind the gate everywhere. ## Fixture integrity Where the pragma sits **outside** the `r#"…"#` raw string (after the closing quote/comma) it is an ordinary Rust comment and the fixture content is **byte-identical** — the tests exercise exactly the same data. Where it sits **inside** a multi-line fixture, it is a JS-style comment within fake content and does not change what the test asserts. ## Verified `rust-secrets`, extracted from standards' shipping YAML, exits **0** on this tree with `RUST_TODAY=2026-09-01` — i.e. after the cutoff, when the check is blocking. ## Scope **Only Rust sources.** The secret-scanner re-pin is deliberately not bundled: this repo is one of the 22 the estate sweep flagged, where gitleaks findings survive the shared baseline, and moving it onto the real gate needs its own triage. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 5b325b1 commit e173dd4

5 files changed

Lines changed: 7 additions & 7 deletions

File tree

benches/oracle_bench.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ fn secret_proposal() -> Proposal {
6666
action_type: ActionType::CreateFile {
6767
path: "src/config.rs".to_string(),
6868
},
69-
content: r#"let api_key = "supersecretkey12345""#.to_string(),
69+
content: r#"let api_key = "supersecretkey12345""#.to_string(), // scanner-allow: rust-secrets
7070
files_affected: vec!["src/config.rs".to_string()],
7171
llm_confidence: 0.9,
7272
}

src/contract/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1565,7 +1565,7 @@ mod tests {
15651565
let runner = ContractRunner::new();
15661566
let request = GatingRequest::new(create_proposal(
15671567
"config.rs",
1568-
r#"let password = "supersecret123456""#,
1568+
r#"let password = "supersecret123456""#, // scanner-allow: rust-secrets
15691569
));
15701570

15711571
let decision = runner.evaluate(&request).unwrap();

src/oracle/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -729,7 +729,7 @@ mod tests {
729729
action_type: ActionType::CreateFile {
730730
path: "config.rs".to_string(),
731731
},
732-
content: r#"let password = "supersecretpassword123""#.to_string(), // test fixture
732+
content: r#"let password = "supersecretpassword123""#.to_string(), // test fixture — scanner-allow: rust-secrets
733733
files_affected: vec!["config.rs".to_string()],
734734
llm_confidence: 0.9,
735735
};
@@ -766,7 +766,7 @@ mod tests {
766766
action_type: ActionType::CreateFile {
767767
path: "main.ts".to_string(),
768768
},
769-
content: r#"const x: string = 'hello'; let password = "secret123""#.to_string(),
769+
content: r#"const x: string = 'hello'; let password = "secret123""#.to_string(), // scanner-allow: rust-secrets
770770
files_affected: vec!["main.ts".to_string()],
771771
llm_confidence: 0.9,
772772
};
@@ -1048,7 +1048,7 @@ mod tests {
10481048
action_type: ActionType::CreateFile {
10491049
path: "config.rs".to_string(),
10501050
},
1051-
content: r#"const API_KEY = "abcdef1234567890abcdef""#.to_string(), // test fixture
1051+
content: r#"const API_KEY = "abcdef1234567890abcdef""#.to_string(), // test fixture — scanner-allow: rust-secrets
10521052
files_affected: vec!["config.rs".to_string()],
10531053
llm_confidence: 0.9,
10541054
};

tests/gating_pipeline_test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ fn e2e_hardcoded_secret_blocked() {
7878
let runner = ContractRunner::new();
7979
let proposal = create_proposal(
8080
"config.rs",
81-
r#"const password = "supersecretpassword123456789abcde""#,
81+
r#"const password = "supersecretpassword123456789abcde""#, // scanner-allow: rust-secrets
8282
);
8383
let request = GatingRequest::new(proposal);
8484

tests/security_aspect_test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ fn security_forbidden_pattern_detection() {
309309

310310
// Test secret patterns
311311
let secret_patterns = vec![
312-
r#"password = "thisisasecret123456""#,
312+
r#"password = "thisisasecret123456""#, // scanner-allow: rust-secrets
313313
r#"secret = "thisisasecret123456""#,
314314
r#"api_key = "thisisasecret123456""#,
315315
];

0 commit comments

Comments
 (0)