Repository navigation
fix(id-pg): refuse reserved or non-identifier filter/order fields (#14391) - #14497
Merged
Merged
Conversation
…4391) Filter and order columns are emitted as PostgREST query-parameter keys. A column named or/select/limit/... collided with a directive or logic parameter, and a non-identifier column or relation name was interpolated raw. Refuse these as field_unsupported (columns) or not_available (relation), before any request exists.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 44 minutes. View limit details
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. |
dezren39
force-pushed
the
dispatch/23601-14391-id-pg-reserved-fields
branch
from
November 24, 2026 17:15
bf9116c to
dedd4e5
Compare
This was referenced Nov 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #14391.
What
pkgs/id/crates/id-pg/src/translate.rsemitted the filter/order column name verbatim as a PostgREST query-parameter key, and interpolated the relation name raw into the request path. A column namedor,select,limit, ... collided with a directive/logic parameter (ordoubled with the keyset group,selectdoubled the projection); a name containing,/()/whitespace was rendered raw.Change
allowlist.rs: addsRESERVED_PARAM_NAMES(select,order,limit,offset,or,and,not,columns,on_conflict),is_plain_identifier(name), andis_usable_field_name(name).translate.rsstep 7/8: a relation that is not a plain identifier collapses tonot_available(same collapse rule as an unlisted relation); a filter or order column that is reserved or not a plain identifier is refused asfield_unsupported, before step 10 renders any parameter.Order of refusals is otherwise unchanged, and the refusal bodies stay functions of code + feature name only (no new disclosure channel).
Tests
New unit tests in
translate.rs: filter onor/selectrefused, order onlimitrefused, filter ona,brefused, relationitems/x→not_available, and a plain column still translates. Full crate suite:cargo test -p id-pg— 10 unit + 2 property + 15 refusal-table tests pass.Note:
cargo clippy -p id-pgin this worktree fails before my code withE0514 found crate serde compiled by an incompatible version of rustc(toolchain/dep cache mismatch in the worktree), so clippy was not run clean here;cargo testandcargo fmtare clean.Confidence: high, low-risk (refusals only — no previously successful request shape changes except the now-refused collision cases).
{ "direct_parent": null, "links": [], "lineage": { "design": null, "roadmap_item": null, "priority": null }, "pm_meta": 1, "provenance": { "queue_id": null, "scheduled_start": null, "picked_up_at": null, "work_started_at": null, "created_at": "2026-11-24T17:11:00Z", "session_id": "ses_e5df177e305ffeUZzwUyoH6CdK", "lane": null, "host": "amd", "worktree": "/home/user/git/fleet/dispatch-code-23601", "model": null, "lane_start_issues": [], "workspace_ref": { "kind": "worktree", "id": "/home/user/git/fleet/dispatch-code-23601", "repo": "developing-today/code", "branch": "dispatch/23601-14391-id-pg-reserved-fields", "sha": "dedd4e503b7855d9d4fbbdddd4e1580cb2304945" }, "auth_subject": "oc-code-03", "stamped_by": "fleet 0.1.0 (native)" } }Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.