ntia_conformance_checker.probes package

Submodules

ntia_conformance_checker.probes.presence module

Built-in presence probes.

Together these two probes cover every active rule in the NTIA and FSCT catalogues – rule-id reuse is high because the question being asked is always the same shape (“is this attribute present?”).

ntia_conformance_checker.probes.presence.require_component_attribute(checker: CheckerProtocol, *, attribute: str) → Iterable[Finding][source]

Require every component in the SBOM to declare attribute.

Yields one Finding per component where attribute is absent or empty. The component’s SPDX-style id and human name are surfaced so SARIF / JSON / text emitters can locate the failure precisely.

Parameters:
ntia_conformance_checker.probes.presence.require_document_attribute(checker: CheckerProtocol, *, attribute: str) → Iterable[Finding][source]

Require the SBOM document to declare attribute.

Yields a single document-level Finding when the attribute is absent; yields nothing when present.

Parameters:

Module contents

Probe registry and built-in probe implementations.

A probe is a small, registered Python function that answers one yes/no question about a parsed SBOM (e.g. “do all components have a supplier?”). Rules declared in rules/*.yaml reference probes by name; the engine calls them and collects Finding objects.

Importing ntia_conformance_checker.probes registers every built-in probe as a side effect. See probes/presence.py for the canonical two-probe vocabulary that covers all current NTIA + FSCT active rules.

ntia_conformance_checker.probes.attribute_scope(name: str) → frozenset[str] | None[source]

Element ids probe name accepts as attribute; None if unrestricted.

ntia_conformance_checker.probes.lookup(name: str) → ProbeFn[source]

Return the probe registered under name; raise KeyError if absent.

ntia_conformance_checker.probes.probe(name: str, *, attributes: frozenset[str] | None = None) → Callable[[ProbeFn], ProbeFn][source]

Register fn under name in the global probe registry.

attributes is for a probe taking an attribute param: the element ids it accepts. The loader then requires a rule’s attribute to be one of them and to equal the rule’s element_id.

Raises ValueError on duplicate registration so accidental overrides fail loudly at import time, and on a probe that takes *args/**kwargs (the loader validates YAML params against explicit parameters) or that is given attributes without an attribute parameter.

ntia_conformance_checker.probes.registered_names() → tuple[str, ...][source]

All registered probe names, sorted. For tests / introspection.