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:
CoreRasurae
2026-03-17 01:19:15 +00:00
committed by Luis Mendes
parent f07d3475f8
commit 23fd06bbd0
2 changed files with 5 additions and 0 deletions
@@ -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(
+1
View File
@@ -27,6 +27,7 @@ REDACTED = "***REDACTED***"
_SENSITIVE_SUBSTRINGS: set[str] = {
"api_key",
"apikey",
"api-key",
"password",
"passwd",
"secret",