PromptShield logo PromptShield
API DocsFunctions

scanInjectionPatterns()

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

Defined in: injection-patterns.ts:100

Scan for deterministic prompt-injection patterns.

Detection strategy:

  • Scan line-by-line for stable location reporting
  • Attempt direct regex detection first
  • Fall back to normalized detection

Span semantics: offendingText = matched instruction phrase or entire line

Parameters

text

string

options?

ScanOptions = {}

context?

ScanContext = {}

Returns

ThreatReport[]

On this page