Repository navigation
Conversation
…segment is used Each route that builds its filter from a live query segment checks that the user may run that segment, on the collection whose filter carries it, whether the segment comes from the query string or the request body: listing, counting and exporting records, deleting them, associating and dissociating related records, running an action, its form hooks and its approval, and charts. Users allowed to run a segment keep every feature on it. Refs: PRD-1759 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
29ad71f to
a70ec69
Compare
…utes Refs: PRD-1759 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…elpers using it Refs: PRD-1759 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Scra3
left a comment
There was a problem hiding this comment.
Spec (PRD-1759): conforms to the ticket's fix. 1 unvalidated decision: not final.
Explicit ids already pin the records, so the selection's live query segment is neither checked nor run, as forest-express and forest-rails do. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 new issue
|
|
Design note, not blocking. The behaviour is consistent with agent-ruby: 403 On structure, I'd have put the check where the filter is built rather than next to each call. agent-ruby runs A follow-up could make the factory async and pass it the authorization service and the collection name (or add a |
|
Heads-up for whoever closes PRD-1759: once this PR lands, |
…always rolled back Live query segments and SQL charts only read. executeNativeQuery now runs them in a transaction it always rolls back, read-only on Postgres, so no statement they run is ever committed, whatever the dialect. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
| { | ||
| const { instance } = this.nativeQueryConnections[connectionName] as NativeQueryConnection; | ||
| // Live queries only read: whatever their text runs, it is rolled back, never committed. | ||
| const transaction = await instance.transaction(); |
There was a problem hiding this comment.
🔴 Critical src/datasource.ts:63
With SQLite storage: ':memory:', a concurrent collection.create can return success while its write is silently undone by this rollback. Sequelize shares the in-memory connection between transactional and ordinary queries, so the create joins this transaction; isolate this execution or coordinate access to the shared connection before rolling it back.
🚀 Reply "fix it for me" or copy this AI Prompt for your agent:
In file @packages/datasource-sequelize/src/datasource.ts around line 63:
With SQLite `storage: ':memory:'`, a concurrent `collection.create` can return success while its write is silently undone by this rollback. Sequelize shares the in-memory connection between transactional and ordinary queries, so the create joins this transaction; isolate this execution or coordinate access to the shared connection before rolling it back.

fixes PRD-1759
Every route that builds its filter from a live query segment checks that the user may run that segment, on the collection whose filter carries it.
What changes
datasource-sequelize, sodatasource-sqltoo).Users allowed to run a segment keep every feature on it: each path above has a test for the allowed user next to the one for the refused user.
Decisions
Squash message
Definition of Done
General
Security
🤖 Generated with Claude Code
Note
Check live-query segment permission on every route that uses one
Adds
AuthorizationService.assertCanExecuteLiveQuerySegment, which parses the live-query segment from the request and throws Forbidden when the user may not execute it for the collection. Removes the implicit segment check fromassertCanOnCollection, and every read and modification route now calls the explicit assertion before building filters or running queries.ActionRoute.getRecordSelectionskips the segment check and filter when a non-global action has a positive explicit ID selection.Changes since #2046 opened
SequelizeDataSource.executeNativeQueryindatasource-sequelizeto run native queries inside a transaction that is always rolled back. [b68cd93]datasource-sequelizeunit tests forSequelizeDataSource.executeNativeQueryand added transaction and rollback test cases. [b68cd93]SequelizeDataSource.executeNativeQueryindatasource-sequelizeacross multiple database dialects. [b68cd93]Macroscope summarized 409bce0.