Repository navigation
Conversation
This was referenced Sep 30, 2026
Contributor
[High impact] The PR appears safe to merge, with no new actionable issues found. SummaryThis PR makes session ownership enforced by default, adds real-server and browser coverage, migrates benchmark clients to issued credentials, and documents rollout and proxy setup.
Reviews (28) · Last reviewed commit: "Merge remote-tracking branch 'upstream/m..." · Reviewed by Greptile |
masenf
force-pushed
the
codex/session-integration
branch
from
October 5, 2026 21:24
80666f1 to
62db86e
Compare
masenf
force-pushed
the
codex/session-integration
branch
from
October 8, 2026 17:55
62db86e to
c561071
Compare
masenf
force-pushed
the
codex/session-integration
branch
from
October 8, 2026 18:24
c561071 to
db8a6ab
Compare
masenf
force-pushed
the
codex/session-integration
branch
2 times, most recently
from
October 8, 2026 19:03
86fdb35 to
5932c7d
Compare
Introduce a stdlib HS256 session codec, environment-only signing keys with rotation, and persistent local secrets excluded from exports. Preserve the local secret during web reinitialization. Validation: 421 affected tests passed, plus unknown-key diagnostic coverage; Ruff and targeted pyright passed. Refs: ENG-12910
masenf
force-pushed
the
codex/session-integration
branch
from
October 14, 2026 09:35
5932c7d to
6b07618
Compare
…de sentences The self-hosting page says that the example Caddyfiles forward the backend routes, but their matcher had no /_reflex/session, so the session exchange reached the static file server. The guide now says that the upload 403 applies under enforce, and that only a socket without a valid cookie receives a credential.
- The backend's refresh notice no longer restarts an exchange that the backend denied for this page's origin. The guard moved from the scheduler into the request itself. - After three failed attempts, a later retry does not hold HTTP calls again while its request is open.
WebKit does not store a Secure cookie from plain HTTP, also on a loopback host, so local development in Safari had no session: fresh state on each reload and rejected uploads. Local development over plain HTTP now sends the plain SameSite=Lax cookie next to the secure partitioned one, and each browser keeps the form that it accepts. The middleware reads the plain cookie only there, and prefers the secure one. HTTPS and production are unchanged.
Local development over plain HTTP now also stores the plain cookie, so the tests that counted session cookies found two.
Contributor
There was a problem hiding this comment.
All reported issues were addressed across 3 files (changes from recent commits).
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
The secure partitioned cookie works in a normal tab and in a cross-site iframe, and WebKit accepts Secure cookies from loopback hosts since 310542@main. The plain fallback cookie is removed.
This reverts commit ae217d3.
This reverts commit e2f2528.
An event context without an authorized session read and parsed REFLEX_SESSION_TOKEN_MODE on each creation (1.9 us). The parsed mode is now cached by the raw environment value (0.36 us), so a change to the environment still takes effect.
HTTP calls wait whenever the socket delivers a credential, on a first connection and on a reconnection alike. The flag that exempted later credentials was never cleared on disconnect, so an upload after a reconnection with an expired cookie could start before the new cookie.
The benchmarks connect a namespace that has no server and address state with a plain token. A connection now issues a session over the socket, so test_on_event_router_data failed at setup. The fixture moves here from the integration PR.
The harness restarts the backend in the same process on a new event loop. The redis token manager holds an asyncio.Event that is bound to the stopped loop, so each connection after the restart failed on the redis shards. A real restart is a new process with a new manager.
# Conflicts: # packages/reflex-base/src/reflex_base/config.py # packages/reflex-base/src/reflex_base/session.py # tests/units/reflex_base/test_session.py
# Conflicts: # news/+browser-session-transport.feature.md # packages/reflex-base/news/+session-cookie-bootstrap.feature.md
This branch has not been deployed
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.
Exercise session ownership in real servers and browsers, migrate synthetic clients to server-issued credentials, and document deployment and rollout.
The backend-path app runs under enforcement across development/production and zero/one/two-level prefixes. It covers immediate hydration during held cookie exchange, shared/duplicate tabs, uploads, failed exchange recovery with retained or cancelled uploads, idle short-TTL renewal, backend restarts, and cross-site iframe persistence. EmbedPlugin coverage also runs under enforcement. Production restarts preserve their worker and compile-suppression settings.
A real Granian test verifies state events while cookie exchange is held and state continuity on reconnect. It uses
rx.Stateand asserts it leaves no direct BaseState subclass behind for later integration apps. Benchmark reconnects reuse cookies and bound tokens, with issuance outside measured event latency.The guide covers app-bound credentials, persistent/rotating signing keys, POSIX permissions and Windows ACLs, origin configuration, partitioned cookies, embedding, migration modes, SYSTEM/anonymous authority, idle renewal, retry/cancellation, and readiness during cookie replacement. Existing reverse-proxy/api_transformer facilities handle rate limiting.
Review order: #7361 → #7362 → #7363 → #7364. Merged with current main; #7360 is already merged. Companion: reflex-dev/reflex-enterprise#240.
Validation:
pyright reflex testspass. Minimum-dependency checks pass for reflex, reflex-base, and reflex-components-core. Stub generation makes no tracked changes.playground-0.8.23job fails on that older release's missing greenlet dependency. Current-head playground and size checks pass. Large CI matrices are still running after the final pushes; cancelled duplicate runs also temporarily report failed gate checks.All substantive feedback is addressed. Review-thread replies explain the intentional connection-lifetime authority policy and declined hypothetical/style-only requests. Final adversarial review found no additional code blockers.
The guide now also covers: cookie renewal only at
POST /_reflex/session, trust for a page on the backend host, the 403 exchange result, hosts where the browser stores noSecurecookie (plain HTTP), the shared-state link check, and that all ports of the backend host share the cookie.The guide documents
enforceas the default mode, how to change it withREFLEX_SESSION_TOKEN_MODE, and what an upgrading app can see.Breaking: this pull request changes the
REFLEX_SESSION_TOKEN_MODEdefault toenforce. State access for a client token that the session does not own raisesSessionAuthorizationError, uploads for such a token return 403, and a tab that presents such a token gets a new token and fresh state.warnallows it with a warning andoffdisables the check. Unit tests and the docs example tests run inwarn, and the in-process benchmarks inoff, through fixtures with their ownMonkeyPatchcontext, because they address state with plain tokens. The self-hosting page lists/_reflex/sessionwith the routes that a reverse proxy must forward.Related to ENG-12920, ENG-12921, ENG-9088.