Skip to content

fix: percent-encode datachecks sqlite mode=ro URI + pin C5 reconcile read-only for '?'-named files#22

Merged
ajaysurya1221 merged 1 commit into
mainfrom
bugfix/sqlite-mode-ro-uri-encoding
Jun 27, 2026
Merged

fix: percent-encode datachecks sqlite mode=ro URI + pin C5 reconcile read-only for '?'-named files#22
ajaysurya1221 merged 1 commit into
mainfrom
bugfix/sqlite-mode-ro-uri-encoding

Conversation

@ajaysurya1221

Copy link
Copy Markdown
Owner

What

The sealed C5 reconcile path (c5_data.py) already percent-encodes its sqlite file: URI (shipped in v1.2.0). This applies the same encoding to the one remaining raw f-string — datachecks.py:242, the dev-time suggest-data-checks helper — and adds a regression test that pins the read-only contract through the C5 reconcile path.

Why

An in-repo file whose name contains a URI query (e.g. a?mode=rwc&x=.db) injects params into file:{path}?mode=ro, so SQLite honors the first mode=rwc and the read-only intent is bypassed. Not a repo escape (the path is containment-checked first, and the statement authorizer still blocks write SQL) — defense-in-depth hardening only.

Test (tests/test_c5.py)

  • ..._opens_the_right_file: a reconcile SELECT against an in-repo q?.db returns the correct count (fix-discriminating — without the encoding the path truncates at ? and this ERRORs).
  • ..._stays_read_only: a CREATE TABLE through reconcile against q?.db is rejected and the DB is left unmodified.

Verified at the URI level: raw file:.../a?mode=rwc&z=.db?mode=roWRITABLE (mode=ro bypassed); quote()-encoded → read-only.

Scope

Surgical — no C5 grammar, authorizer, or deny-exec/gating change. c5_data.py unchanged (already fixed).

…le read-only

The sealed C5 reconcile path (c5_data.py) already percent-encodes the sqlite file:
URI so an in-repo file whose NAME contains a '?' cannot inject URI params that
override mode=ro. Apply the same encoding to the one remaining raw f-string at
datachecks.py:242 (the dev-time `suggest-data-checks` helper) for consistency.

Add a regression test through the C5 reconcile path with an in-repo sqlite file named
`q?.db`:
- it opens the RIGHT file read-only (4 rows == the csv -> PASS); reverting the
  encoding truncates the path at '?' and this becomes ERROR (fix-discriminating);
- a CREATE TABLE through reconcile is rejected (ERROR) and the DB is left unmodified
  (read-only enforced; the '?' cannot inject mode=rwc).

Surgical: no C5 grammar, authorizer, or deny-exec/gating change.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jun 27, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@ajaysurya1221, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 36 minutes and 29 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: b719850c-15d6-4766-a91d-0ba1f01d2b54

📥 Commits

Reviewing files that changed from the base of the PR and between d043ac1 and cb23f47.

📒 Files selected for processing (2)
  • src/dorian/datachecks.py
  • tests/test_c5.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch bugfix/sqlite-mode-ro-uri-encoding

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@ajaysurya1221 ajaysurya1221 merged commit 0e99d46 into main Jun 27, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants