PromptShield logo PromptShield
API DocsFunctions

scanNormalization()

scanNormalization(text, options?, context?): ThreatReport[]

Defined in: normalization.ts:40

Unicode normalization detector.

Detects characters that change under NFKC normalization.

Unicode normalization can transform visually similar characters into canonical equivalents. When user-visible text differs from its normalized form, this may indicate:

  • spoofing attempts
  • homoglyph confusion
  • prompt-smuggling techniques
  • content-validation bypass

Detection model:

  • Compare each character against its NFKC-normalized form
  • Group adjacent normalization-sensitive characters into a span
  • Emit one threat per span

NOTE: This is intentionally heuristic. Many normalization changes are legitimate in multilingual text, but normalization-sensitive spans in prompts or code should be surfaced for inspection.

Span semantics: offendingText = original span decodedPayload = normalized span

Rule: PSN001 — Normalization-sensitive text detected

Parameters

text

string

options?

ScanOptions = {}

context?

ScanContext = {}

Returns

ThreatReport[]

On this page