OIDC client secret containing whitespace when read from file #616

Closed
opened 2025-12-29 02:21:14 +01:00 by adam · 0 comments
Owner

Originally created by @danielalvsaaker on GitHub (Jan 23, 2024).

Bug description

OIDC authorization works when client_secret is set inline, but fails when reading the client secret from a file using client_secret_path. When building and debugging locally, it became apparent that the string read from a file is terminated by a line break, which the inline client secret does not have. This causes the access token flow to fail due to an invalid client secret.

Environment

  • OS: NixOS unstable
  • Headscale version: v0.22.3, v0.23.0-alpha3
  • Headscale is behind a (reverse) proxy
  • Headscale runs in a container

To Reproduce

  • Use a Zitadel server as issuer
  • Set Headscale to read client secret from file (client_secret_path config or HEADSCALE_OIDC_CLIENT_SECRET_PATH)
Originally created by @danielalvsaaker on GitHub (Jan 23, 2024). <!-- Before posting a bug report, discuss the behaviour you are expecting with the Discord community to make sure that it is truly a bug. The issue tracker is not the place to ask for support or how to set up Headscale. Bug reports without the sufficient information will be closed. Headscale is a multinational community across the globe. Our language is English. All bug reports needs to be in English. --> ## Bug description OIDC authorization works when `client_secret` is set inline, but fails when reading the client secret from a file using `client_secret_path`. When building and debugging locally, it became apparent that the string read from a file is terminated by a line break, which the inline client secret does not have. This causes the access token flow to fail due to an invalid client secret. <!-- A clear and concise description of what the bug is. Describe the expected bahavior and how it is currently different. If you are unsure if it is a bug, consider discussing it on our Discord server first. --> ## Environment <!-- Please add relevant information about your system. For example: - Version of headscale used - Version of tailscale client - OS (e.g. Linux, Mac, Cygwin, WSL, etc.) and version - Kernel version - The relevant config parameters you used - Log output --> - OS: NixOS unstable - Headscale version: v0.22.3, v0.23.0-alpha3 <!-- We do not support running Headscale in a container nor behind a (reverse) proxy. If either of these are true for your environment, ask the community in Discord instead of filing a bug report. --> - [ ] Headscale is behind a (reverse) proxy - [ ] Headscale runs in a container ## To Reproduce - Use a Zitadel server as issuer - Set Headscale to read client secret from file (client_secret_path config or HEADSCALE_OIDC_CLIENT_SECRET_PATH) <!-- Steps to reproduce the behavior. -->
adam added the bug label 2025-12-29 02:21:14 +01:00
adam closed this issue 2025-12-29 02:21:14 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/headscale#616