T09 · Insecure Skill Coding Practices
Warning
- Location
SKILL.md:20- Finding
Default short identifiers have insufficient entropy for security-sensitive tokens
- Content
View full analysis
str: return "".join(secrets.choice(ALPHABET) for _ in range(length)) ``` ### Technical Analysis The use of `secrets.choice()` provides a cryptographically secure random source. The weakness is the documented use of the default 10-character base36 output for invite codes and the broader claim that generated IDs are appropriate for tokens. A 10-character value selected from 36 symbols has: ```text log2(36^10) ≈ 51.7 bits ``` This may be adequate for non-secret identifiers, filenames, test fixtures, or slugs, but it does not provide a suitable standalone security margin for long-lived bearer credentials such as a ...[truncated 1608 chars]- Remediation
View remediation
str: return secrets.token_urlsafe(16) ``` 5. If base36 output must be retained for security-sensitive values, require at least 25 base36 characters to exceed 128 bits of entropy. 6. Document that security-sensitive verification endpoints must also enforce token expiration, one-time use where appropriate, attempt throttling, monitoring, and revocation. 7. Add argument validation that rejects unsafe token lengths when operating in a security-token mode. ]]>
