fix(security): wrap log f-strings in storage/graph.py with _sanitize_log_value()
What Changed
- Wrapped log f-strings in
storage/graph.pywith_sanitize_log_value()to prevent log-injection attacks — resolves CodeQLpy/log-injectionalerts #483, #484, #485, and #486 affectingsource_hash,target_hash, andrelationship_typelog statements. - Alert #467 (
py/unused-global-variableforMCP_AUTO_EXTRACT_DEFAULT) dismissed as a false positive — the constant is imported via lazy cross-module import inserver/handlers/memory.pyand is genuinely used.
Security Context
_sanitize_log_value() (from src/mcp_memory_service/compat.py) strips \n, \r, and \x1b characters from user-supplied values before they reach log statements, preventing log-forging and ANSI injection. This pattern is now enforced project-wide via pre_pr_check.sh check 6.5.
Files Changed
src/mcp_memory_service/storage/graph.py— log f-string sanitization (PR #1048)
Full Changelog
See CHANGELOG.md for complete details.