Skip to content

Commit ca4094d

Browse files
authored
Merge pull request #17 from PredicateSystems/remove_sidecar
remove sidecar, replace by rust sidecar
2 parents e460b8c + 87b2977 commit ca4094d

File tree

14 files changed

+48
-4782
lines changed

14 files changed

+48
-4782
lines changed

README.md

Lines changed: 48 additions & 119 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,31 @@ Implemented in this repository:
5252
- policy evaluation with deny precedence and required verification labels,
5353
- typed [predicate-sdk](https://github.com/PredicateSystems/sdk-python) integration adapter (`predicate_authority.integrations`),
5454
- OpenTelemetry-compatible trace emitter (`OpenTelemetryTraceEmitter`),
55-
- `predicate-authorityd` sidecar daemon with policy polling and health/status endpoints,
56-
- ops-focused CLI commands for sidecar health/status, policy validate/reload, and revoke controls,
57-
- pytest coverage for authorization, mandate, integration, telemetry, daemon, and CLI flows.
55+
- pytest coverage for authorization, mandate, integration, and telemetry flows.
56+
57+
## Sidecar Prerequisite
58+
59+
This SDK requires the **Predicate Authority Sidecar** daemon to be running. The sidecar is a lightweight Rust binary that handles policy evaluation and mandate signing.
60+
61+
| Resource | Link |
62+
|----------|------|
63+
| Sidecar Repository | [rust-predicate-authorityd](https://github.com/PredicateSystems/predicate-authority-sidecar) |
64+
| Download Binaries | [Latest Releases](https://github.com/PredicateSystems/predicate-authority-sidecar/releases) |
65+
| License | MIT / Apache 2.0 |
66+
67+
### Quick Sidecar Setup
68+
69+
```bash
70+
# Download the latest release for your platform
71+
# Linux x64, macOS x64/ARM64, Windows x64 available
72+
73+
# Extract and run
74+
tar -xzf predicate-authorityd-*.tar.gz
75+
chmod +x predicate-authorityd
76+
77+
# Start with a policy file (local mode)
78+
./predicate-authorityd run --port 8787 --mode local_only --policy-file policy.json
79+
```
5880

5981
## Installation
6082

@@ -154,15 +176,18 @@ python examples/delegation/oidc_compat_demo.py \
154176
--scope "${OIDC_SCOPE:-authority:check}"
155177
```
156178

157-
### Local IdP quick command
179+
### Local IdP mode (development/air-gapped)
180+
181+
For development or air-gapped environments without external IdP:
158182

159183
```bash
160184
export LOCAL_IDP_SIGNING_KEY="replace-with-strong-secret"
161-
predicate-authorityd \
185+
186+
./predicate-authorityd run \
162187
--host 127.0.0.1 \
163188
--port 8787 \
164189
--mode local_only \
165-
--policy-file examples/authorityd/policy.json \
190+
--policy-file policy.json \
166191
--identity-mode local-idp \
167192
--local-idp-issuer "http://localhost/predicate-local-idp" \
168193
--local-idp-audience "api://predicate-authority"
@@ -175,7 +200,7 @@ Connect the sidecar to Predicate Authority control-plane for policy sync, revoca
175200
```bash
176201
export PREDICATE_API_KEY="your-api-key"
177202

178-
predicate-authorityd \
203+
./predicate-authorityd run \
179204
--host 127.0.0.1 \
180205
--port 8787 \
181206
--mode cloud_connected \
@@ -186,21 +211,7 @@ predicate-authorityd \
186211
--sync-enabled
187212
```
188213

189-
For the Rust sidecar (`rust-predicate-authorityd`), use the same flags:
190-
191-
```bash
192-
./predicate-authorityd run \
193-
--mode cloud_connected \
194-
--control-plane-url https://api.predicatesystems.dev \
195-
--tenant-id your-tenant \
196-
--project-id your-project \
197-
--predicate-api-key $PREDICATE_API_KEY \
198-
--sync-enabled
199-
```
200-
201-
## Operations CLI
202-
203-
`predicate-authority` provides an ops-focused CLI for sidecar/runtime workflows.
214+
## Sidecar Operations
204215

205216
### Ops docs quick links
206217

@@ -211,121 +222,39 @@ For the Rust sidecar (`rust-predicate-authorityd`), use the same flags:
211222
### Sidecar health and status
212223

213224
```bash
214-
predicate-authority sidecar health --host 127.0.0.1 --port 8787
215-
predicate-authority sidecar status --host 127.0.0.1 --port 8787
225+
curl http://127.0.0.1:8787/health
226+
curl http://127.0.0.1:8787/status
216227
```
217228

218-
### Policy validation and reload
229+
### Policy reload
219230

220231
```bash
221-
predicate-authority policy validate --file examples/authorityd/policy.json
222-
predicate-authority policy reload --host 127.0.0.1 --port 8787
232+
curl -X POST http://127.0.0.1:8787/policy/reload
223233
```
224234

225235
### Revocation controls
226236

227237
```bash
228-
predicate-authority revoke principal --host 127.0.0.1 --port 8787 --id agent:orders-01
229-
predicate-authority revoke intent --host 127.0.0.1 --port 8787 --hash <intent_hash>
230-
```
231-
232-
### Daemon startup
233-
234-
```bash
235-
predicate-authorityd --host 127.0.0.1 --port 8787 --mode local_only --policy-file examples/authorityd/policy.json
238+
curl -X POST http://127.0.0.1:8787/revoke/principal -d '{"principal_id": "agent:orders-01"}'
239+
curl -X POST http://127.0.0.1:8787/revoke/intent -d '{"intent_hash": "<intent_hash>"}'
236240
```
237241

238-
Mandate cache behavior:
239-
240-
- default is ephemeral in-memory mandate/revocation cache,
241-
- set `--mandate-store-file <path>` to enable optional local persistence and restart recovery.
242-
243-
### Identity mode options (`predicate-authorityd`)
242+
### Identity mode options
244243

245244
- `--identity-mode local`: deterministic local bridge (default).
246245
- `--identity-mode local-idp`: local IdP-style signed token mode for dev/air-gapped workflows.
247246
- `--identity-mode oidc`: enterprise OIDC bridge mode.
248247
- `--identity-mode entra`: Microsoft Entra bridge mode.
249248

250-
Example (`local-idp`):
251-
252-
```bash
253-
export LOCAL_IDP_SIGNING_KEY="replace-with-strong-secret"
254-
predicate-authorityd \
255-
--host 127.0.0.1 \
256-
--port 8787 \
257-
--mode local_only \
258-
--policy-file examples/authorityd/policy.json \
259-
--identity-mode local-idp \
260-
--local-idp-issuer "http://localhost/predicate-local-idp" \
261-
--local-idp-audience "api://predicate-authority"
262-
```
263-
264-
### Local identity registry (ephemeral + TTL + flush queue)
265-
266-
Enable sidecar-managed local task identities and local ledger queue:
267-
268-
```bash
269-
PYTHONPATH=. predicate-authorityd \
270-
--host 127.0.0.1 \
271-
--port 8787 \
272-
--mode local_only \
273-
--policy-file examples/authorityd/policy.json \
274-
--identity-mode local-idp \
275-
--local-identity-enabled \
276-
--local-identity-registry-file ./.predicate-authorityd/local-identities.json \
277-
--local-identity-default-ttl-s 900 \
278-
--flush-worker-enabled \
279-
--flush-worker-interval-s 2.0 \
280-
--flush-worker-max-batch-size 50 \
281-
--flush-worker-dead-letter-max-attempts 5
282-
```
283-
284-
Runtime endpoints:
285-
286-
- `POST /identity/task` (issue ephemeral task identity)
287-
- `GET /identity/list` (list identities)
288-
- `POST /identity/revoke` (revoke identity)
289-
- `GET /ledger/flush-queue` (inspect pending local ledger queue)
290-
- `GET /ledger/dead-letter` (list quarantined queue items only)
291-
- `POST /ledger/flush-ack` (mark queue item as flushed)
292-
- `POST /ledger/flush-now` (manually trigger immediate queue flush)
293-
- `POST /ledger/requeue` (requeue quarantined item for retry)
294-
295-
Background flush worker status fields:
296-
297-
- `flush_cycle_count`
298-
- `flush_sent_count`
299-
- `flush_failed_count`
300-
- `flush_quarantined_count`
301-
- `last_flush_epoch_s`
302-
- `last_flush_error`
303-
304-
### How to run with control-plane shipping (out-of-the-box)
305-
306-
```bash
307-
export CONTROL_PLANE_URL="http://127.0.0.1:8080"
308-
export CONTROL_PLANE_TENANT_ID="dev-tenant"
309-
export CONTROL_PLANE_PROJECT_ID="dev-project"
310-
export PREDICATE_API_KEY="<your-api-key>"
311-
312-
PYTHONPATH=. predicate-authorityd \
313-
--host 127.0.0.1 \
314-
--port 8787 \
315-
--mode local_only \
316-
--policy-file examples/authorityd/policy.json \
317-
--control-plane-enabled \
318-
--control-plane-fail-open
319-
```
320-
321-
The `/status` endpoint now includes:
249+
### Runtime endpoints
322250

323-
- `control_plane_emitter_attached`
324-
- `control_plane_audit_push_success_count`
325-
- `control_plane_audit_push_failure_count`
326-
- `control_plane_usage_push_success_count`
327-
- `control_plane_usage_push_failure_count`
328-
- `control_plane_last_push_error`
251+
- `POST /v1/authorize` - Core authorization endpoint
252+
- `GET /health` - Health check
253+
- `GET /status` - Detailed status with metrics
254+
- `POST /policy/reload` - Hot-reload policy
255+
- `POST /revoke/principal` - Revoke by principal
256+
- `POST /revoke/intent` - Revoke by intent hash
257+
- `POST /revoke/mandate` - Revoke by mandate ID
329258

330259
## Security: Local Kill-Switch Path
331260

examples/authorityd/daemon_endpoint_check.py

Lines changed: 0 additions & 46 deletions
This file was deleted.

examples/authorityd/policy.json

Lines changed: 0 additions & 20 deletions
This file was deleted.

predicate_authority/__init__.py

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
ControlPlaneTraceEmitter,
2222
UsageCreditRecord,
2323
)
24-
from predicate_authority.daemon import DaemonConfig, PredicateAuthorityDaemon
2524
from predicate_authority.entra_compat import (
2625
EntraCompatibilityConfig,
2726
EntraCompatibilityError,
@@ -30,14 +29,6 @@
3029
)
3130
from predicate_authority.errors import AuthorizationDeniedError
3231
from predicate_authority.guard import ActionExecutionResult, ActionGuard
33-
from predicate_authority.local_identity import (
34-
CompositeTraceEmitter,
35-
LedgerQueueItem,
36-
LocalIdentityRegistry,
37-
LocalIdentityRegistryStats,
38-
LocalLedgerQueueEmitter,
39-
TaskIdentityRecord,
40-
)
4132
from predicate_authority.mandate import LocalMandateSigner
4233
from predicate_authority.oidc_compat import (
4334
OidcCompatibilityConfig,
@@ -56,28 +47,17 @@
5647
from predicate_authority.policy_source import PolicyFileSource, PolicyReloadResult
5748
from predicate_authority.proof import InMemoryProofLedger
5849
from predicate_authority.revocation import LocalRevocationCache
59-
from predicate_authority.sidecar import (
60-
AuthorityMode,
61-
PredicateAuthoritySidecar,
62-
SidecarConfig,
63-
SidecarError,
64-
SidecarStatus,
65-
)
66-
from predicate_authority.sidecar_store import CredentialRecord, LocalCredentialStore
6750
from predicate_authority.telemetry import OpenTelemetryTraceEmitter
6851

6952
__all__ = [
7053
"ActionExecutionResult",
7154
"ActionGuard",
72-
"AuthorityMode",
7355
"AuthorityClient",
7456
"AuthorizationDeniedError",
7557
"AuditEventEnvelope",
7658
"ControlPlaneClient",
7759
"ControlPlaneClientConfig",
7860
"ControlPlaneTraceEmitter",
79-
"CredentialRecord",
80-
"DaemonConfig",
8161
"EntraCompatibilityConfig",
8262
"EntraCompatibilityError",
8363
"EntraBridgeConfig",
@@ -88,11 +68,7 @@
8868
"InMemoryProofLedger",
8969
"LocalIdPBridge",
9070
"LocalIdPBridgeConfig",
91-
"LocalCredentialStore",
9271
"LocalAuthorizationContext",
93-
"LocalIdentityRegistry",
94-
"LocalIdentityRegistryStats",
95-
"LocalLedgerQueueEmitter",
9672
"LocalMandateSigner",
9773
"LocalRevocationCache",
9874
"OIDCBridgeConfig",
@@ -111,15 +87,7 @@
11187
"PolicyFileSource",
11288
"PolicyMatchResult",
11389
"PolicyReloadResult",
114-
"PredicateAuthorityDaemon",
115-
"PredicateAuthoritySidecar",
116-
"SidecarConfig",
117-
"SidecarError",
118-
"SidecarStatus",
11990
"TokenExchangeResult",
120-
"CompositeTraceEmitter",
121-
"LedgerQueueItem",
122-
"TaskIdentityRecord",
12391
"TokenValidationError",
12492
"UsageCreditRecord",
12593
"parse_bool",

0 commit comments

Comments
 (0)