Scan text (one source file) for likely secrets, line by line (lines are numbered from 1):
aws-access-key: AKIA followed by 16 uppercase letters or digits (as a whole word)private-key: a line containing -----BEGIN then optionally RSA , EC or OPENSSH then PRIVATE KEY-----github-token: ghp_ followed by 36 letters or digitsgeneric-secret: an assignment name = value or name: value where name contains secret, token,
password or api_key (case-insensitive), and the value (optionally quoted, no spaces) is at least 12
characters long with Shannon entropy ≥ 3.5 bits per characternosecret (an allowlist comment).Return [{"line": n, "kind": ...}], one per (line, kind), sorted by line then kind.
Implement scan. Input: text: str. Returns: list[dict].
def scan(text: str) -> list[dict]:
return [{"line": i, "kind": "generic-secret"} for i, l in enumerate(text.splitlines(), 1) if "password" in l]
Run executes the public tests. Submit grades against public and hidden tests.
Scan text (one source file) for likely secrets, line by line (lines are numbered from 1):
aws-access-key: AKIA followed by 16 uppercase letters or digits (as a whole word)private-key: a line containing -----BEGIN then optionally RSA , EC or OPENSSH then PRIVATE KEY-----github-token: ghp_ followed by 36 letters or digitsgeneric-secret: an assignment name = value or name: value where name contains secret, token,
password or api_key (case-insensitive), and the value (optionally quoted, no spaces) is at least 12
characters long with Shannon entropy ≥ 3.5 bits per characternosecret (an allowlist comment).Return [{"line": n, "kind": ...}], one per (line, kind), sorted by line then kind.
Implement scan. Input: text: str. Returns: list[dict].
def scan(text: str) -> list[dict]:
return [{"line": i, "kind": "generic-secret"} for i, l in enumerate(text.splitlines(), 1) if "password" in l]
Run executes the public tests. Submit grades against public and hidden tests.