Repository navigation
CMS-027A — Protect editorial project databases from puzzle importer - #61
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 27b09311b8
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if !path.is_file() || !has_sqlite_header(path)? { | ||
| return Ok(false); |
There was a problem hiding this comment.
Reject SQLite URI destinations before validating paths
When a limited import is invoked without --resume using a destination such as --db 'file:book.cms.sqlite?mode=rw', these checks inspect the literal URI as a filesystem path: the extension check misses the query suffix, and is_file() returns false. Diesel subsequently passes the value to SQLite, which interprets it as a URI and opens the existing book.cms.sqlite, allowing the importer migrations to modify the protected project. Reject file: destinations or resolve and validate the actual SQLite target before opening it.
Useful? React with 👍 / 👎.
Summary
Hardens
import_puzzlesso editorial project databases cannot reach puzzle-corpus migrations..cms.sqlite;project_metadata.application_idmatchesPROJECT_APPLICATION_ID;ocp.db, full-import confinement, resume, source-identity, traversal, symlink and sibling-prefix protections unchanged;Safety
Project-DB rejection is verified before
establish_connection() -> run_migrations(MIGRATIONS)in the importer execution path.Tests verify rejected projects keep identical bytes and table sets and do not gain
puzzles,puzzle_import_progress, orfavstables.Validation
cargo test --locked --bin import_puzzles— 47 passedcargo test --locked— passedcargo fmt --check— passedcargo clippy --locked --all-targets -- -D warnings— passedcargo check --locked --all-targets— passedgit diff --check— passedCloses #60