feat: pass tunnel token via Kubernetes Secret instead of command args#270
feat: pass tunnel token via Kubernetes Secret instead of command args#270
Conversation
Store the Cloudflare tunnel token in a Kubernetes Secret (controlled-cloudflared-token) and inject it into cloudflared pods via the TUNNEL_TOKEN environment variable, instead of passing it as a --token command-line argument. This prevents the token from being easily readable in pod specs and process listings. Closes #136
|
Claude finished @STRRL's task —— View job Code Review: Security Enhancement - Tunnel Token via Kubernetes Secret ✅This PR successfully implements a significant security improvement by moving tunnel tokens from command-line arguments to Kubernetes Secrets. Here's my comprehensive review: ✅ Excellent Security Improvements
✅ Code Quality & Best PracticesWell-Structured Implementation:
Robust Update Logic:
✅ Excellent Test CoverageComprehensive Integration Tests:
Good Unit Test Coverage:
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #270 +/- ##
==========================================
+ Coverage 47.08% 49.53% +2.44%
==========================================
Files 11 11
Lines 703 749 +46
==========================================
+ Hits 331 371 +40
- Misses 349 352 +3
- Partials 23 26 +3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Collect pod logs, describe output, events, secrets, and deployment status from the controller namespace after e2e tests run (pass or fail). Files are saved under test/e2e/artifacts/logs/ and uploaded as part of the existing artifact step.
The RoleBinding for controlled-cloudflared-connector was referencing kind: ClusterRole, but the resource is a Role. This caused the secrets permissions (needed for the tunnel token secret) to never be applied, preventing the controller from creating the secret and thus the cloudflared deployment.
Summary
controlled-cloudflared-token) instead of passing it as a--tokencommand-line argument to cloudflaredTUNNEL_TOKENenvironment variable, which cloudflared reads nativelyThis prevents the tunnel token from being easily readable in pod specs, deployment manifests, and process listings.
Closes #136
Test plan
make unit-test)make integration-test) — 14/14 specs passTUNNEL_TOKENenv var references the secret and--tokenis NOT in command args