Skip to content

API token accepted via URL query parameter (?token=) is logged by proxies #316

Description

@ThiagoBauken

Summary

authalice accepts the API token from the URL query string as a fallback. Query strings are routinely captured by reverse-proxy/access logs, browser history, and Referer headers — leaking long-lived credentials.

Details

// handlers.go:156-158
token := r.Header.Get("token")
if token == "" {
    token = strings.Join(r.URL.Query()["token"], "")
}

Any call made as ...?token=<secret> records the token in plaintext in nginx/Caddy/Traefik access logs, etc.

Proposed fix

Deprecate query-string auth. Removing it outright would break integrations that can't set headers, so suggest a transition:

  • log a deprecation warning when a token arrives via query, document header-only usage, then remove in a later release; or
  • if a credential must be URL-passable, issue a separate short-lived token instead of the long-lived API token.

Location

  • handlers.go:156-158

Happy to PR whichever path you prefer.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions