Skip to content

taint

diapason.security.taint

Taint tracking — information flow control.

Prevents data leakage through tool chains.

TaintLabel

Bases: str, Enum

Labels for tainted data.

TaintSet dataclass

Immutable set of taint labels attached to data.

from_labels(*labels) classmethod

Create from one or more labels.

has(label)

Check if a specific label is present.

union(other)

Merge two taint sets.

auto_detect_taint(text)

Auto-detect taint labels in text content.

Uses regex patterns to detect PII and secrets in tool output.

check_taint(tool_name, taint)

Check if taint labels violate the sink policy for tool_name.

Returns a violation description string, or None if clean.

declassify(taint, remove, reason)

Remove a taint label with an explicit reason (for audit).

The reason is not stored on the TaintSet itself but should be logged externally for accountability.

propagate_taint(input_taint, output_text)

Propagate taint: union of input taint with auto-detected output taint.