-
Notifications
You must be signed in to change notification settings - Fork 99
fix bug #3120
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?
fix bug #3120
Changes from all commits
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 |
|---|---|---|
|
|
@@ -24,14 +24,27 @@ | |
| # | ||
| # Exit 0 = healthy, Exit 1 = unhealthy | ||
|
|
||
| ROUTER_ADMIN_ENABLED="${ROUTER_ADMIN_ENABLED:-false}" | ||
| ROUTER_ADMIN_PORT="${ROUTER_ADMIN_PORT:-9901}" | ||
| ROUTER_HTTP_PORT="${ROUTER_HTTP_PORT:-8080}" | ||
| POLICY_ENGINE_ADMIN_PORT="${POLICY_ENGINE_ADMIN_PORT:-9002}" | ||
|
|
||
| # Check Router (Envoy) readiness — expect HTTP 200 | ||
| ROUTER_STATUS=$(curl -s -o /dev/null -w '%{http_code}' "http://localhost:${ROUTER_ADMIN_PORT}/ready") | ||
| if [ "$ROUTER_STATUS" != "200" ]; then | ||
| echo "Router not ready (HTTP ${ROUTER_STATUS})" | ||
| exit 1 | ||
| # Check Router (Envoy) readiness. | ||
| # The admin interface (/ready) is disabled by default (see docker-entrypoint.sh / | ||
| # ROUTER_ADMIN_ENABLED) — fall back to a raw TCP check against the main listener, | ||
| # which confirms Envoy is up and accepting connections. | ||
| if [ "${ROUTER_ADMIN_ENABLED}" = "true" ]; then | ||
| ROUTER_STATUS=$(curl -s -o /dev/null -w '%{http_code}' "http://localhost:${ROUTER_ADMIN_PORT}/ready") | ||
| if [ "$ROUTER_STATUS" != "200" ]; then | ||
| echo "Router not ready (HTTP ${ROUTER_STATUS})" | ||
| exit 1 | ||
| fi | ||
| else | ||
| if ! (exec 3<>"/dev/tcp/127.0.0.1/${ROUTER_HTTP_PORT}") 2>/dev/null; then | ||
| echo "Router not accepting connections on port ${ROUTER_HTTP_PORT}" | ||
| exit 1 | ||
| fi | ||
|
Comment on lines
+32
to
+46
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. 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "== file header and relevant lines =="
sed -n '1,90p' gateway/gateway-runtime/health-check.sh 2>/dev/null || true
echo
echo "== references to health-check/router ports/admin =="
rg -n "health-check|ROUTER_ADMIN_ENABLED|ROUTER_ADMIN_PORT|ROUTER_HTTP_PORT|readiness|liveness|/dev/tcp|/ready|curl" gateway -S || true
echo
echo "== files mentioning envoy readiness/admin routes =="
rg -n "ready|admin|readiness|Envoy" -S gateway/gateway-runtime gateway 2>/dev/null | head -200 || trueRepository: wso2/api-platform Length of output: 46070 Do not use the HTTP listener connection as a readiness probe.
🤖 Prompt for AI Agents |
||
| exec 3<&- 3>&- 2>/dev/null || true | ||
| fi | ||
|
|
||
| # Check Policy Engine health — expect HTTP 200 | ||
|
|
||
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 | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: wso2/api-platform
Length of output: 35046
🏁 Script executed:
Repository: wso2/api-platform
Length of output: 31399
Security Misconfiguration (CWE-16)
Reachability: Internal
Reachability path
Enforce or accurately document the Router admin bind boundary.
ROUTER_ADMIN_HOSTis documented as loopback-only but is accepted as-is whenROUTER_ADMIN_ENABLED=true; a non-loopback value makes the enabled Envoy admin listener reachable over any network path. Reject non-loopback values before writingadmin.addressin bothgateway/gateway-runtime/docker-entrypoint.shandgateway/gateway-runtime/docker-entrypoint-debug.sh; updategateway/gateway-runtime/docker-entrypoint-debug.sh’s loopback claim accordingly. Do not document Envoy admin inkubernetes/helm/gateway-helm-chart/README.mdas loopback-only unless the entrypoints enforce that boundary.📍 Affects 3 files
gateway/gateway-runtime/docker-entrypoint.sh#L184-L193(this comment)gateway/gateway-runtime/docker-entrypoint-debug.sh#L145-L153kubernetes/helm/gateway-helm-chart/README.md#L168-L168🤖 Prompt for AI Agents