Skip to content

Commit 7e32708

Browse files
committed
Fix invalidation text showing for secrets that aren't invalidated
Signed-off-by: Lilly Rose Berner <[email protected]>
1 parent 56563a7 commit 7e32708

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

echo/src/database/pastes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ impl Annotation {
252252
for scan in scans {
253253
let mut content = format!("Mystb.in found a secret for {}.", scan.service);
254254

255-
if invalidate_secrets {
255+
if scan.invalidated {
256256
content += " This secret has been invalidated.";
257257
}
258258

echo/src/scanners/mod.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ pub struct ScanResult<'r> {
2424
pub tail: Position,
2525

2626
pub content: &'r str,
27+
pub invalidated: bool,
2728
pub service: Arc<String>,
2829
}
2930

@@ -35,16 +36,19 @@ pub async fn scan_file<'r>(content: &'r str, invalidate_secrets: bool) -> Vec<Sc
3536

3637
for scanner in SCANNERS.get().unwrap() {
3738
for finding in scanner.execute(content) {
39+
let do_invalidate = scanner.nullify() && invalidate_secrets;
40+
3841
let result = ScanResult {
3942
service: scanner.service(),
4043
content: finding.as_str(),
44+
invalidated: do_invalidate,
4145
head: find_position(content, finding.start()),
4246
tail: find_position(content, finding.end()),
4347
};
4448

4549
results.push(result);
4650

47-
if scanner.nullify() && invalidate_secrets {
51+
if do_invalidate {
4852
REPORTER.get().unwrap().add(finding.as_str()).await;
4953
}
5054
}

0 commit comments

Comments
 (0)