Skip to content

Commit 9c3f567

Browse files
authored
Merge pull request #15 from PredicateSystems/example_ssrf
example updated with policy-reload secret
2 parents 57f18a0 + b3b067f commit 9c3f567

5 files changed

Lines changed: 53 additions & 0 deletions

File tree

examples/real-openclaw-demo/.env.example

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,17 @@ SECURECLAW_VERBOSE=true
1313

1414
# Optional: Slow mode for recording demos
1515
DEMO_SLOW_MODE=false
16+
17+
# =============================================================================
18+
# Sidecar Security Configuration (v0.7.1+)
19+
# =============================================================================
20+
21+
# Policy Reload Authentication: Bearer token required for /policy/reload endpoint
22+
# If set, requests must include: Authorization: Bearer <secret>
23+
# Leave empty to allow unauthenticated reloads (not recommended for production)
24+
PREDICATE_POLICY_RELOAD_SECRET=demo-reload-secret
25+
26+
# SSRF Whitelist: Comma-separated list of host:port pairs to allow
27+
# These endpoints bypass SSRF protection (use for internal services)
28+
# Example: PREDICATE_SSRF_ALLOW=localhost:8080,internal-api:3000
29+
# PREDICATE_SSRF_ALLOW=

examples/real-openclaw-demo/Dockerfile.sidecar

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22
#
33
# Uses Ubuntu 24.04 LTS which has GLIBC 2.39 (required by the sidecar binary).
44
# Downloads the binary from GitHub releases - cached in Docker layers.
5+
#
6+
# CLI Options (v0.7.1+):
7+
# --policy-reload-secret <SECRET> : Require bearer token for /policy/reload
8+
# --disable-policy-reload : Disable /policy/reload endpoint (returns 404)
9+
# --ssrf-allow <HOST:PORT> : Whitelist host:port for SSRF bypass (repeatable)
10+
#
11+
# Environment Variables:
12+
# PREDICATE_POLICY_RELOAD_SECRET : Same as --policy-reload-secret
13+
# LOCAL_IDP_SIGNING_KEY : Key for local JWT signing
514

615
FROM ubuntu:24.04
716

examples/real-openclaw-demo/docker-compose.playground.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@ services:
2626
# =========================================================================
2727
# Predicate Authority Sidecar - Run Time Assurance (RTA) Execution Proxy
2828
# =========================================================================
29+
#
30+
# Security Features (v0.7.1+):
31+
# --policy-reload-secret : Require bearer token for /policy/reload endpoint
32+
# --disable-policy-reload : Disable /policy/reload entirely (returns 404)
33+
# --ssrf-allow : Whitelist specific host:port for SSRF bypass
34+
#
2935
predicate-sidecar:
3036
build:
3137
context: .
@@ -35,6 +41,8 @@ services:
3541
environment:
3642
# Demo signing key (replace in production)
3743
LOCAL_IDP_SIGNING_KEY: "demo-secret-key-replace-in-production-minimum-32-chars"
44+
# Security: Require bearer token for policy reload (v0.7.1+)
45+
PREDICATE_POLICY_RELOAD_SECRET: "${PREDICATE_POLICY_RELOAD_SECRET:-demo-reload-secret}"
3846
volumes:
3947
# Mount policy file (YAML or JSON supported)
4048
- ./policy.yaml:/app/policy.yaml:ro
@@ -47,6 +55,7 @@ services:
4755
--mode local_only
4856
--policy-file /app/policy.yaml
4957
--log-level info
58+
--ssrf-allow predicate-sidecar:8000
5059
run
5160
healthcheck:
5261
test: ["CMD-SHELL", "curl -sf http://localhost:8000/health || exit 1"]

examples/real-openclaw-demo/docker-compose.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ version: "3.8"
33
services:
44
# Predicate Authority Sidecar - Authorization Engine (Rust-based)
55
# Builds from Dockerfile.sidecar which downloads binary from GitHub releases
6+
#
7+
# Security Features (v0.7.1+):
8+
# --policy-reload-secret : Require bearer token for /policy/reload endpoint
9+
# --disable-policy-reload : Disable /policy/reload entirely (returns 404)
10+
# --ssrf-allow : Whitelist specific host:port for SSRF bypass
11+
#
612
sidecar:
713
build:
814
context: .
@@ -11,8 +17,12 @@ services:
1117
- "8787:8787"
1218
environment:
1319
LOCAL_IDP_SIGNING_KEY: "demo-secret-key-replace-in-production-minimum-32-chars"
20+
# Security: Require bearer token for policy reload (v0.7.1+)
21+
PREDICATE_POLICY_RELOAD_SECRET: "${PREDICATE_POLICY_RELOAD_SECRET:-demo-reload-secret}"
1422
volumes:
1523
- ./policy.json:/etc/predicate/policy.json:ro
24+
# Note: Security features are configured via environment variables (v0.7.1+)
25+
# PREDICATE_POLICY_RELOAD_SECRET enforces bearer token auth on /policy/reload
1626
healthcheck:
1727
test: ["CMD-SHELL", "curl -sf http://localhost:8787/health || exit 1"]
1828
interval: 2s

examples/real-openclaw-demo/policy.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,17 @@ metadata:
4646
compliance: ["SOC2", "GDPR"]
4747
default_posture: "deny"
4848

49+
# ============================================================================
50+
# SSRF WHITELIST (v0.7.1+)
51+
# ============================================================================
52+
# Bypass SSRF protection for specific internal services.
53+
# Use sparingly - only for trusted internal endpoints that need direct access.
54+
#
55+
# ssrf_whitelist:
56+
# - "internal-api:3000"
57+
# - "metrics-service:9090"
58+
# - "localhost:8080"
59+
4960
# ============================================================================
5061
# DENY RULES - Explicit blocks (evaluated first, highest priority)
5162
# ============================================================================

0 commit comments

Comments
 (0)