Skip to content

Audit & Logging

MCP-Go-MSSQL includes a dedicated security logging system that records relevant events without exposing sensitive data.

The SecurityLogger component handles recording all security events with automatic sanitization.

  • Database connection attempts (success and failure)
  • Queries blocked by read-only mode
  • Access denied to tables outside the whitelist
  • Detected SQL injection attempts
  • Input validation errors

The logger automatically removes sensitive data before writing to disk:

  • Passwords and tokens
  • Full connection strings
  • User data in queries

Security logs are written in a structured format with the following fields:

FieldDescription
timestampUTC date and time of the event
levelLevel: INFO, WARN, ERROR, SECURITY
eventSecurity event type
sourceComponent that generated the event
messageSanitized event description

Security logging is enabled by default and cannot be disabled. Error messages to the client are always generic in production mode (DEVELOPER_MODE=false), while technical details are recorded internally.

  1. Review security logs periodically
  2. Set up alerts for SECURITY-level events
  3. Rotate and archive logs according to retention policies
  4. Do not expose log files to unauthorized users