Requested by @KARTIKrocks as a follow-up to PR #61.
Problem
analyzer.Redact treats every double-quoted run as an identifier. This preserves quoted identifiers in PostgreSQL and MySQL with ANSI_QUOTES, but MySQL's default sql_mode accepts double-quoted strings as literals. As a result, a value such as "alice@example.com" can remain in redacted Result.Query and Result.Fingerprint. This gap predates PR #61 and is documented in website/docs/redaction.md. Changing Redact to redact every double-quoted run would remove useful structure from PostgreSQL ORM-generated queries.
Proposed work
- Define a dialect hint for
Analyzer and pass it through the canonical analyzer.Redact / analyzer.Fingerprint path without adding a second normalizer. Keep parser-pluggable analysis and resolve the configuration once during construction, not per query.
- Redact double-quoted strings when MySQL default-mode semantics apply. Preserve double-quoted identifiers when identifier semantics apply, including PostgreSQL and MySQL
ANSI_QUOTES. Preserve backtick identifiers.
- Update the relevant
analyzer/redact.go and analyzer/analyzer.go behavior, tests in analyzer/redact_test.go, and website/docs/redaction.md. Consider integration coverage for parsers/mysqlparser.
Acceptance criteria
- Under a MySQL default-mode dialect hint, double-quoted literal contents appear in neither redacted
Result.Query nor Result.Fingerprint.
- PostgreSQL ORM-style quoted identifiers remain readable; MySQL
ANSI_QUOTES identifiers and backtick identifiers remain intact.
- Document the behavior when the dialect is unknown, including any remaining exposure, and test the chosen default. Do not regress single-quoted, dollar-quoted, or numeric redaction.
- Keep the analyzer dependency-light and avoid additional per-query configuration work.
References: #61
Review discussion: #61 (comment)
Requested by @KARTIKrocks as a follow-up to PR #61.
Problem
analyzer.Redacttreats every double-quoted run as an identifier. This preserves quoted identifiers in PostgreSQL and MySQL withANSI_QUOTES, but MySQL's defaultsql_modeaccepts double-quoted strings as literals. As a result, a value such as"alice@example.com"can remain in redactedResult.QueryandResult.Fingerprint. This gap predates PR #61 and is documented inwebsite/docs/redaction.md. ChangingRedactto redact every double-quoted run would remove useful structure from PostgreSQL ORM-generated queries.Proposed work
Analyzerand pass it through the canonicalanalyzer.Redact/analyzer.Fingerprintpath without adding a second normalizer. Keep parser-pluggable analysis and resolve the configuration once during construction, not per query.ANSI_QUOTES. Preserve backtick identifiers.analyzer/redact.goandanalyzer/analyzer.gobehavior, tests inanalyzer/redact_test.go, andwebsite/docs/redaction.md. Consider integration coverage forparsers/mysqlparser.Acceptance criteria
Result.QuerynorResult.Fingerprint.ANSI_QUOTESidentifiers and backtick identifiers remain intact.References: #61
Review discussion: #61 (comment)