T09 · Insecure Skill Coding Practices
- Location
index.js:58- Finding
Sensitive-data filtering API returns complete unredacted secrets
- Content
View full analysis
0, filtered, detected: detected.map(item => ({ ...item, value: maskValue(item.original, item.type), })), }; } async function detectSensitiveData(content) { const result = await filterSensitiveData(content); return result.detected; } ``` ### Technical Analysis The API advertises sensitive-data filtering and creates a masked `value`, but it also stores each complete match in the `original` property. The object spread in the returned `detected` array preserves that property: ```js { ...item, value: maskValue(item.original, item.type), } ``` Consequently, both `filterSensitiveData()` and `detectSensitiveData()` return complete API keys, passwords, database connection URLs, private keys, payment-card numbers, phone numbers, and other detected data. Masking only one property does not sanitize the result when another public property contains the complete secret. This is particularly dangerous because downstream callers are likely to regard the entire result as safe for logging, telemetry, reports, or persistent storage. ### Attack Pa ...[truncated 1377 chars]- Remediation
View remediation
