-
Notifications
You must be signed in to change notification settings - Fork 54
LCORE-390: authentication configuration is not optional #395
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 | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -292,9 +292,7 @@ class Configuration(BaseModel): | |||||||||||||||||||
| user_data_collection: UserDataCollection | ||||||||||||||||||||
| database: DatabaseConfiguration = DatabaseConfiguration() | ||||||||||||||||||||
| mcp_servers: list[ModelContextProtocolServer] = [] | ||||||||||||||||||||
| authentication: Optional[AuthenticationConfiguration] = ( | ||||||||||||||||||||
| AuthenticationConfiguration() | ||||||||||||||||||||
| ) | ||||||||||||||||||||
| authentication: AuthenticationConfiguration = AuthenticationConfiguration() | ||||||||||||||||||||
|
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. 💡 Verification agent 🧩 Analysis chainAvoid shared default instance for authentication; use Field(default_factory=...) Using a constructed BaseModel instance as a class-level default risks sharing the same instance across all Configuration objects. Prefer a factory to ensure a fresh instance per model. Apply this diff to the authentication field: -authentication: AuthenticationConfiguration = AuthenticationConfiguration()
+authentication: AuthenticationConfiguration = Field(default_factory=AuthenticationConfiguration)Additionally, ensure Field is imported: # at import line with other pydantic symbols
from pydantic import BaseModel, model_validator, FilePath, AnyHttpUrl, FieldThis change aligns the code with the PR’s goal (authentication is not optional) but may uncover existing configs passing authentication: null. Run this to find potential offenders: 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "Searching YAML for 'authentication: null' or '~' or empty mapping lines"
rg -n --glob '*.yaml' --glob '*.yml' -e $'^\s*authentication\s*:\s*(null|~)\s*$' -e $'^\s*authentication\s*:\s*$' || true
echo "Searching Python for explicit authentication=None"
rg -n --type py -e $'authentication\s*=\s*None' -A 2 || trueLength of output: 634 Use a fresh Sharing a single
📝 Committable suggestion
Suggested change
|
||||||||||||||||||||
| customization: Optional[Customization] = None | ||||||||||||||||||||
| inference: InferenceConfiguration = InferenceConfiguration() | ||||||||||||||||||||
|
|
||||||||||||||||||||
|
|
||||||||||||||||||||
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.
Fix mutable default list for mcp_servers
mcp_servers uses a mutable default ([]), which will be shared across Configuration instances. Use a default factory to prevent cross-instance leakage.
Apply this diff:
📝 Committable suggestion
🤖 Prompt for AI Agents