getsentry / getsentry/sentry-java
Sanitize SQL queries
- Linguagem predominante
- Kotlin
- Estrelas
- 1.4k
- Forks
- 478
- Merge médio
- 2d 22h
- PRs com merge (30d)
- 69
Descrição
### Problem Statement
Our JDBC and Android SQLite integrations currently use caller-provided SQL directly as the span description. If a customer interpolates values instead of using placeholders, literals and comments can contain PII, credentials, or other sensitive data and are sent to Sentry. The Java SDK has no SQL sanitizer today.
### Solution Brainstorm
Introduce a shared internal SQL analyzer used by sentry-jdbc and sentry-android-sqlite.
Requirements:
- Sanitize every statement, including prepared-statement text.
- Replace literal values with placeholders while preserving SQL structure and existing parameter markers.
- Remove or redact line and block comments.
- Handle database dialect differences conservatively.
- Never fall back to, attach, or log the original query if analysis fails; fail closed to safe structural metadata.
- Use sanitized query text as the transaction-based span description.
- Cover JDBC, SupportSQLiteOpenHelper, and SQLiteDriver instrumentation.
- Add malformed-input, dialect, secret-canary, fuzz/robustness, and performance tests.
OpenTelemetry Java's Apache-2.0 JFlex `SqlSanitizerWithSummary.jflex` is strong prior art and can likely be adapted, but should not be vendored unchanged: OTel preserves comments, may skip sanitization for prepared statements, and preserves unknown fragments. Vendoring requires source attribution and a THIRD_PARTY_NOTICES.md entry.
Guia de contribuição
Direção de pesquisa
Localize a instrumentação de sentry-jdbc e sentry-android-sqlite, incluindo os pontos de entrada SupportSQLiteOpenHelper e SQLiteDriver, e analise SqlSanitizerWithSummary.jflex do OpenTelemetry Java como referência anterior. Considera-se concluído quando todas as instruções produzem descrições estruturais seguras de span sem expor literais ou comentários, com cobertura para entradas malformadas, dialetos, secret-canary, fuzz/robustez e desempenho.
Escrita pelo modelo de indexação a partir do texto da issue.
Avaliação
- Stack de tecnologia
- android, java, kotlin, sql, sqlite
- Domínio
- databases, observability, security
- Tipo de issue
- Funcionalidade
- Dificuldade
- 5/5
- Tempo estimado
- Mais de uma semana
- Status de atividade
- Ativa
- Clareza
- Razoavelmente clara
- Facilidade para iniciantes
- 42/100