Practice ยท 3 of 3
Secrets Discipline
Implement get_token(env: dict) reading env['API_TOKEN'] and returning it, raising KeyError('API_TOKEN') naturally when missing. Then redact(s) returning s with any substring 'secret=XYZ' replaced by 'secret=[REDACTED]' (regex sub). Prove your logger never prints raw secrets by returning the redacted form for logging.
Difficulty: intermediate
Press Submit to check your solution.
Back to lesson: Practice: Security Audit Drills