T09 · Insecure Skill Coding Practices
- Location
src/validators.js:430- Finding
Non-Blocking PII Detection Allows Sensitive Data to Reach External Model Providers
- Content
View full analysis
[c.case_title, c.case_description].filter(Boolean).join(' ')) .join(' '); } } if (storyCaseText) { const sanitized = storyCaseText .replace(/[\u4e00-\u9fa5]{1,4}[((][^(())]*化名[^(())]*[))]/g, '') .replace(/[((]化名[))]/g, ''); const nameContextPattern = /[\u4e00-\u9fa5]{2,4}(?=是|叫|说|告诉|表示|介绍|反映|名叫|叫做)/g; const matches = sanitized.match(nameContextPattern); if (matches && matches.length > 0) { const uniqueMatches = [...new Set(matches)]; warnings.push( `story_case 中检测到疑似真实姓名:${uniqueMatches.join('、')}。请确认已使用化名(如:小明(化名))替换真实姓名,以保护受益人隐私。`, ); } } return { piiFields, warnings }; } ``` The PII result is added only as a warning: ```js const piiResult = validatePIISafety(input); result.warnings.push(...piiResult.warnings); // Only errors affect validity. result.valid = result.errors.length === 0; ``` The prompt builder then serializes every top-level field that is not explicitly excluded: ```js const safeData = {}; for (const [key, value] of Object.entries(input)) { if (excludeSet.has(key)) continue; if (CURRENCY_FIELDS.has(key) && typeof value === 'number') { safeData[key] ...[truncated 2852 chars]- Remediation
View remediation
