Files
hyperframes/packages/studio-server/src
Michael Wang 70820b386f fix(studio-server): cache reads never follow a link the project ships (#8039)
* fix(studio-server): cache reads never follow a link the project ships

The waveform and peaks caches, the thumbnail cache, the stored preview
documents and the preview proxy copies all live in folders inside the
project, which its author controls. Their reads opened entries with
link-following calls, so a project could ship a link at a predictable cache
name and have Studio return the file it pointed at.

Each of these reads now goes through readProjectCacheFile or
isProjectCacheFile: the entry must be a plain file, reached with no link
from the project folder down, and is opened without following links.
Anything else is a miss, and the entry is rebuilt.

- Waveform and peaks entries must also parse as an array of numbers.
- A proxy copy, its fast and content index files, and the pieces of a
  chunked copy count only as plain files.
- Stored preview documents carry an HMAC under the user's private preview
  token, so a document the project shipped is never served. Without a
  token, nothing is stored.

* fix(studio-server): the proxy copy lock treats a link at the copy name as not made

The copy lock tested "the copy already exists" with a link-following check,
and the transcoder returned the copy path unchecked when the lock said
another process had made it. A link at the copy name was then served.

- acquireCopyLock takes the caller's "copy made" test; the transcoder
  passes isProjectCacheFile and re-checks the path before returning it.
- Copy index files are written by rename, so a link at an index name is
  replaced instead of written through.
- Chunk pieces are checked from the project folder down, like every other
  cache entry.
- A cache entry with more than one name (a hard link) is a miss.
2026-11-17 06:31:06 +00:00
..