Skip to main content

Practice ยท 1 of 3

Secret Pattern Scanner

Write findSecrets(line) returning an array of matches. Patterns: AWS access keys (AKIA followed by 16 uppercase letters/digits), GitHub tokens (ghp_ + 36+ chars), API keys (sk- + 20+ chars), and name = "value" assignments where name matches /key|token|secret|password/i case-insensitively and value is 8+ chars. Return the matched substrings in the order they appear.

Difficulty: intermediate

Back to lesson: Practice: Secret Detection โ€” Practice