-
Notifications
You must be signed in to change notification settings - Fork 1.1k
fix(provider): loki auth #5162
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
fix(provider): loki auth #5162
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Skipped Deployment
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Authentication Method Conflict
The commit fails to enable simultaneous Basic and X-Scope-OrgID authentication as intended. This is because the authentication_type field is a Literal type, allowing only one value at a time, so only one authentication method is ever applied. The refactoring to build a credentials dictionary does not address this. To support both, the logic should check for the presence of credentials (e.g., username/password and x_scope_orgid) instead of relying on authentication_type.
keep/providers/grafana_loki_provider/grafana_loki_provider.py#L125-L137
keep/keep/providers/grafana_loki_provider/grafana_loki_provider.py
Lines 125 to 137 in 633ef8f
| """ | |
| credentials = {} | |
| if self.authentication_config.authentication_type == "Basic": | |
| username_password = f"{self.authentication_config.username}:{self.authentication_config.password}".encode( | |
| "utf-8" | |
| ) | |
| encoded_credentials = base64.b64encode(username_password).decode("utf-8") | |
| credentials["Authorization"] = f"Basic {encoded_credentials}" | |
| if self.authentication_config.authentication_type == "X-Scope-OrgID": | |
| credentials["X-Scope-OrgID"] = self.authentication_config.x_scope_orgid | |
| return credentials |
Was this report helpful? Give feedback by reacting with 👍 or 👎
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! some test would be great tho :-)
No description provided.