Security Finding
Severity: MEDIUM
File: .claude/skills/setup-agent-team/key-server.ts:304
Category: Input validation
Description
The validKeyVal() function at line 304 only validates that API keys don't contain shell metacharacters:
functionvalidKeyVal(v: string){return!/[;&'"<>|$`\\(){}]/.test(v);}However, this validation is insufficient because:
- It doesn't validate key format (e.g., expected prefix, length constraints)
- It allows other potentially problematic characters (newlines, null bytes, control characters)
- Keys are written to JSON files without further sanitization
Impact
- Malformed keys could be stored that break downstream systems
- Control characters or newlines could corrupt the JSON storage
- No semantic validation that stored values are actually valid API keys
Remediation
- Add format validation for each provider's expected key format
- Block control characters:
/[\x00-\x1F\x7F]/ - Enforce reasonable length limits (e.g., 8-256 characters)
- Consider validating key prefixes (e.g.,
sk-, Bearer )
Example improved validation:
functionvalidKeyVal(v: string): boolean{// Block control chars, shell metacharactersif(/[\x00-\x1F\x7F;&'"<>|$`\\(){}]/.test(v))returnfalse;// Enforce reasonable lengthif(v.length<8||v.length>512)returnfalse;// Must be printable ASCII/UTF-8if(!/^[\x20-\x7E]+$/.test(v))returnfalse;returntrue;}Found by
-- security/code-scanner
Security Finding
Severity: MEDIUM
File:
.claude/skills/setup-agent-team/key-server.ts:304Category: Input validation
Description
The
validKeyVal()function at line 304 only validates that API keys don't contain shell metacharacters:However, this validation is insufficient because:
Impact
Remediation
/[\x00-\x1F\x7F]/sk-,Bearer)Example improved validation:
Found by
-- security/code-scanner