-
Notifications
You must be signed in to change notification settings - Fork 70
LCORE-395: config endpoint should not leak secrets #502
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -176,10 +176,8 @@ async def query_endpoint_handler( | |||||||||||||||||||
| # Enforce RBAC: optionally disallow overriding model/provider in requests | ||||||||||||||||||||
| validate_model_provider_override(query_request, request.state.authorized_actions) | ||||||||||||||||||||
|
|
||||||||||||||||||||
| # log Llama Stack configuration, but without sensitive information | ||||||||||||||||||||
| llama_stack_config = configuration.llama_stack_configuration.model_copy() | ||||||||||||||||||||
| llama_stack_config.api_key = "********" | ||||||||||||||||||||
| logger.info("Llama stack config: %s", llama_stack_config) | ||||||||||||||||||||
| # log Llama Stack configuration | ||||||||||||||||||||
| logger.info("Llama stack config: %s", configuration.llama_stack_configuration) | ||||||||||||||||||||
|
|
||||||||||||||||||||
|
Comment on lines
+179
to
181
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Avoid logging secret-bearing config at INFO; sanitize and downgrade to DEBUG. Even with SecretStr masking, logging the full config object at INFO on every request is risky and noisy. Emit only a sanitized JSON view and use DEBUG. - # log Llama Stack configuration
- logger.info("Llama stack config: %s", configuration.llama_stack_configuration)
+ # log Llama Stack configuration (sanitized)
+ logger.debug(
+ "Llama stack config: %s",
+ configuration.llama_stack_configuration.model_dump(
+ mode="json", exclude={"api_key"}, exclude_none=True
+ ),
+ )📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||
| user_id, _, token = auth | ||||||||||||||||||||
|
|
||||||||||||||||||||
|
|
||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -552,10 +552,8 @@ async def streaming_query_endpoint_handler( # pylint: disable=too-many-locals | |||||||||||||||||||||||
| # Enforce RBAC: optionally disallow overriding model/provider in requests | ||||||||||||||||||||||||
| validate_model_provider_override(query_request, request.state.authorized_actions) | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| # log Llama Stack configuration, but without sensitive information | ||||||||||||||||||||||||
| llama_stack_config = configuration.llama_stack_configuration.model_copy() | ||||||||||||||||||||||||
| llama_stack_config.api_key = "********" | ||||||||||||||||||||||||
| logger.info("Llama stack config: %s", llama_stack_config) | ||||||||||||||||||||||||
| # log Llama Stack configuration | ||||||||||||||||||||||||
| logger.info("Llama stack config: %s", configuration.llama_stack_configuration) | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
|
Comment on lines
+555
to
557
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Same logging concern: sanitize and use DEBUG. Mirror the sanitized, lower-verbosity logging to avoid leaking sensitive config details. - # log Llama Stack configuration
- logger.info("Llama stack config: %s", configuration.llama_stack_configuration)
+ # log Llama Stack configuration (sanitized)
+ logger.debug(
+ "Llama stack config: %s",
+ configuration.llama_stack_configuration.model_dump(
+ mode="json", exclude={"api_key"}, exclude_none=True
+ ),
+ )📝 Committable suggestion
Suggested change
|
||||||||||||||||||||||||
| user_id, _user_name, token = auth | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
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.
🛠️ Refactor suggestion
Build the Postgres URL with SQLAlchemy URL.create to correctly escape credentials.
String interpolation will break with special characters in user/password and risks subtle connection bugs. Use
URL.createand fix theoptionsflag spacing.Apply:
📝 Committable suggestion
🤖 Prompt for AI Agents