Session restore trusts tab group references without validating them on load
Categories
(Firefox :: Session Restore, defect, P3)
Tracking
()
People
(Reporter: ndokutovich, Assigned: ndokutovich)
References
Details
(Whiteboard: [fidefe-session-restore])
Attachments
(1 external file)
The invariant "a tab state may only reference tab groups defined in its own
window" is maintained by the writer and is not checked anywhere on the read side.
Only the writer keeps it true; every reader assumes it.
Where state enters without validation:
- SessionFile parses the state as JSON and checks the version, nothing else.
- session.schema.json defines no relationship between a tab's groupId and the
window's groups; the window definition does not even require groups. - the raw state can be rewritten by sessionstore-state-read observers before it is
parsed and reused. - SessionMigration reads another profile's file and reproduces the same shape.
Readers that assume the invariant (four, in different code paths):
- SessionStore.sys.mjs:7957 - #prepDataForDeferredRestore
- SessionMigration.sys.mjs:58 - profile migration
- Tabbrowser.sys.mjs:5204 - createTabsForSessionRestore (window restore)
- SessionStore.sys.mjs:2470 - #saveOpenTabGroupsOnClose (window close)
Consequences when a reference does not resolve:
- Window restore aborts at that tab and every later tab of the window is dropped.
The fallback for this one path is bug 2080608 / D332744. - In a deferred session the failure escalates instead of aborting: #initSession
returns the unprepared state and #initializeWindow restores from it, so a
DEFER_SESSION launch (automatic restore switched off) becomes a full automatic
restore of every window, cookies included.
Proposed direction: normalize unresolvable groupIds once where the state enters,
the way #migrateSplitViewIds already normalizes invalid splitViewIds. That covers
all four readers instead of the single path the fallback patches.
On prevalence: no naturally occurring case is known. The fallback in bug 2080608
was driven by a malformed input produced by a third-party session-file rewriter, so
this bug is about the read side being unable to detect or repair an inconsistent
state from any source, not about an observed Firefox write path.
Updated•1 month ago
|
Updated•1 month ago
|
| Assignee | ||
Comment 1•26 days ago
|
||
The invariant that a tab state only references tab groups defined in the same
window is maintained by the state writer and not enforced anywhere on the read
side: the file is parsed as-is, and sessionstore-state-read observers may rewrite
it. Every reader assumes it holds, and one of them dropped the rest of a window's
tabs when it did not.
Repair the state once, where it enters the store, the way #migrateSplitViewIds
already repairs invalid splitViewIds: walk the windows of the incoming state and
of its nested deferred and last-session states, and drop any groupId that the
window does not define, so the tab is restored ungrouped instead.
Profile migration makes the same assumption and threw before the state reached
SessionStore, so it gets the matching guard.
Updated•26 days ago
|
Comment 3•1 day ago
|
||
The following patch is waiting for review from an inactive reviewer:
| ID | Title | Author | Reviewer Status |
|---|---|---|---|
| D338055 | Bug 2083249 - Drop tab group references that do not resolve on load. | ndokutovich | jswinarton: Back Dec 7, 2026 |
:ndokutovich, could you please find another reviewer?
For more information, please visit BugBot documentation.
| Assignee | ||
Comment 4•1 day ago
|
||
Holding this until the telemetry from bug 2092154 (D342632) produces a baseline; will revisit then.
Updated•1 day ago
|
Description
•