Skip to content

Commit 63996a6

Browse files
authored
Merge pull request #529 from tisnik/lcore-654-avoid-cross-instance-bleed
LCORE-654: avoid cross instance bleed
2 parents e961026 + f2cacca commit 63996a6

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

src/models/config.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,8 @@ class ServiceConfiguration(ConfigurationBase):
145145
workers: PositiveInt = 1
146146
color_log: bool = True
147147
access_log: bool = True
148-
tls_config: TLSConfiguration = TLSConfiguration()
149-
cors: CORSConfiguration = CORSConfiguration()
148+
tls_config: TLSConfiguration = Field(default_factory=TLSConfiguration)
149+
cors: CORSConfiguration = Field(default_factory=CORSConfiguration)
150150

151151
@model_validator(mode="after")
152152
def check_service_configuration(self) -> Self:
@@ -371,7 +371,7 @@ class JwkConfiguration(ConfigurationBase):
371371
"""JWK configuration."""
372372

373373
url: AnyHttpUrl
374-
jwt_configuration: JwtConfiguration = JwtConfiguration()
374+
jwt_configuration: JwtConfiguration = Field(default_factory=JwtConfiguration)
375375

376376

377377
class AuthenticationConfiguration(ConfigurationBase):
@@ -458,12 +458,14 @@ class Configuration(ConfigurationBase):
458458
service: ServiceConfiguration
459459
llama_stack: LlamaStackConfiguration
460460
user_data_collection: UserDataCollection
461-
database: DatabaseConfiguration = DatabaseConfiguration()
462-
mcp_servers: list[ModelContextProtocolServer] = []
463-
authentication: AuthenticationConfiguration = AuthenticationConfiguration()
461+
database: DatabaseConfiguration = Field(default_factory=DatabaseConfiguration)
462+
mcp_servers: list[ModelContextProtocolServer] = Field(default_factory=list)
463+
authentication: AuthenticationConfiguration = Field(
464+
default_factory=AuthenticationConfiguration
465+
)
464466
authorization: Optional[AuthorizationConfiguration] = None
465467
customization: Optional[Customization] = None
466-
inference: InferenceConfiguration = InferenceConfiguration()
468+
inference: InferenceConfiguration = Field(default_factory=InferenceConfiguration)
467469

468470
def dump(self, filename: str = "configuration.json") -> None:
469471
"""Dump actual configuration into JSON file."""

tests/unit/models/config/test_authentication_configuration.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ def test_authentication_configuration_module_unsupported() -> None:
142142

143143
def test_authentication_configuration_in_config() -> None:
144144
"""Test the authentication configuration in main config."""
145+
# pylint: disable=no-member
145146
cfg = Configuration(
146147
name="test_name",
147148
service=ServiceConfiguration(),

tests/unit/models/config/test_tls_configuration.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ def test_tls_configuration() -> None:
2222

2323
def test_tls_configuration_in_service_configuration() -> None:
2424
"""Test the TLS configuration in service configuration."""
25+
# pylint: disable=no-member
2526
cfg = ServiceConfiguration(
2627
tls_config=TLSConfiguration(
2728
tls_certificate_path=Path("tests/configuration/server.crt"),

0 commit comments

Comments
 (0)