Skip to content

docs(sql): [SQL Sanitizing 4] Add an agent rule for SQL query sanitizing - #6815

Draft
lbloder wants to merge 1 commit into
feat/sql-sanitizing-android-sqlitefrom
feat/sql-sanitizing-agent-rules
Draft

lbloder wants to merge 1 commit into
feat/sql-sanitizing-android-sqlitefrom
feat/sql-sanitizing-agent-rules

Conversation

@lbloder

@lbloder lbloder commented Nov 30, 2026 •

Copy link
Copy Markdown
Collaborator

PR Stack (SQL Sanitizing)


📜 Description

Adds an agent rule, .cursor/rules/sql_sanitizing.mdc, and its row in the AGENTS.md rule index. Documentation only; no code changes.

The rule covers:

  • SQL query sanitizing: how the layers fit together (integration → SqlSpanData → SqlQueryAnalyzer → OtelSqlSanitizer → generated AutoSqlSanitizer) and where each contract is documented.
  • File ownership: which files only scripts/sync-otel-sql.sh may write, as enforced by --check in CI, and which Sentry-owned files live next to them.
  • Syncing to a newer upstream: steps that include what the script does not check (upstream's JFlex version, new upstream file dependencies, compile errors in the hand-written AutoValue_* classes), plus a done condition.
  • Leak corpus: the case format, the known-leaks.txt ratchet, the per-case exemption gap, and the attribution to update when taking new upstream test cases.

The rule points to the existing Javadoc, file headers, script comments and --help rather than restating them.

💡 Motivation and Context

Syncing the vendored grammar is a manual, rarely repeated task with several steps the script cannot enforce. Writing them down lets an agent (or a person) run a sync without rediscovering them. The rule is a separate PR so it can be reviewed independently of the code PRs. It sits at the end of the stack because it describes files those PRs add.

The caller picks the upstream ref for a sync; the current pin is a commit on upstream main.

💚 How did you test it?

  • Checked each statement in the rule against the code on this branch: the sentry/build.gradle.kts exclusions and the generateJflex task; the script's transforms, failure behaviour and --help; the test KDoc; the case format in analyzer-cases.json; and the THIRD_PARTY_NOTICES.md entries.
  • Upstream's JFlex version location (instrumentation-api-incubator/build.gradle.kts, de.jflex:jflex:1.9.1) checked at the pinned commit.
  • make format api: no changes.
  • Not tested: a fresh agent session carrying out a sync from the rule alone.

📝 Checklist

  • I added GH Issue ID & Linear ID
  • I added tests to verify the changes.
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled.
  • I updated the docs if needed.
  • I updated the wizard if needed.
  • Review from the native team if needed.
  • No breaking change or entry added to the changelog.
  • No breaking change for hybrid SDKs or communicated to hybrid SDKs.
  • Public API changes reviewed by another Mobile SDK team member or implemented according to the develop docs spec.

🔮 Next steps

  • The rule describes the analyzer and the sync, not the JDBC and Android SQLite wiring; integration details can be added when needed.

⚠️ Merge this PR using a merge commit (not squash). Only the collection branch is squash-merged into 9.x.x.

#skip-changelog

@github-actions

Copy link
Copy Markdown
Contributor

PR risk: low

For commit 770ae33.

This label is a hint for reviewers, not an approval.

@github-actions github-actions Bot added risk: low PR risk score: low and removed risk: low PR risk score: low labels Nov 30, 2026
@sentry

sentry Bot commented Nov 30, 2026

Copy link
Copy Markdown

📲 Install Builds

Android

🔗 App Name App ID Version Configuration
SDK Size io.sentry.tests.size 8.65.1 (1) release

⚙️ sentry-android Build Distribution Settings

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: low PR risk score: low

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant