Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add http basic auth for receive #8012

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

sergeylanzman
Copy link

  • I added CHANGELOG entry for this change.

Changes

  • Added two new flags: --receive.basic-auth-username and --receive.basic-auth-password to configure HTTP Basic Auth for the /api/v1/receive endpoint.
  • Implemented middleware that checks the provided username and password against the configured values before processing incoming write requests.
  • When both the username and password are set, Basic Auth is enforced. If not set, the endpoint remains open as before.
  • Added logging statements to indicate whether Basic Auth is enabled or disabled at startup.

Verification

  • Manually tested by running Thanos Receiver locally with different configurations:
    • Without setting username/password, verified that requests are accepted without authentication.
    • With username/password set, verified that requests fail with 401 Unauthorized if credentials are not provided.
    • With valid credentials, verified that requests are processed successfully.
  • No regressions were observed in existing functionality.

@sergeylanzman sergeylanzman force-pushed the add-http-basic-auth-receive branch 2 times, most recently from cf2b493 to 7f8d6e5 Compare December 20, 2024 07:05
@sergeylanzman sergeylanzman force-pushed the add-http-basic-auth-receive branch from 7f8d6e5 to e574c6a Compare December 20, 2024 07:07
@MichaHoffmann
Copy link
Contributor

I don't think this should go into thanos itself. Maybe some system build on top of thanos can enforce authentication.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants