Apply these rules whenever implementing auth, tokens, or security-modes:
1) Never leak tokens/secrets
2) Never put credentials in URLs
...&u=USERNAME&p=PASSWORD (or equivalent) because URLs are commonly logged by shells, proxies, and load balancers.3) Apply authentication in the correct direction (inbound vs outbound)
Authorization: Bearer <token> on the HTTP client used for the upstream requests.4) Enforce security mode via strict allowlists
Example (header auth + no token echo):
TOKEN="..."
curl -sS "https://localhost:8181/api/v3/query_sql?db=DATABASE_NAME&q=SELECT+*+FROM+TABLE_NAME+LIMIT+10" \
-H "Authorization: Bearer $TOKEN" \
-H "Accept: application/json"
# Do NOT: echo "$TOKEN" or pass it as a URL query parameter.
Example (read-only enforcement idea):
SELECT, WITH (CTEs that contain no write operations), SHOW, DESCRIBE/DESC, EXPLAIN, ANALYZE.