Skip to content

fix(runner/loki): send basic auth on the compat query path - #524

Open
mayankpande88 wants to merge 2 commits into
mainfrom
fix/runner-loki-compat-auth
Open

fix(runner/loki): send basic auth on the compat query path#524
mayankpande88 wants to merge 2 commits into
mainfrom
fix/runner-loki-compat-auth

Conversation

@mayankpande88

Copy link
Copy Markdown
Contributor

The compat handlers (query_loki / query_loki_labels /
query_grafana_loki_label_values / query_grafana_loki_series) build
their request in rawGet, which copied only ExtraHeaders and ignored the
LOKI_USERNAME / LOKI_PASSWORD basic-auth credentials set on the client.
Any basic-auth-protected Loki returned 401 for these actions, even
though the primitive loki_* handlers authenticated correctly.

Apply SetBasicAuth in rawGet when both username and password are set,
mirroring the primitive loki.Client.get path.

Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_01L2HAXQH1gEtX7h4sUJsi9j

The compat handlers (query_loki / query_loki_labels /
query_grafana_loki_label_values / query_grafana_loki_series) build
their request in rawGet, which copied only ExtraHeaders and ignored the
LOKI_USERNAME / LOKI_PASSWORD basic-auth credentials set on the client.
Any basic-auth-protected Loki returned 401 for these actions, even
though the primitive loki_* handlers authenticated correctly.

Apply SetBasicAuth in rawGet when both username and password are set,
mirroring the primitive loki.Client.get path.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L2HAXQH1gEtX7h4sUJsi9j
@mayankpande88
mayankpande88 requested a review from a team as a code owner July 14, 2026 19:28

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds support for Basic Authentication in the Loki compatibility layer (LokiCompat.rawGet) by setting the credentials on the outgoing HTTP request when both username and password are provided. It also introduces comprehensive unit tests to verify that basic auth headers are correctly applied when credentials are set, and omitted when they are incomplete. No review comments were provided, and I have no additional feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants