Skip to content

symfonic.evals.security_assertions

security_assertions

Payload-safe assertions for untrusted content and isolation boundaries.

CanaryAbsent dataclass

CanaryAbsent(canary: str, *, attributes: tuple[str, ...] = (), include_events: bool = True)

Reject a canary in the response, events, or named safe evidence fields.

Source code in src/symfonic/evals/security_assertions.py
def __init__(
    self,
    canary: str,
    *,
    attributes: tuple[str, ...] = (),
    include_events: bool = True,
) -> None:
    if not canary:
        raise ValueError("CanaryAbsent requires a non-empty canary")
    if any(not attribute for attribute in attributes):
        raise ValueError("canary evidence attribute names cannot be empty")
    object.__setattr__(self, "canary", canary)
    object.__setattr__(self, "attributes", tuple(attributes))
    object.__setattr__(self, "include_events", include_events)
    object.__setattr__(self, "name", "canary_absent")

IsolationBoundaryObserved dataclass

IsolationBoundaryObserved(boundary: str, attribute: str = 'isolation_evidence', name: str = 'isolation_boundary_observed')

Require positive source evidence and a zero-admission isolated read.

UntrustedContentObserved dataclass

UntrustedContentObserved(fragment: str, *, source: str = 'memory.recall', attribute: str = 'prompt_recall')

Require a canary inside one exact untrusted prompt contribution.

Source code in src/symfonic/evals/security_assertions.py
def __init__(
    self,
    fragment: str,
    *,
    source: str = "memory.recall",
    attribute: str = "prompt_recall",
) -> None:
    if not fragment or not source or not attribute:
        raise ValueError("untrusted-content evidence requires non-empty values")
    if any(char in source for char in '<>"\''):
        raise ValueError("untrusted-content source must be a plain identifier")
    object.__setattr__(self, "fragment", fragment)
    object.__setattr__(self, "source", source)
    object.__setattr__(self, "attribute", attribute)
    object.__setattr__(self, "name", "untrusted_content_observed")