Enforce subscription authorization for false-mode tables#1915
Open
kriszyp wants to merge 4 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request updates the transactional logic in resources/Resource.ts to ensure that table subscriptions still enforce connection grants and row-level delivery markers when opting out of instance loading (loadAsInstance = false). It also adds comprehensive unit tests to verify this behavior. The review feedback suggests replacing a fixed setTimeout in the new tests with a condition-wait helper to prevent potential test flakiness in slower environments.
Contributor
|
Reviewed; no blockers found. |
Devin-Holland
approved these changes
Jul 23, 2026
kriszyp
marked this pull request as ready for review
July 24, 2026 00:00
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.
Summary
loadAsInstance === falseauthorization contract: the shared Resource wrapper still skips false mode, so custom handlers continue to own their authorizationallowReadcheck inside the built-inTable.subscribe;connectfunnels through the same checked pathsearchrequest-scoped instead of applying the 5.2 per-recordallowReadfilterallowReadfiltering in false mode, including when a stalerowLevelAuthCheckedmarker is suppliedsearchreceives a thenableallowReadverdict, which it cannot awaitloadAsInstance !== falserecord-scoped read behavior and the existing unchecked internal pathsCompatibility model
Historical false mode deliberately skips the wrapper-level
allow*gate. Built-in Table methods perform their own one-time checks, while custom handlers are responsible for authorization. This PR fills the missing built-in subscription check without moving authorization into the wrapper or changing QUERY argument routing.For a normal collection subscription,
allowReadruns once on the collection receiver. A targeted subscription retains the historical target receiver; the PR does not synthesize a different resource instance. No false-mode read is rechecked per record or per event.loadAsInstance !== falseretains the existing 5.2 behavior: synchronous application overrides may be evaluated per row/per event.The narrow v5.1 backport is #1914.
Compatibility audit
allow*whenloadAsInstance=false; built-in Table methods own one-time authorizationValidation
npm run buildgit diff --checkERR_IMPORT_ATTRIBUTE_MISSINGstartup issue and cancelled its six childrenReview
Thorough cross-model review plus a final post-fix artifact review found no remaining blockers or significant concerns. Review caught and fixed the false-mode async-search truthiness bypass; the final guard is false-mode-only and does not change instance-mode behavior.
Generated with GPT-5.6 Codex.