Agent Armor API Reference
    Preparing search index...

    Class HiddenHTMLDetector

    Detects instructions hidden via CSS/HTML that are invisible to humans but parsed by LLMs. This is the most common content injection vector.

    Covers:

    • CSS display:none / visibility:hidden elements with text content
    • Off-screen positioned elements (position:absolute with extreme offsets)
    • Zero-size elements (width:0, height:0, font-size:0)
    • Background-matching text color
    • Opacity:0 elements

    Hierarchy (View Summary)

    Index
    category: TrapCategory = 'content-injection'

    Which trap category this detector addresses

    id: "hidden-html" = 'hidden-html'

    Unique identifier for this detector

    name: "Hidden HTML Detector" = 'Hidden HTML Detector'

    Human-readable name

    trapType: TrapType = 'hidden-html'
    • 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

    • Return sanitized content with threats neutralized. content is the original scanned text, never text another detector has already edited, so the threats' offsets are valid in it. Each detector's change is merged with the others' and applied once.

      Parameters

      • content: string
      • threats: Threat[]

      Returns string