Files
Dylan M. Taylor 62e673d95b fix: bind loaded video projects to their storage id (#238)
## What was wrong
When the video editor opened a project, `ProjectManager` copied the
document's embedded `project.metadata.id` into the active project. Every
later save (`saveCurrentProject`, background rename) passed that id to
`ProjectStorageAdapter.saveProject`, and the webapp adapter uses it as
the `UpdateProject` target token. The document body is user-authored, so
a crafted project could embed the token of another timeline the viewer
owns, and opening it would make the viewer's autosave overwrite that
timeline.

## What changed
- New `deserializeStoredProject(envelope)` in
`services/storage/serialization.ts`: deserializes the document and
replaces `metadata.id` with the id the storage adapter loaded it under.
- `ProjectManager.loadProject`, `openProject` and `renameProject`
(background path) use it.
- Regression test in `serialization.spec.ts`.

## Blast radius
Video editor library (webapp and any host using it). Saves now always
target the project that was opened. Legacy documents whose embedded id
was a stale `local-*` id are now bound to their real token on open,
which also stops them being re-created as new rows.

Addresses CodeRabbit security findings (CWE-441).

## Checks run
- `npx vitest run src/lib/services/storage src/lib/core` in
`libs/components/video-editor`: 13/13 pass.
- `npx tsc -p tsconfig.lib.json --noEmit` in
`libs/components/video-editor`: clean.

## Checks not run
- Manual editor test against the live API.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **Bug Fixes**
* Projects now retain their storage ID when loaded or opened, even if
the ID saved inside the project differs.
* Saving an opened project preserves its storage ID, and renaming a
background project updates the correct entry without activating it.
* Missing or invalid stored projects are handled without returning a
project, helping prevent unavailable project data from being treated as
a loaded project.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-11-11 11:13:58 -05:00
..
2026-09-01 10:25:21 +07:00
2026-09-01 10:25:21 +07:00
2026-09-01 10:25:21 +07:00
2026-09-01 10:25:21 +07:00
2026-09-01 10:25:21 +07:00
2026-09-01 10:25:21 +07:00
2026-09-01 10:25:21 +07:00
2026-09-01 10:25:21 +07:00
2026-09-01 10:25:21 +07:00