next.js
0d2eca63 - Add recursive type analysis for nested sensitive data detection

Commit
151 days ago
Add recursive type analysis for nested sensitive data detection Rewrote type analyzer to properly handle nested object types and detect sensitive data at any depth. **New Analysis Strategy:** 1. **Primitive types** (string, number, boolean): - Check prop name for sensitive patterns - Example: `password: string` → SENSITIVE 2. **Object types**: - Recursively traverse all nested properties - Check each nested key for sensitive patterns - Example: `config.credentials.password` → SENSITIVE 3. **Function types**: - Warn that functions are non-serializable - Example: `onClick: () => void` → Warning **Implementation:** - Added `analyzePropType()` recursive function - Checks TypeScript type flags to determine primitive vs object - Builds full property paths (e.g., `config.credentials.password`) - Detects sensitive data at any nesting level **Example Detection:** ```typescript interface Props { config: { // object - recurse credentials: { // object - recurse password: string // primitive - SENSITIVE! apiToken: string // primitive - SENSITIVE! } } apiKey: string // primitive - SENSITIVE! } ``` Output: ``` ⚠️ SENSITIVE DATA DETECTED: - PASSWORD (config.credentials.password) - TOKEN (config.credentials.apiToken) - API_KEY (apiKey) ``` 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Author
Parents
Loading