Sanitize SQL queries

Đang mở
#6,019 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
42/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
android, java, kotlin, sql, sqlite

Hướng nghiên cứu

Xác định phần instrumentation của sentry-jdbc và sentry-android-sqlite, bao gồm các entry point SupportSQLiteOpenHelper và SQLiteDriver, đồng thời xem xét SqlSanitizerWithSummary.jflex của OpenTelemetry Java làm cơ sở tham khảo trước đó. Được xem là hoàn tất khi mọi câu lệnh đều tạo ra các mô tả span mang tính cấu trúc an toàn mà không làm lộ các literal hoặc comment, với phạm vi kiểm thử bao gồm input malformed, dialect, secret-canary, fuzz/độ bền vững và hiệu năng.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Feature Java Platform: Java Spans
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.

Ngôn ngữ chính
Kotlin
Star
1.4k
Fork
478
Merge trung bình
3 ngày 2 giờ
Pull request đã merge (30 ngày)
70

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của getsentry/sentry-java

Tất cả issue của getsentry/sentry-java

Issue tương tự

Thêm issue về Kotlin

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.