Skip to content

Commit 5a2b521

Browse files
authored
Prefer KERNEL_INSTANCE_JWT in browser images (#226)
## Summary - switch the public browser image runtime over to `KERNEL_INSTANCE_JWT` as the only token contract - update Envoy bootstrap rendering and the kernel-images API startup path to assume the generic instance JWT is already present - remove all `XDS_JWT` references from the public image repo ## Test plan - `bash -n shared/envoy/init-envoy.sh` <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > Changes the JWT env var contract used to authenticate Envoy xDS requests; deployments still providing `XDS_JWT` will fail Envoy init until updated. Scope is limited to bootstrap templating and startup checks, with no behavioral changes beyond token source. > > **Overview** > Switches Envoy xDS authentication in the browser image runtime from `XDS_JWT` to `KERNEL_INSTANCE_JWT`. > > Updates `shared/envoy/bootstrap.yaml` to send `authorization: Bearer {KERNEL_INSTANCE_JWT}`, and adjusts `shared/envoy/init-envoy.sh` to require this env var, map it through a single `INSTANCE_JWT`, and render the template using the new placeholder (including updated logging). > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 2f18d3e. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY -->
1 parent 92fdcbd commit 5a2b521

2 files changed

Lines changed: 11 additions & 6 deletions

File tree

shared/envoy/bootstrap.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Envoy bootstrap configuration for xDS-managed proxy
22
# This config connects to a control plane for dynamic configuration management
3-
# Requires: INST_NAME, METRO_NAME, XDS_SERVER, XDS_JWT environment variables
3+
# Requires: INST_NAME, METRO_NAME, XDS_SERVER, and KERNEL_INSTANCE_JWT
4+
# environment variables
45

56
# Node identity sent to xDS server for configuration targeting, authenticated by JWT
67
node:
@@ -21,7 +22,7 @@ dynamic_resources:
2122
# Send JWT authentication for all xDS requests
2223
initial_metadata:
2324
- key: "authorization"
24-
value: "Bearer {XDS_JWT}"
25+
value: "Bearer {KERNEL_INSTANCE_JWT}"
2526

2627
# Listener Discovery Service and Cluster Discovery Service use ADS
2728
lds_config:

shared/envoy/init-envoy.sh

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,12 @@
22

33
set -o pipefail -o errexit -o nounset
44

5+
# The browser instance JWT is the sole token contract for xDS and host-local
6+
# services in the image runtime.
7+
INSTANCE_JWT="${KERNEL_INSTANCE_JWT:-}"
8+
59
# Check for required environment variables, to see if envoy is enabled
6-
if [[ -z "${INST_NAME:-}" || -z "${METRO_NAME:-}" || -z "${XDS_SERVER:-}" || -z "${XDS_JWT:-}" ]]; then
10+
if [[ -z "${INST_NAME:-}" || -z "${METRO_NAME:-}" || -z "${XDS_SERVER:-}" || -z "${INSTANCE_JWT:-}" ]]; then
711
echo "[envoy-init] Required environment variables not set. Skipping Envoy initialization."
812
exit 0
913
fi
@@ -55,15 +59,15 @@ else
5559
fi
5660

5761
# Render template with provided environment variables
58-
echo "[envoy-init] Rendering template with INST_NAME=${INST_NAME}, METRO_NAME=${METRO_NAME}, XDS_SERVER=${XDS_SERVER}, XDS_JWT=***"
62+
echo "[envoy-init] Rendering template with INST_NAME=${INST_NAME}, METRO_NAME=${METRO_NAME}, XDS_SERVER=${XDS_SERVER}, KERNEL_INSTANCE_JWT=***"
5963
inst_esc=$(printf '%s' "$INST_NAME" | sed -e 's/[\/&]/\\&/g')
6064
metro_esc=$(printf '%s' "$METRO_NAME" | sed -e 's/[\/&]/\\&/g')
6165
xds_esc=$(printf '%s' "$XDS_SERVER" | sed -e 's/[\/&]/\\&/g')
62-
jwt_esc=$(printf '%s' "$XDS_JWT" | sed -e 's/[\/&]/\\&/g')
66+
jwt_esc=$(printf '%s' "$INSTANCE_JWT" | sed -e 's/[\/&]/\\&/g')
6367
sed -e "s|{INST_NAME}|$inst_esc|g" \
6468
-e "s|{METRO_NAME}|$metro_esc|g" \
6569
-e "s|{XDS_SERVER}|$xds_esc|g" \
66-
-e "s|{XDS_JWT}|$jwt_esc|g" \
70+
-e "s|{KERNEL_INSTANCE_JWT}|$jwt_esc|g" \
6771
/etc/envoy/templates/bootstrap.yaml > /etc/envoy/bootstrap.yaml
6872

6973
echo "[envoy-init] Starting Envoy via supervisord"

0 commit comments

Comments
 (0)