Andrey Antukh 212ee6ef48
🐛 Scope components in share-link view-only bundles (#13118)
* 🐛 Scope share-link component reads to the allowed pages

A page-scoped share link exposed the primary file's components
map in get-view-only-bundle and authorized the file's components
fragment in get-file-fragment, leaking the stored shapes of
deleted components from pages the link excludes.

The share-link bundle now trims the primary file's components to
those referenced transitively from the allowed pages and emits them
inline; the membership path keeps the full map. The fragment scope
check no longer grants the components pointer to share links;
allowed page pointers remain readable.

AI-assisted-by: inkling-2-small-free

* 🐛 Tighten share-link bundle component retention

The share-link view-only bundle now carries only live components
referenced transitively from the allowed pages; deleted components
never travel (their stored shapes are the main vehicle of leaked
excluded-page content). This drops the reachability walk at deleted
references and removes the duplicated subtree helper in favor of the
canonical get-component-shapes.

Also adds membership retention and cycle regression tests, and drops
the private advisory identifiers from the new test comments.

AI-assisted-by: inkling-2-small-free

* ♻️ Apply the second review's fixes to the share-link fix

Ordering the namespace require so the format gate passes, renaming
the working bindings to what they hold, documenting the eager-realize
limitation at the realization site, sharing the same-file reference
predicate, and switching the fragment scope check to an allowlist of
the pages scope.

Test markers are anonymized; the walk-through-deleted contract and
the full-scope link get dedicated tests; pointer-mapped files assert
an inline referenced component and the empty-components form.

AI-assisted-by: inkling-2-small-free

* ♻️ Apply the third review's minor fixes to the share-link fix

Correct the comment about realization reuse, align the new test bindings,
and drop the tautological fixture assertions. Cover the fragment scope
for excluded pages, membership on pointer-mapped files, and the legacy
same-file reference form; make both permission memories state the
actual invariants.

AI-assisted-by: inkling-2-small-free

* 🐛 Scope the share-link library trim to the emitted bundle

The library trim walked the primary file's full components map, deleted
components included. A deleted component keeps its main-instance subtree
in :objects, so a library component instanced only inside those stored
shapes was retained in the linked libraries of the view-only bundle and
reached anonymous share-link viewers, metadata and stored shapes
included.

Walk the data the bundle emits instead: pages scoped to the link plus the
trimmed components map. Pages still come from the realized file, because
pointer-mapped pages only load in their own loader.

Covered by a regression test that instances two library components inside
a deleted primary component: only the library component the link's page
references survives the trim.

AI-assisted-by: deepseek-v4.1-flash
2026-11-20 12:06:02 +01:00
..