T09 · Insecure Skill Coding Practices
- Location
index.js:293- Finding
Fail-open processing marks detected prompt injections as safe
- Content
View full analysis
maxLength) { throw new Error(`Content exceeds maximum length of ${maxLength} characters`); } const injectionCheck = await this.detectAndLearn(content); if (injectionCheck.isMalicious) { if (strictMode) { throw new Error( `Prompt injection detected: ${injectionCheck.threats.map(t => t.type).join(', ')}` ); } else { console.warn('Potential prompt injection detected:', injectionCheck); } } const sanitized = this.sanitize(content); return { originalLength: content ? content.length : 0, sanitized, sanitizedLength: sanitized.length, injectionCheck, isSafe: !injectionCheck.isMalicious || !strictMode }; } ``` The integration explicitly selects the fail-open behavior: ```javascript const processed = protection.processExternalContent(simulatedRawContent, { maxLength: 10000, strictMode: false }); if (processed.isSafe) { console.log(processed.sanitized); } ``` ### Technical Analysis The default value of `strictMode` is `false`. When malicious content is detected under that default, the implementation logs a warning but calculates `isSafe` as true because `!strictMode` is true. The sanitizer does not remove detected natural-language instructions. It only removes selected Unicode formatting characters and replaces HTML-like tags. A payload such as “Ignore all previous instructions” therefore remains present in the returned `sanitized` value. Detection and sanitization are consequently disconnected: the system can correctly identify an injection while simultaneously t ...[truncated 1038 chars]- Remediation
View remediation
