|
| 1 | +# SPDX-License-Identifier: MPL-2.0 |
| 2 | +# |
| 3 | +# Svalinn gatekeeper policy for {{PROJECT_NAME}} |
| 4 | +# |
| 5 | +# Controls which operations are permitted through the edge gateway. |
| 6 | +# This template provides moderate security defaults — not wide-open test |
| 7 | +# mode, but not production-hardened either. Tighten the values below |
| 8 | +# before deploying to production. |
| 9 | +# |
| 10 | +# See: stapeln/container-stack/svalinn/ |
| 11 | + |
| 12 | +version: "1.0" |
| 13 | + |
| 14 | +# ============================================================================ |
| 15 | +# Authentication |
| 16 | +# ============================================================================ |
| 17 | +# |
| 18 | +# Define which endpoints require authentication and at what level. |
| 19 | + |
| 20 | +auth: |
| 21 | + # Public endpoints — no authentication required. |
| 22 | + # Health and readiness probes must always be public so that |
| 23 | + # orchestrators (selur, Podman, k8s) can check service status. |
| 24 | + public: |
| 25 | + - path: "/health" |
| 26 | + methods: ["GET"] |
| 27 | + - path: "/ready" |
| 28 | + methods: ["GET"] |
| 29 | + - path: "/metrics" |
| 30 | + methods: ["GET"] |
| 31 | + |
| 32 | + # Endpoints requiring JWT or OAuth2 authentication. |
| 33 | + # Svalinn validates the token before forwarding the request. |
| 34 | + authenticated: |
| 35 | + - path: "/api/v1/*" |
| 36 | + methods: ["GET", "POST", "PUT", "DELETE"] |
| 37 | + |
| 38 | +# ============================================================================ |
| 39 | +# Rate Limiting |
| 40 | +# ============================================================================ |
| 41 | +# |
| 42 | +# Protects backend services from overload. Values here are moderate |
| 43 | +# defaults — adjust based on your service capacity. |
| 44 | + |
| 45 | +rate_limits: |
| 46 | + # Global limit: applied to all authenticated clients. |
| 47 | + global: |
| 48 | + requests_per_second: 500 |
| 49 | + burst: 1000 |
| 50 | + |
| 51 | + # Write operations: stricter limit to protect data stores. |
| 52 | + writes: |
| 53 | + paths: ["/api/v1/*"] |
| 54 | + methods: ["POST", "PUT", "DELETE"] |
| 55 | + requests_per_second: 100 |
| 56 | + burst: 200 |
| 57 | + |
| 58 | +# ============================================================================ |
| 59 | +# Container Trust |
| 60 | +# ============================================================================ |
| 61 | +# |
| 62 | +# Svalinn verifies that all .ctp bundles in the stack are signed by |
| 63 | +# trusted keys and carry the required attestations. |
| 64 | + |
| 65 | +trust: |
| 66 | + # Only accept .ctp bundles signed by these keys. |
| 67 | + trusted_signers: |
| 68 | + - key_id: "{{SERVICE_NAME}}-release" |
| 69 | + algorithm: "Ed25519" |
| 70 | + public_key_file: "/etc/svalinn/keys/{{SERVICE_NAME}}-release.pub" |
| 71 | + |
| 72 | + # Require these attestations on all .ctp bundles. |
| 73 | + required_attestations: |
| 74 | + - "source-signature" |
| 75 | + - "sbom-complete" |
| 76 | + |
| 77 | + # Reject unsigned or untrusted images. |
| 78 | + reject_unsigned: true |
| 79 | + |
| 80 | +# ============================================================================ |
| 81 | +# Request Validation |
| 82 | +# ============================================================================ |
| 83 | +# |
| 84 | +# Input validation at the gateway layer — catches malformed requests |
| 85 | +# before they reach the application. |
| 86 | + |
| 87 | +validation: |
| 88 | + # Maximum request body size. |
| 89 | + max_body_size: "8MB" |
| 90 | + |
| 91 | + # Reject requests with NaN or Infinity in numeric fields. |
| 92 | + reject_nan_inf: true |
| 93 | + |
| 94 | + # Maximum result limit per list/search query. |
| 95 | + max_result_limit: 500 |
| 96 | + |
| 97 | +# ============================================================================ |
| 98 | +# CORS |
| 99 | +# ============================================================================ |
| 100 | +# |
| 101 | +# Cross-Origin Resource Sharing policy. The defaults below allow all |
| 102 | +# origins — restrict to your frontend domain(s) in production. |
| 103 | + |
| 104 | +cors: |
| 105 | + allow_origins: ["*"] |
| 106 | + allow_methods: ["GET", "POST", "PUT", "DELETE", "OPTIONS"] |
| 107 | + allow_headers: ["Content-Type", "Authorization"] |
| 108 | + max_age: 3600 |
| 109 | + |
| 110 | +# ============================================================================ |
| 111 | +# Logging |
| 112 | +# ============================================================================ |
| 113 | +# |
| 114 | +# Structured logging for svalinn itself. Audit paths log all requests |
| 115 | +# (including body hashes) for post-incident investigation. |
| 116 | + |
| 117 | +logging: |
| 118 | + format: "json" |
| 119 | + level: "info" |
| 120 | + # Log all write operations for audit trail. |
| 121 | + audit_paths: |
| 122 | + - "/api/v1/*" |
0 commit comments