docs(browser-files): dispose the file runtime on logout or account switch (02-03)
The runtime does not know the session, so File refs, preview leases and downloads of the previous user outlived a logout. Section 3.5 and the recipe lifecycle now say to dispose it, via a scope reset participant if needed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
9a56741357
commit
c8e4794860
@@ -192,7 +192,7 @@
|
||||
"port": "FilePickerPort / FileContentPort / TransientPreviewPort / DownloadDeliveryPort / PresignedDownloadSourcePort / PresignedUploadPartPort / ResumableUploadPort / ImageCdnPresentationPort",
|
||||
"fake": "Memory file/preview/download adapters plus injected deterministic capability, upload-control-plane, part-executor and image-verifier test doubles",
|
||||
"failureKinds": ["dismissed", "permission-denied", "count-or-size-rejection", "type-or-signature-rejection", "file-changed", "abort", "integrity-failure", "partial-save", "expired-or-revoked-capability", "part-or-session-conflict", "checkpoint-conflict", "quarantined", "image-policy-rejection"],
|
||||
"lifecycleMethods": ["release-file-ref", "release-or-dispose-preview-leases", "cancel-via-AbortSignal", "reconcile-or-explicitly-abort-upload", "close-checkpoint-store", "dispose-capability-and-image-runtime"],
|
||||
"lifecycleMethods": ["release-file-ref", "release-or-dispose-preview-leases", "cancel-via-AbortSignal", "reconcile-or-explicitly-abort-upload", "close-checkpoint-store", "dispose-capability-and-image-runtime", "dispose-browser-file-runtime-on-logout-or-account-switch"],
|
||||
"owner": "project-owner-required",
|
||||
"securityPrivacy": ["Treat file name, extension, MIME and lastModified as untrusted metadata.", "Resolve only exact composition-issued file and image policy object identities; callers cannot raise byte, candidate, pixel, quality, format, lifetime or origin ceilings.", "Use opaque file references and verification receipts bound to an inspected immutable file snapshot and the exact registered profile; reject replay through another profile even when an inspection rule ID matches.", "Treat presigned URLs as bearer capabilities; bind exact method, resource or upload part, offset, length, media type, checksum, origin, path, query, headers and expiry in an in-memory identity vault.", "Use credentials omit, redirect error, no-referrer and no-store for direct data-plane fetch; never persist or observe URL, query, signed header, capability, file name or raw backend message, and never emit digest, raw ETag or receipt values to diagnostics or telemetry.", "A strict account-partitioned upload checkpoint may persist only the protocol-defined SHA-256 file fingerprint, per-part checksum and bounded opaque non-authorizing part receipt token required for server reconciliation; no bearer token or raw signed capability is allowed.", "Persist only strict non-authorizing upload checkpoints and reconcile them with server-authoritative status and re-hashed local parts before completion.", "Require a synchronous server-issued browser-managed download capability whose receipt exactly equals the caller's branded capability receipt and whose resource, media type, safe extension, maximum bytes, optional digest and expiry all match before handoff.", "Expose File, OPFS, Cache and transfer byte streams only as chunk-level closed Results; stop after the first failure, cancel native readers and never throw a raw native exception across the port.", "Accept Image CDN assets only through immutable allowlisted or signature-verified descriptors and registered preset identities; reject active formats, arbitrary transforms, pixel/decode-budget overflow and unsafe cache policy.", "Upload completion remains QUARANTINED until backend scan and promotion; client capability checks are not an authorization boundary.", "Active content preview requires isolation or download-only treatment."],
|
||||
"bundleBudgetGzipBytes": 55600,
|
||||
|
||||
@@ -355,6 +355,14 @@ digest 또는 별도 검토된 streaming hash adapter를 사용한다.
|
||||
모든 active lease를 즉시 revoke한다.
|
||||
- URL을 global state, IndexedDB, query cache, log, analytics에 보관하지 않는다.
|
||||
- Service Worker에서 object URL을 사용하지 않는다.
|
||||
- 로그아웃·계정 전환에서는 runtime 전체를 dispose한다. browser file runtime은
|
||||
세션을 모른다(`src/adapters/browser-files/create-browser-file-runtime.ts:93`).
|
||||
`runtime.dispose()`(`:177-185`)가 이전 사용자가 고른 File 참조, preview lease,
|
||||
진행 중 download(`download-delivery-adapter.ts:385-391`)를 한 번에 닫는다.
|
||||
runtime을 route·feature보다 오래 사는 곳에서 만들었다면 server-state scope
|
||||
reset participant(`src/adapters/query-cache/server-state-scope-runtime.ts:19`,
|
||||
등록 예 `src/bootstrap/runtime-adapters.ts:410-416`)로 `dispose()`를 등록하고
|
||||
다음 세대에서 새 runtime을 만든다. dispose한 runtime은 다시 쓸 수 없다.
|
||||
- SVG, HTML, untrusted PDF 같은 active content를 same-origin object URL iframe에
|
||||
직접 preview하지 않는다. 별도 격리 origin 또는 안전한 decode/re-encode 결과,
|
||||
아니면 attachment-only 정책을 사용한다.
|
||||
|
||||
Reference in New Issue
Block a user