-
Notifications
You must be signed in to change notification settings - Fork 107
gateway-controller: give xDS mTLS its own dedicated port, off by default #3426
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
11cdb96
887df4c
a144d5b
e980adb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,6 +27,12 @@ services: | |
| - "9090:9090" # REST API | ||
| - "9094:9092" # Admin API | ||
| - "9011:9091" # Metrics | ||
| environment: | ||
| # Enabled by default: mTLS on server.xds_tls (serves Envoy) and | ||
| # policy_server.tls (serves the Policy Engine) -- see configs/ | ||
| # config.toml, which reads this same var. Set to "false" here (and in | ||
| # gateway-runtime's environment below) to fall back to plaintext xDS. | ||
| - XDS_TLS_ENABLED=true | ||
| env_file: | ||
| - path: api-platform.env | ||
| required: true | ||
|
|
@@ -35,7 +41,8 @@ services: | |
| - controller-data:/app/data | ||
| - ./configs/config.toml:/etc/gateway-controller/config.toml:ro | ||
| - ./resources/certificates:/app/certificates | ||
| - ./resources/listener-certs:/app/listener-certs:ro | ||
| - ./resources/listener-certs:/app/listener-certs:ro # Read-only: HTTPS listener certificate (generated by scripts/setup.sh) | ||
| - ./resources/listener-certs:/app/xds-certs:ro # Read-only: mTLS server certs for server.xds_tls / policy_server.tls (generated by scripts/setup.sh) | ||
| - ./resources/aesgcm-keys/default-aesgcm256-v1.bin:/app/data/aesgcm-keys/default-aesgcm256-v1.bin:ro | ||
| extra_hosts: | ||
| - "host.docker.internal:host-gateway" | ||
|
|
@@ -66,9 +73,22 @@ services: | |
| # Envoy admin is disabled by default in the image; enabled here for local | ||
| # dev convenience since the port is already mapped to the host above. | ||
| - ROUTER_ADMIN_ENABLED=true | ||
| # Enabled by default, matching gateway-controller above. Client | ||
| # cert/key paths for mutual TLS to gateway-controller's xDS servers | ||
| # (server.xds_tls / policy_server.tls) -- Envoy and the policy-engine | ||
| # present distinct client identities, so each leg gets its own | ||
| # cert/key. | ||
| - XDS_TLS_ENABLED=true | ||
| - XDS_CLIENT_CERT_PATH=/etc/xds-certs/envoy-client.crt | ||
| - XDS_CLIENT_KEY_PATH=/etc/xds-certs/envoy-client.key | ||
| - XDS_CLIENT_CA_PATH=/etc/xds-certs/ca.crt | ||
| - POLICY_ENGINE_XDS_CLIENT_CERT_PATH=/etc/xds-certs/policy-engine-client.crt | ||
| - POLICY_ENGINE_XDS_CLIENT_KEY_PATH=/etc/xds-certs/policy-engine-client.key | ||
| - POLICY_ENGINE_XDS_CLIENT_CA_PATH=/etc/xds-certs/ca.crt | ||
| volumes: | ||
| - ./configs/config.toml:/etc/policy-engine/config.toml:ro | ||
| - ./configs/llm-pricing/model_prices.json:/etc/policy-engine/llm-pricing/model_prices.json:ro | ||
| - ./resources/listener-certs:/etc/xds-certs:ro # Read-only: mTLS client certs for Envoy + policy-engine xDS connections | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔒 Security & Privacy | 🛡️ Analyzed with Security Review | 🟠 Major | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/bin/bash
printf '%s\n' '--- compose context ---'
sed -n '70,100p' gateway/distribution/docker-compose.yaml
printf '%s\n' '--- README certificate documentation ---'
sed -n '50,75p' gateway/distribution/README.md
printf '%s\n' '--- certificate references in gateway distribution ---'
rg -n --glob '!node_modules' --glob '!dist' 'listener-certs|ca\.key|server\.key|envoy-client|policy-engine-client' gateway/distribution gateway/gateway-runtimeRepository: wso2/api-platform Length of output: 4457 🤖 get_repo_knowledge executed:
Length of output: 47695 Sensitive Data Exposure Exploitability: Difficult Mount only the runtime client credentials. The setup creates 🤖 Prompt for AI Agents |
||
| networks: | ||
| - gateway-network | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,10 +25,16 @@ services: | |
| ports: | ||
| - "9090:9090" # REST API | ||
| - "9094:9092" # Admin API | ||
| - "18000:18000" # xDS gRPC (Router) | ||
| - "18001:18001" # xDS gRPC (Policy Engine) | ||
| - "18443:18443" # xDS gRPC mTLS (Router) -- 18000 stops listening once XDS_TLS_ENABLED=true (default) | ||
| - "18444:18444" # xDS gRPC mTLS (Policy Engine) -- 18001 stops listening once XDS_TLS_ENABLED=true (default) | ||
| - "9011:9091" # Metrics | ||
| - "2345:2345" # dlv remote debug port | ||
| environment: | ||
| # Enabled by default: mTLS on server.xds_tls (serves Envoy) and | ||
| # policy_server.tls (serves the Policy Engine) -- see configs/ | ||
| # config.toml, which reads this same var. Set to "false" here (and in | ||
| # gateway-runtime's environment below) to fall back to plaintext xDS. | ||
| - XDS_TLS_ENABLED=true | ||
| env_file: | ||
| - path: api-platform.env | ||
| required: true | ||
|
|
@@ -37,7 +43,8 @@ services: | |
| - controller-data:/app/data | ||
| - ./configs/config.toml:/etc/gateway-controller/config.toml:ro | ||
| - ./gateway-controller/certificates:/app/certificates | ||
| - ./gateway-controller/listener-certs:/app/listener-certs:ro | ||
| - ./gateway-controller/listener-certs:/app/listener-certs:ro # Read-only: HTTPS listener certificate (generated by scripts/setup.sh) | ||
| - ./gateway-controller/listener-certs:/app/xds-certs:ro # Read-only: mTLS server certs for server.xds_tls / policy_server.tls (generated by scripts/setup.sh) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔒 Security & Privacy | 🛡️ Analyzed with Security Review | 🟠 Major | 🏗️ Heavy lift 🧩 Analysis chain🤖 get_repo_knowledge executed:
Length of output: 47547 🏁 Script executed: #!/bin/bash
set -eu
printf '%s\n' '--- compose mounts ---'
rg -n -C 4 'listener-certs|xds-certs|ca\.key|server\.key|client.*(key|crt)|\.crt' \
gateway/docker-compose.debug.yaml gateway/docker-compose.yaml \
gateway/it/docker-compose.test.postgres.yaml gateway/it/docker-compose.test.sqlserver.yaml \
gateway/it/docker-compose.test.vhosts-multi.yaml gateway/it/docker-compose.test.vhosts-single.yaml \
gateway/it/docker-compose.test.yaml
printf '%s\n' '--- certificate generation and configuration references ---'
rg -n -C 3 'listener-certs|ca\.key|server\.key|client.*key|xds_tls|policy_server\.tls|tls_cert|tls_key|trusted_ca' \
gateway --glob '!docker-compose*.yaml' --glob '!*.log' | head -n 500Repository: wso2/api-platform Length of output: 50373 🏁 Script executed: #!/bin/bash
set -eu
printf '%s\n' '--- compose mounts ---'
rg -n -C 4 'listener-certs|xds-certs|ca\.key|server\.key|client.*(key|crt)|\.crt' gateway/docker-compose.debug.yaml gateway/docker-compose.yaml gateway/it/docker-compose.test.postgres.yaml gateway/it/docker-compose.test.sqlserver.yaml gateway/it/docker-compose.test.vhosts-multi.yaml gateway/it/docker-compose.test.vhosts-single.yaml gateway/it/docker-compose.test.yaml
printf '%s\n' '--- certificate generation and configuration references ---'
rg -n -C 3 'listener-certs|ca\.key|server\.key|client.*key|xds_tls|policy_server\.tls|tls_cert|tls_key|trusted_ca' gateway --glob '!docker-compose*.yaml' --glob '!*.log' | head -n 500Repository: wso2/api-platform Length of output: 50373 🏁 Script executed: #!/bin/bash
set -eu
sed -n '1,115p' gateway/docker-compose.debug.yaml
printf '\n--- standard compose ---\n'
sed -n '1,120p' gateway/docker-compose.yaml
printf '\n--- generated/declared certificate names ---\n'
rg -n 'listener-certs|ca\.key|server\.key|client.*\.(key|crt)|xds_tls|policy_server\.tls' gateway/scripts gateway/config gateway 2>/dev/null | head -n 400Repository: wso2/api-platform Length of output: 46134 🏁 Script executed: #!/bin/bash
set -eu
printf '%s\n' '--- exact TLS paths and defaults ---'
sed -n '1,75p' gateway/configs/config.toml
sed -n '1065,1120p' gateway/gateway-controller/pkg/config/config.go
sed -n '1268,1290p' gateway/gateway-controller/pkg/config/config.go
printf '%s\n' '--- all listener-certs directory mounts ---'
rg -n 'listener-certs:/|resources/listener-certs:/|/app/certs|/etc/nginx/certs' gateway --glob 'docker-compose*.yaml'
printf '%s\n' '--- consumers of non-xDS certificate mounts ---'
rg -n -C 3 'default-listener|/app/certs|/etc/nginx/certs|ssl_certificate|ssl_certificate_key' gateway/it gateway --glob '!docker-compose*.yaml' --glob '*.conf' --glob '*.yaml' --glob '*.toml' | head -n 300Repository: wso2/api-platform Length of output: 28562 Sensitive Data Exposure Reachability: Internal Restrict every certificate mount to the files required by its service. The xDS controller requires only 📍 Affects 7 files
🤖 Prompt for AI AgentsSource: Coding guidelines |
||
| - ./gateway-controller/aesgcm-keys/default-aesgcm256-v1.bin:/app/data/aesgcm-keys/default-aesgcm256-v1.bin:ro # AES-256 at-rest encryption key (generated by scripts/setup.sh) | ||
| extra_hosts: | ||
| - "host.docker.internal:host-gateway" | ||
|
|
@@ -73,8 +80,19 @@ services: | |
| # Envoy admin is disabled by default in the image; enabled here for local | ||
| # dev convenience since the port is already mapped to the host above. | ||
| - ROUTER_ADMIN_ENABLED=true | ||
| # Enabled by default, matching gateway-controller above -- see | ||
| # docker-compose.yaml's gateway-runtime service for the full | ||
| # explanation of these vars. | ||
| - XDS_TLS_ENABLED=true | ||
| - XDS_CLIENT_CERT_PATH=/etc/xds-certs/envoy-client.crt | ||
| - XDS_CLIENT_KEY_PATH=/etc/xds-certs/envoy-client.key | ||
| - XDS_CLIENT_CA_PATH=/etc/xds-certs/ca.crt | ||
| - POLICY_ENGINE_XDS_CLIENT_CERT_PATH=/etc/xds-certs/policy-engine-client.crt | ||
| - POLICY_ENGINE_XDS_CLIENT_KEY_PATH=/etc/xds-certs/policy-engine-client.key | ||
| - POLICY_ENGINE_XDS_CLIENT_CA_PATH=/etc/xds-certs/ca.crt | ||
| volumes: | ||
| - ./configs/config.toml:/etc/policy-engine/config.toml:ro | ||
| - ./gateway-controller/listener-certs:/etc/xds-certs:ro # Read-only: mTLS client certs for Envoy + policy-engine xDS connections | ||
| networks: | ||
| - gateway-network | ||
| cap_add: | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔒 Security & Privacy | 🛡️ Analyzed with Security Review | 🔴 Critical | ⚡ Quick win
🧩 Analysis chain
🤖 get_repo_knowledge executed:
get_repo_knowledge wso2/api-platform /tmp/coderabbit-repo-knowledge/wso2-api-platform-09bf967f/conventions /tmp/coderabbit-repo-knowledge/wso2-api-platform-09bf967f/learningsLength of output: 47547
🏁 Script executed:
Repository: wso2/api-platform
Length of output: 39041
🏁 Script executed:
Repository: wso2/api-platform
Length of output: 5418
Sensitive Data Exposure
Reachability: External
Exploitability: Moderate
CWE: CWE-321
Do not commit shared xDS credentials. xDS TLS is enabled by default, and the repository tracks the xDS CA, server, and client private keys. The setup scripts retain these files when present, so source-based installations reuse the same credentials. Remove the tracked key material and generate fresh credentials when an installation has no existing credentials.
📍 Affects 4 files
gateway/configs/config.toml#L26-L26(this comment)gateway/gateway-controller/listener-certs/server.key#L1-L5gateway/scripts/setup.ps1#L340-L348gateway/scripts/setup.sh#L185-L195🤖 Prompt for AI Agents
Source: Coding guidelines