scan_data
Detect sensitive information in text including PII, API keys, passwords, and financial data to enhance data security and compliance.
Instructions
Scan text for sensitive data: PII (Chinese ID cards, phone numbers, bank cards), API keys, passwords, private keys, JWT tokens, SSN, credit cards.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| text | Yes | Text to scan for sensitive data |
Implementation Reference
- src/core/engine.ts:201-223 (handler)The handler function 'scanData' performs sensitivity analysis on input text and logs any findings using the 'redactSensitive' helper and the internal 'AuditLog' class.
scanData(text: string, toolName?: string): ScanResult { const [, findings] = redactSensitive(text) const hasSensitiveData = findings.length > 0 const summary = findings.map(f => `${f.name}(${f.count})`).join(', ') if (hasSensitiveData) { for (const f of findings) { this.log.write({ level: 'HIGH', layer: 'L2', action: 'audit', detail: this.locale === 'zh' ? `检测到敏感数据: ${f.name}: ${f.count} 处 — 已记录审计日志,数据正常返回` : `Sensitive data detected: ${f.name}: ${f.count} occurrence(s) — audited, data passed through`, tool: toolName, pattern: f.id, }) } this.markSensitiveData(toolName || 'unknown', summary) } return { hasSensitiveData, findings, summary } }