(content: string)
| 275 | * display secret values. |
| 276 | */ |
| 277 | export function scanForSecrets(content: string): SecretMatch[] { |
| 278 | const matches: SecretMatch[] = [] |
| 279 | const seen = new Set<string>() |
| 280 | |
| 281 | for (const rule of getCompiledRules()) { |
| 282 | if (seen.has(rule.id)) { |
| 283 | continue |
| 284 | } |
| 285 | if (rule.re.test(content)) { |
| 286 | seen.add(rule.id) |
| 287 | matches.push({ |
| 288 | ruleId: rule.id, |
| 289 | label: ruleIdToLabel(rule.id), |
| 290 | }) |
| 291 | } |
| 292 | } |
| 293 | |
| 294 | return matches |
| 295 | } |
| 296 | |
| 297 | /** |
| 298 | * Get a human-readable label for a gitleaks rule ID. |
no test coverage detected