mirror of
https://github.com/affaan-m/everything-claude-code.git
synced 2026-06-14 20:21:23 +08:00
Add opt-in AURA trust-check adapter (integrations/aura)
This commit is contained in:
@@ -82,6 +82,11 @@ class AuraVerdict:
|
|||||||
score: Optional[float] = None
|
score: Optional[float] = None
|
||||||
has_history: bool = False
|
has_history: bool = False
|
||||||
dimensions: Optional[dict[str, float]] = None
|
dimensions: Optional[dict[str, float]] = None
|
||||||
|
# False only when AURA could not be reached (network/parse failure) and the
|
||||||
|
# verdict is a synthetic `unknown`. A reachable AURA that genuinely returns
|
||||||
|
# `unknown` has reachable=True. before_settle's fail_open keys on this, not
|
||||||
|
# on the verdict alone, so it can't wave through unverified counterparties.
|
||||||
|
reachable: bool = True
|
||||||
raw: dict[str, Any] = field(default_factory=dict, repr=False)
|
raw: dict[str, Any] = field(default_factory=dict, repr=False)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@@ -117,7 +122,7 @@ class AuraVerdict:
|
|||||||
@classmethod
|
@classmethod
|
||||||
def unreachable(cls, did: str, reason: str) -> "AuraVerdict":
|
def unreachable(cls, did: str, reason: str) -> "AuraVerdict":
|
||||||
"""A synthetic `unknown` verdict for network/parse failures."""
|
"""A synthetic `unknown` verdict for network/parse failures."""
|
||||||
return cls(did=did, verdict="unknown", reason=reason)
|
return cls(did=did, verdict="unknown", reason=reason, reachable=False)
|
||||||
|
|
||||||
|
|
||||||
# Indirection point so tests can inject canned responses without a network.
|
# Indirection point so tests can inject canned responses without a network.
|
||||||
@@ -183,15 +188,16 @@ def before_settle(
|
|||||||
Tighten to reject brand-new agents too:
|
Tighten to reject brand-new agents too:
|
||||||
before_settle(did, allow=("trusted", "caution"))
|
before_settle(did, allow=("trusted", "caution"))
|
||||||
|
|
||||||
fail_open=True makes an *unreachable* AURA pass through (the verdict is
|
fail_open=True makes an *unreachable* AURA pass through (transport failure
|
||||||
`unknown` but treated as allowed). Off by default — absence of evidence is
|
only — a reachable AURA that returns `unknown` is still rejected). Off by
|
||||||
not evidence of trust.
|
default — absence of evidence is not evidence of trust.
|
||||||
"""
|
"""
|
||||||
v = aura_verdict(did, base_url=base_url, timeout=timeout, _fetch=_fetch)
|
v = aura_verdict(did, base_url=base_url, timeout=timeout, _fetch=_fetch)
|
||||||
|
|
||||||
if v.verdict in allow:
|
if v.verdict in allow:
|
||||||
return v
|
return v
|
||||||
if fail_open and v.verdict == "unknown" and not v.has_history:
|
# fail_open only excuses a transport failure, never a reachable `unknown`.
|
||||||
|
if fail_open and not v.reachable:
|
||||||
return v
|
return v
|
||||||
raise AuraUntrusted(v)
|
raise AuraUntrusted(v)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user