aeat.domain.calculations.registry._remote_state_guard module¶
Fail-closed guard for live AEAT cross-reference surfaces.
This module uses LiveCrossReferenceDecision and RemoteOperation
to enforce fail-closed access control.
- class RemoteStateGuardModel(**data)[source]¶
Bases:
BaseModelStrict frozen base for remote-state guard records.
- class RemoteStateGuardPolicy(**data)[source]¶
Bases:
RemoteStateGuardModelPolicy attached to a live/static AEAT cross-reference decision.
- Parameters:
id (str)
evidence_tier (Literal['official_source_guidance', 'executable_parity_evidence', 'layout_authority'])
classification (Literal['open_simulator', 'integration_test_service', 'public_read_surface', 'authenticated_read_surface', 'static_official_only', 'forbidden_stateful_surface'])
synthetic_data_allowed (bool)
requires_authentication (bool)
requires_aeat_authorization (bool)
- id: str¶
- evidence_tier: RemoteEvidenceTier¶
- classification: CrossReferenceClassification¶
- allowed_hosts: tuple[str, ...]¶
- allowed_host_suffixes: tuple[str, ...]¶
- allowed_read_post_paths: tuple[str, ...]¶
- allowed_browser_action_patterns: tuple[str, ...]¶
- synthetic_data_allowed: bool¶
- requires_authentication: bool¶
- requires_aeat_authorization: bool¶
- forbidden_actions: tuple[str, ...]¶
- class RemoteOperation(**data)[source]¶
Bases:
RemoteStateGuardModelOne candidate browser/network/local operation before execution.
- Parameters:
- kind: RemoteOperationKind¶
- method: str | None¶
- url: AnyUrl | None¶
- action: str | None¶
- class RemoteStateGuardResult(**data)[source]¶
Bases:
RemoteStateGuardModelDecision returned by the remote-state guard.
- decision: RemoteGuardDecision¶
- reason: str¶
- policy_id: str¶
- remote_state_policy_from_cross_reference(decision)[source]¶
Build the executable remote-state guard policy for a registry cross-reference.
- Return type:
- Returns:
The
RemoteStateGuardPolicyderived from the cross-reference decision.- Parameters:
decision (LiveCrossReferenceDecision)
- assert_remote_operation_allowed(policy, operation)[source]¶
Return an allowed decision or raise for forbidden AEAT remote state.
- Return type:
- Returns:
A
RemoteStateGuardResultwith an allowed decision.- Parameters:
policy (RemoteStateGuardPolicy)
operation (RemoteOperation)
- assert_remote_operations_allowed(policy, operations, *, context='remote operation')[source]¶
Pre-flight an operation plan through the remote-state guard and return a tuple of
RemoteOperation.- Return type:
- Returns:
The validated operations as an immutable tuple.
- Parameters:
policy (RemoteStateGuardPolicy)
operations (Iterable[RemoteOperation])
context (str)
- evaluate_remote_operation(policy, operation)[source]¶
Evaluate one operation against the guard and return a
RemoteStateGuardResult.- Return type:
- Parameters:
policy (RemoteStateGuardPolicy)
operation (RemoteOperation)