Skip to content

Security: mgtv-tech/sql-gunyu

Security

SECURITY.md

Security Policy

sql-gunyu is an analysis engine dedicated to SQL auditing, defect diagnostics, and index optimization recommendations. Because database auditing and analysis tools directly interact with database metadata and execution plans, security and data integrity are the foundational bottom lines of this project.

This document outlines the security guarantees, supported version scope, and responsible vulnerability disclosure process for sql-gunyu.


1. Core Security Guarantees & Architectural Boundaries

In regular operation, sql-gunyu adheres to the following security commitments:

  • Strict Read-Only Guarantee: In connected database analysis paths, the engine is strictly restricted to querying system metadata/statistics views and executing read-only EXPLAIN without ANALYZE.
  • Zero Execution of Caller DML/DDL: The engine never executes caller-provided business modification statements such as INSERT, UPDATE, DELETE, DROP, or ALTER.
  • No Automatic Application of Suggestions: All index recommendations (CREATE INDEX) and SQL rewrite suggestions output by the engine are static text proposals. They are never automatically applied to the target database.
  • Minimal Data Exposure & Privacy Protection: Analysis relies primarily on AST syntax tree structures, execution plan nodes, and table/column-level metadata statistics. Business data rows are never persisted.
  • Resource Constraints & Timeout Enforcement: All database interactions are strictly bounded by caller-provided context.Context timeouts to prevent connection pool exhaustion caused by blocking metadata queries or sampling.

For detailed production privilege configurations and runtime safety boundaries, refer to Production Security and Permission Boundaries.


2. Supported Versions

Security fixes are provided only for the latest stable major release and currently maintained minor releases. We recommend always keeping production deployments up to date with the latest supported release.

Version Series Receives Security Fixes Notes
v1.x (Current Major) ✅ Supported Active maintenance and security bug fixes
< v1.0 (Early Previews) ❌ Unsupported Please upgrade to the latest stable release

3. Reporting a Vulnerability

Please do NOT report security vulnerabilities via public GitHub Issues, Pull Requests, or public discussion forums!

If you discover a potential security vulnerability (including but not limited to: bypassing read-only restrictions to execute unintended statements, sensitive data leakage, denial-of-service vectors, SQL injection, or insecure metadata deserialization), please report it to the maintenance team through confidential channels.

Reporting Channels

  1. GitHub Private Vulnerability Reporting (Preferred):
    • Navigate to the Security tab of the project's GitHub repository.
    • Click Advisories -> Report a vulnerability to submit a private security advisory.
  2. Security Team Email:
    • Send an email to the security contact: pengliang5@mgtv.com.
    • Use the subject line: [SECURITY] sql-gunyu vulnerability report - <Brief Summary>.

What to Include in a Report

To help maintainers quickly triage and evaluate the risk, please include as much of the following information as possible:

  • Vulnerability Type and Summary: A clear and concise description of the issue and its potential impact.
  • Affected Components and Versions: The specific modules (such as pkg/mysql, pkg/postgresql, API layer, etc.) and versions affected.
  • Reproduction Steps and Minimal PoC:
    • A minimal SQL statement or code snippet to reproduce the issue (ensure all sensitive data, private IPs, credentials, and tokens are fully sanitized);
    • Target database dialect and version (e.g., MySQL 8.0, PostgreSQL 17).
  • Potential Impact and Attack Scenarios: How this vulnerability could be exploited in production and the severity of consequences.
  • Suggested Remediation (if available): If you have already devised a patch or temporary mitigation, feel free to include it.

4. Vulnerability Response & Disclosure Process

The maintenance team adheres to the principles of Coordinated Vulnerability Disclosure (CVD):

  1. Initial Confirmation (Within 48 hours): Maintainers will acknowledge receipt of your report within 48 hours and begin an initial assessment of its validity and severity.
  2. Investigation & Remediation: Maintainers will reproduce the issue, evaluate the blast radius, and prepare patches in a private environment while keeping the reporter updated on progress.
  3. Temporary Mitigations: If a comprehensive fix requires extended development or testing, temporary mitigation guidance will be provided to the reporter and affected users first.
  4. Release & Public Disclosure:
    • A patched release will be published;
    • A detailed security advisory will be published on GitHub Security Advisories, explaining root causes, affected scopes, and upgrade instructions;
    • Credit will be given to the reporting researcher(s) in the release notes and acknowledgments (subject to their consent).

5. Deployment Best Practices for Users

To maintain security in production environments, teams integrating sql-gunyu should follow these practices:

  • Least-Privilege Database Accounts: Dedicate a read-only auditing account to sql-gunyu. Grant only permissions required to inspect metadata and run EXPLAIN (e.g., SELECT, PROCESS, SHOW VIEW on MySQL; read-only role with catalog/stats access on PostgreSQL). Never grant write, delete, DDL, or administrative privileges.
  • Credential Security: Never hardcode real database connection strings (DSNs), plain-text passwords, or internal hostnames in codebases, test suites, or configuration files.
  • Network Isolation: When deployed as an independent auditing service, place sql-gunyu in an isolated internal network segment and enforce strict API authentication (e.g., Bearer Token or mTLS).

There aren't any published security advisories