Skip to content

Commit 70992d5

Browse files
committed
address code review
1 parent 69da43a commit 70992d5

4 files changed

Lines changed: 28 additions & 5 deletions

File tree

docs/authorityd-operations.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,24 @@ PYTHONPATH=. predicate-authorityd \
6363
--control-plane-fail-open
6464
```
6565

66+
### Signing key safety note (required until mandate `v2` claims)
67+
68+
Until mandate `v2` introduces explicit `iss`/`aud` claims and asymmetric signing defaults,
69+
each deployment instance must use a unique signing key to reduce cross-instance replay risk.
70+
71+
Recommended startup pattern:
72+
73+
```bash
74+
export PREDICATE_AUTHORITY_SIGNING_KEY="<unique-random-per-instance>"
75+
76+
PYTHONPATH=. predicate-authorityd \
77+
--host 127.0.0.1 \
78+
--port 8787 \
79+
--mode local_only \
80+
--policy-file examples/authorityd/policy.json \
81+
--mandate-signing-key-env PREDICATE_AUTHORITY_SIGNING_KEY
82+
```
83+
6684
When enabled, daemon bootstrap auto-attaches `ControlPlaneTraceEmitter` so each
6785
authority decision pushes:
6886

predicate_authority/bridge.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,10 @@ def refresh_token(
112112

113113

114114
class EntraIdentityBridge(OIDCIdentityBridge):
115-
"""Microsoft Entra adapter built on generic OIDC behavior."""
115+
"""Microsoft Entra adapter built on generic OIDC behavior.
116+
117+
Phase 2 keeps this as a deterministic local stand-in for real IdP token exchange.
118+
"""
116119

117120
def __init__(self, config: EntraBridgeConfig) -> None:
118121
oidc_config = OIDCBridgeConfig(

predicate_authority/control_plane.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,8 @@ def _send_audit_event(self, audit_event: AuditEventEnvelope) -> None:
183183
except Exception as exc:
184184
self.audit_push_failure_count += 1
185185
self.last_push_error = str(exc)
186-
raise
186+
if not self.client.config.fail_open:
187+
raise
187188

188189
def _send_usage_record(self, usage: UsageCreditRecord) -> None:
189190
try:
@@ -197,4 +198,5 @@ def _send_usage_record(self, usage: UsageCreditRecord) -> None:
197198
except Exception as exc:
198199
self.usage_push_failure_count += 1
199200
self.last_push_error = str(exc)
200-
raise
201+
if not self.client.config.fail_open:
202+
raise

predicate_authority/telemetry.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from contextlib import AbstractContextManager
44
from typing import Protocol, cast
55

6-
from predicate_contracts import ProofEvent, TraceEmitter
6+
from predicate_contracts import ProofEvent
77

88

99
class SpanLike(Protocol):
@@ -14,7 +14,7 @@ class TracerLike(Protocol):
1414
def start_as_current_span(self, name: str) -> AbstractContextManager[SpanLike]: ...
1515

1616

17-
class OpenTelemetryTraceEmitter(TraceEmitter):
17+
class OpenTelemetryTraceEmitter:
1818
"""TraceEmitter backed by OpenTelemetry spans/events."""
1919

2020
def __init__(self, tracer: TracerLike | None = None) -> None:

0 commit comments

Comments
 (0)