diff --git a/.gitea/workflows/p05-production-contract-dry-run.yml b/.gitea/workflows/p05-production-contract-dry-run.yml new file mode 100644 index 0000000..75ccbef --- /dev/null +++ b/.gitea/workflows/p05-production-contract-dry-run.yml @@ -0,0 +1,32 @@ +name: ZitPlane P05-OIDC-08 Synthetic Production Contract Dry-Run + +# MANUAL ONLY; static security contract, no Docker daemon lifecycle/production. +on: + workflow_dispatch: + +permissions: + contents: read + +jobs: + contract: + name: Static Compose and fail-closed negative contract validation + runs-on: ubuntu-latest + container: node:22-alpine + timeout-minutes: 15 + steps: + - name: Install CI tooling before checkout + run: apk add --no-cache git python3 docker-cli docker-cli-compose + - uses: actions/checkout@v4 + with: + github-server-url: https://dev.ivib.cc + - name: Validate only synthetic Compose config and contract + run: | + set -eu + docker compose -f deployment/production-contract/compose.ci.yaml config --quiet + echo ZITPLANE_P08_COMPOSE_STATIC_CONFIG_PASS + docker compose -f deployment/production-contract/compose.ci.yaml config --format json | python3 tests/ci/production_contract/validate.py --compose-json-stdin + - name: Verify zero Docker resource actions configured + if: always() + run: | + set -eu + python3 tests/ci/production_contract/validate.py --workflow-safety diff --git a/deployment/production-contract/compose.ci.yaml b/deployment/production-contract/compose.ci.yaml new file mode 100644 index 0000000..930c0b0 --- /dev/null +++ b/deployment/production-contract/compose.ci.yaml @@ -0,0 +1,86 @@ +# P05-OIDC-08 CI synthetic, NOT DEPLOYABLE; never use compose up/build/run/pull. +# .invalid images, zero replicas, private network, unresolved placeholder refs. +name: zitplane-oidc-08-ci-do-not-deploy + +services: + ingress-policy: + image: synthetic.invalid/zitplane/ingress:never-deploy + deploy: + replicas: 0 + networks: [isolated] + environment: + CONTRACT_PUBLIC_ISSUER: "https://auth.vib.tools" + CONTRACT_ACCOUNT_ORIGIN: "https://account.vib.tools" + CONTRACT_TLS_MODE: "external-https-only" + CONTRACT_FORWARD_POLICY: "strip-and-replace" + + zitadel-api: + image: synthetic.invalid/zitplane/zitadel-api:never-deploy + deploy: + replicas: 0 + networks: [isolated] + environment: + CONTRACT_ISSUER: "https://auth.vib.tools" + CONTRACT_BACKEND_UPSTREAM: "h2c" + CONTRACT_MASTERKEY_FILE: "/run/secrets/zitadel_masterkey" + CONTRACT_POSTGRES_PASSWORD_FILE: "/run/secrets/postgres_password" + secrets: [zitadel_masterkey, postgres_password] + + zitadel-login: + image: synthetic.invalid/zitplane/login:never-deploy + deploy: + replicas: 0 + networks: [isolated] + environment: + CONTRACT_LOGIN_BASE_PATH: "/ui/v2/login" + CONTRACT_ZITADEL_API: "zitadel-api:8080" + CONTRACT_LOGIN_CLIENT_PAT_FILE: "/run/secrets/login_client_pat" + CONTRACT_LOGIN_COOKIE_SECRET_FILE: "/run/secrets/login_cookie_secret" + secrets: [login_client_pat, login_cookie_secret] + + account: + image: synthetic.invalid/zitplane/account:never-deploy + deploy: + replicas: 0 + networks: [isolated] + environment: + CONTRACT_ISSUER: "https://auth.vib.tools" + CONTRACT_ORIGIN: "https://account.vib.tools" + CONTRACT_CALLBACK: "https://account.vib.tools/api/auth/callback/zitadel" + CONTRACT_OIDC_CLIENT_SECRET_FILE: "/run/secrets/account_client_secret" + CONTRACT_AUTH_SECRET_FILE: "/run/secrets/account_auth_secret" + secrets: [account_client_secret, account_auth_secret] + + postgres: + image: synthetic.invalid/zitplane/postgres:never-deploy + deploy: + replicas: 0 + networks: [isolated] + environment: + CONTRACT_POSTGRES_PASSWORD_FILE: "/run/secrets/postgres_password" + secrets: [postgres_password] + +networks: + isolated: + internal: true + +# Name-only CI placeholders. docker compose config never looks up external values. +secrets: + zitadel_masterkey: + external: true + name: ci-only-placeholder-zitadel-masterkey + postgres_password: + external: true + name: ci-only-placeholder-postgres-password + login_client_pat: + external: true + name: ci-only-placeholder-login-client-pat + login_cookie_secret: + external: true + name: ci-only-placeholder-login-cookie-secret + account_client_secret: + external: true + name: ci-only-placeholder-account-client-secret + account_auth_secret: + external: true + name: ci-only-placeholder-account-auth-secret diff --git a/deployment/production-contract/routing-policy.json b/deployment/production-contract/routing-policy.json new file mode 100644 index 0000000..b02a0d4 --- /dev/null +++ b/deployment/production-contract/routing-policy.json @@ -0,0 +1,77 @@ +{ + "schema": "zitplane.synthetic-production-contract.v1", + "status": "CI_ONLY_NOT_DEPLOYABLE", + "issuer": "https://auth.vib.tools", + "account_origin": "https://account.vib.tools", + "callback": "https://account.vib.tools/api/auth/callback/zitadel", + "allowed_redirect_uris": [ + "https://account.vib.tools/api/auth/callback/zitadel" + ], + "allowed_post_logout_uris": [ + "https://account.vib.tools/signin" + ], + "oidc": { + "response_type": "code", + "pkce": "S256", + "state_required": true, + "nonce_required": true, + "client_type": "confidential" + }, + "routes": [ + { + "host": "auth.vib.tools", + "path_prefix": "/ui/v2/login", + "target": "zitadel-login", + "port": 3000, + "protocol": "http1" + }, + { + "host": "auth.vib.tools", + "path_prefix": "/ui/console", + "target": "zitadel-api", + "port": 8080, + "protocol": "h2c" + }, + { + "host": "auth.vib.tools", + "path_prefix": "/", + "target": "zitadel-api", + "port": 8080, + "protocol": "h2c" + }, + { + "host": "account.vib.tools", + "path_prefix": "/", + "target": "account", + "port": 3000, + "protocol": "http1" + } + ], + "edge": { + "tls_required": true, + "tls_termination": "external-only", + "expected_public_listener": "443/tcp (design only; not published by CI)", + "allowed_hosts": [ + "auth.vib.tools", + "account.vib.tools" + ], + "unknown_host": "reject", + "trusted_forwarding_source": "ingress-policy-only", + "forwarded_headers": { + "Forwarded": "strip-and-replace", + "X-Forwarded-Host": "strip-and-replace", + "X-Forwarded-Proto": "strip-and-replace", + "X-Forwarded-For": "strip-and-replace" + }, + "no_public_backend_ports": true, + "no_privileged_docker_access": true + }, + "required_secret_references": [ + "zitadel_masterkey", + "postgres_password", + "login_client_pat", + "login_cookie_secret", + "account_client_secret", + "account_auth_secret" + ] +}