Agent Armor API Reference
    Preparing search index...

    Class PatternDetector

    Generic detector driven by the pattern database. Replaces all hardcoded detector classes for pattern-based detection.

    Hierarchy (View Summary)

    Index
    • Parameters

      • opts: {
            category: TrapCategory;
            id: string;
            maskEvidence?: boolean;
            name: string;
            patterns: PatternEntry[];
            replaceText?: string;
            sanitizeMode?: "none" | "remove" | "replace";
            trapType: TrapType;
        }
        • category: TrapCategory
        • id: string
        • OptionalmaskEvidence?: boolean

          Redact matched text in Threat.evidence. Set for detectors whose matches are secrets, so a scan can't leak what it just found.

        • name: string
        • patterns: PatternEntry[]
        • OptionalreplaceText?: string
        • OptionalsanitizeMode?: "none" | "remove" | "replace"
        • trapType: TrapType

      Returns PatternDetector

    category: TrapCategory

    Which trap category this detector addresses

    id: string

    Unique identifier for this detector

    name: string

    Human-readable name

    trapType: TrapType
    • Last chance to alter matched text before it becomes Threat.evidence.

      Evidence travels: into ScanResult, the CLI's JSON/SARIF output, audit records, and whatever the caller logs. For most detectors the matched text IS the finding and must be preserved verbatim. For a detector whose matches are themselves secrets, echoing them would leak the credential into exactly the CI logs and audit trails the scan was meant to protect. Override to redact; the default is identity.

      Sanitization is unaffected — it works from Threat.location, not evidence.

      Parameters

      • match: string

      Returns string