Skip to content

Security-control conformance

rn_forge.auth.conformance

The security controls every framework binding must demonstrate.

:data:CASES has one case per row of the design's security-controls table. Each binding's test suite tags tests with a case ID and fails when a case has none, so a control added here is a control both bindings must show.

A test shows a control by carrying @pytest.mark.security_control("<id>"), on a function, a method or a class; :func:tagged_tests finds those marks in a suite's source without importing it.

SecurityControlCase(id, control, enforced_by) dataclass

One security control.

Attributes:

Name Type Description
id str

A stable identifier, used as the argument of a test's security_control marker.

control str

What the control requires.

enforced_by str

Where the control is enforced.

case_by_id(case_id)

Return the case with ID case_id.

Raises:

Type Description
KeyError

No case has that ID.

tagged_tests(root)

Find the tests that carry a security_control marker under root.

Parameters:

Name Type Description Default
root Path

A directory of test modules, searched recursively.

required

Returns:

Type Description
dict[str, list[str]]

Each tagged case ID, including an ID no case has, mapped to the

dict[str, list[str]]

<file>::<class or function> names that carry it.