Make the API token fully optional
The deploy job hard-failed without CRYPTO_API_TOKEN, and /api/ws (which skips Basic auth) relied on that token. Drop the requirement: the app now works with no token at all, matching the backend guard that was always a no-op when unset. When a token is configured it still protects /api and /api/ws; when it is not, /api/ws is as open as the rest of the API, which the Traefik Basic auth still guards for everything else. Adds tests for the tokenless API and WebSocket.
This commit is contained in:
1 parent
ba7a69c1ce
commit
2a88f55689
7 files changed
+46
-21
No files matched your search
@@ -147,13 +147,13 @@ jobs:
|
||||
echo "::error::CRYPTO_FRONTEND_AUTH_USERS is not set (repo/org variable or secret); refusing to deploy"
|
||||
exit 1
|
||||
fi
|
||||
# /api/ws bypasses Basic auth (browsers don't reliably replay
|
||||
# credentials on a WebSocket upgrade) and relies on the API token
|
||||
# instead. Refuse to ship if that token is missing, or the live feed
|
||||
# would be unauthenticated.
|
||||
# CRYPTO_API_TOKEN is optional. When unset, the API and the /api/ws
|
||||
# live feed are unauthenticated beyond the Traefik Basic auth that
|
||||
# still guards everything except /api/ws. Set it to require a bearer
|
||||
# token on /api (nginx injects it server-side, so the browser never
|
||||
# sees it).
|
||||
if [ -z "$CRYPTO_API_TOKEN" ]; then
|
||||
echo "::error::CRYPTO_API_TOKEN must be set because /api/ws skips Basic auth; refusing to deploy"
|
||||
exit 1
|
||||
echo "Note: CRYPTO_API_TOKEN is not set; /api and /api/ws will not require a bearer token."
|
||||
fi
|
||||
|
||||
- name: Log in to Docker Hub (optional)
|
||||
|
||||
Reference in new issue
Block a user