fix: Protect sensitive values from being exposed
There are events being sent that include sensitive data like passwords and need to be protected. Refs: 746
This commit is contained in:
@@ -23,6 +23,7 @@ import tomlkit
|
||||
|
||||
from cleveragents.infrastructure.events.models import DomainEvent
|
||||
from cleveragents.infrastructure.events.types import EventType
|
||||
from cleveragents.shared.redaction import REDACTED, is_sensitive_key
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from cleveragents.infrastructure.events.protocol import EventBus
|
||||
@@ -1165,6 +1166,9 @@ class ConfigService:
|
||||
old_value = data.get(key)
|
||||
data[key] = value
|
||||
self.write_config(data)
|
||||
if is_sensitive_key(key):
|
||||
old_value = REDACTED
|
||||
value = REDACTED
|
||||
if self._event_bus is not None:
|
||||
try:
|
||||
self._event_bus.emit(
|
||||
|
||||
@@ -27,6 +27,7 @@ REDACTED = "***REDACTED***"
|
||||
_SENSITIVE_SUBSTRINGS: set[str] = {
|
||||
"api_key",
|
||||
"apikey",
|
||||
"api-key",
|
||||
"password",
|
||||
"passwd",
|
||||
"secret",
|
||||
|
||||
Reference in New Issue
Block a user