Files
hyperframes/packages/studio-server/package-subpaths.json
T
f318d3d08a fix(studio-server): refuse cross-origin writes and unknown hosts on the preview server (#7490)
* fix(studio-server): reject cross-origin state-changing requests

Non-GET routes in createStudioApi answer 403 unless the shared
sameOriginPost predicate (lifted into studio-server's ./request-identity
subpath) accepts the request: the Host must be a server identity, a
present Sec-Fetch-Site must be same-origin, and a present Origin must
match the effective host and scheme. Hosts behind Codespaces or tunnels
allow their public name with HYPERFRAMES_PREVIEW_ALLOWED_HOSTS, read by
`hyperframes preview` and the Studio dev server.

Squashed from #6128 (42574a7, 110a300, 89011e1, 41c6626, 27193bb) onto
current main.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(cli): the preview server answers only the hosts it is reached by

Every route of `hyperframes preview` (the forwarded studio API, the SSE
stream, /__hyperframes_config and the Studio page) now answers only
loopback names, the HYPERFRAMES_PREVIEW_HOST bind, or a host listed in
HYPERFRAMES_PREVIEW_ALLOWED_HOSTS, the same list the write guard uses.
Only the Host header counts here, since a page can set X-Forwarded-Host
on its own requests and a read carries no Origin to compare it with.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Dextheking1 <Dextheking1@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 10:14:23 +00:00

115 lines
4.0 KiB
JSON

{
"package": "@hyperframes/studio-server",
"localNodeRuntime": true,
"subpaths": {
".": {
"source": "./src/index.ts",
"runtime": "./dist/index.js",
"types": "./dist/index.d.ts",
"environments": ["bun", "node"]
},
"./package.json": {
"source": "./package.json",
"runtime": "./package.json",
"types": null,
"environments": ["bun", "node"]
},
"./screenshot-clip": {
"source": "./src/helpers/screenshotClip.ts",
"runtime": "./dist/helpers/screenshotClip.js",
"types": "./dist/helpers/screenshotClip.d.ts",
"environments": ["bun", "node"]
},
"./safe-path": {
"source": "./src/helpers/safePath.ts",
"runtime": "./dist/helpers/safePath.js",
"types": "./dist/helpers/safePath.d.ts",
"environments": ["bun", "node"]
},
"./request-identity": {
"source": "./src/helpers/requestIdentity.ts",
"runtime": "./dist/helpers/requestIdentity.js",
"types": "./dist/helpers/requestIdentity.d.ts",
"environments": ["bun", "node"]
},
"./hf-ids": {
"source": "./src/helpers/hfIdPersist.ts",
"runtime": "./dist/helpers/hfIdPersist.js",
"types": "./dist/helpers/hfIdPersist.d.ts",
"environments": ["bun", "node"]
},
"./history": {
"source": "./src/history/index.ts",
"runtime": "./dist/history/index.js",
"types": "./dist/history/index.d.ts",
"environments": ["bun", "node"]
},
"./manual-edits-render-script": {
"source": "./src/helpers/manualEditsRenderScript.ts",
"runtime": "./dist/helpers/manualEditsRenderScript.js",
"types": "./dist/helpers/manualEditsRenderScript.d.ts",
"environments": ["bun", "node"]
},
"./studio-motion-render-script": {
"source": "./src/helpers/studioMotionRenderScript.ts",
"runtime": "./dist/helpers/studioMotionRenderScript.js",
"types": "./dist/helpers/studioMotionRenderScript.d.ts",
"environments": ["bun", "node"]
},
"./draft-markers": {
"source": "./src/helpers/draftMarkers.ts",
"runtime": "./dist/helpers/draftMarkers.js",
"types": "./dist/helpers/draftMarkers.d.ts",
"environments": ["browser", "bun", "node"]
},
"./finite-mutation": {
"source": "./src/helpers/finiteMutation.ts",
"runtime": "./dist/helpers/finiteMutation.js",
"types": "./dist/helpers/finiteMutation.d.ts",
"environments": ["bun", "node"]
},
"./source-mutation": {
"source": "./src/helpers/sourceMutation.ts",
"runtime": "./dist/helpers/sourceMutation.js",
"types": "./dist/helpers/sourceMutation.d.ts",
"environments": ["browser", "bun", "node"]
},
"./media-codec-map": {
"source": "./src/helpers/mediaCodecMap.ts",
"runtime": "./dist/helpers/mediaCodecMap.js",
"types": "./dist/helpers/mediaCodecMap.d.ts",
"environments": ["bun", "node"]
},
"./proxy-transcoder": {
"source": "./src/helpers/proxyTranscoder.ts",
"runtime": "./dist/helpers/proxyTranscoder.js",
"types": "./dist/helpers/proxyTranscoder.d.ts",
"environments": ["bun", "node"]
},
"./loudness": {
"source": "./src/helpers/loudness.ts",
"runtime": "./dist/helpers/loudness.js",
"types": "./dist/helpers/loudness.d.ts",
"environments": ["bun", "node"]
},
"./media-proxy-preview": {
"source": "./src/helpers/mediaProxyPreview.ts",
"runtime": "./dist/helpers/mediaProxyPreview.js",
"types": "./dist/helpers/mediaProxyPreview.d.ts",
"environments": ["bun", "node"]
},
"./encoder-options": {
"source": "./src/helpers/encoderOptions.ts",
"runtime": "./dist/helpers/encoderOptions.js",
"types": "./dist/helpers/encoderOptions.d.ts",
"environments": ["bun", "node"]
},
"./media-range": {
"source": "./src/helpers/mediaRange.ts",
"runtime": "./dist/helpers/mediaRange.js",
"types": "./dist/helpers/mediaRange.d.ts",
"environments": ["bun", "node"]
}
}
}