-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
Description
Description
LogEntry change messages include full request data via json.dumps(data), potentially logging secrets.
Locations
- File:
django_admin_mcp/handlers/crud.pylines 523, 652, 653 - Code:
change_message=f"Created via MCP: {json.dumps(data, default=str)}"
Impact
If a user includes sensitive data in API requests, it gets logged:
- Passwords being set
- API keys or tokens in custom fields
- Personally identifiable information (PII)
Recommended Fix
Sanitize data before logging:
SENSITIVE_FIELDS = {"password", "token", "secret", "key", "api_key", "auth"}
def sanitize_for_logging(data: dict) -> dict:
sanitized = {}
for key, value in data.items():
if any(sensitive in key.lower() for sensitive in SENSITIVE_FIELDS):
sanitized[key] = "***REDACTED***"
else:
sanitized[key] = value
return sanitized
# Usage
change_message = f"Created via MCP: {json.dumps(sanitize_for_logging(data), default=str)}"Reactions are currently unavailable