mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-11-18 16:08:56 +00:00
fix(cli): harden lambda destroy, snapshot media, upgrade and project file serving (#7509)
* fix(cli): lambda destroy runs SAM in a private folder and acts only on the selected stack - sam delete outside a checkout runs in a fresh private temp folder, removed afterwards, instead of the shared temp directory. - A stack state file must name the stack it is selected by. - destroy and deploy derive the video repository name from the stack name instead of trusting the recorded value. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(cli): snapshot keeps remote clips in a private folder and reads only allowed URLs - A video URL the download policy refuses (plain http, or a private, loopback or link-local host) is no longer handed to FFmpeg; the clip is skipped instead, as render does. - Remote clips are cached in a per-user, owner-only temp folder; a folder open to other users is never reused. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(cli): upgrade --project writes package.json through an exclusive temp file The rewrite now uses the shared atomic replace, which creates a fresh, unpredictable sibling with exclusive creation, so an existing package.json.tmp entry is never written through. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(cli): keep env files, Git data and tool records out of served and uploaded projects - play and present answer 404 for .env files, .git and the tools' private .hyperframes records, as Studio's preview does for the records. - publish and cloud render never stage an env file or tool record, even when markup references it, and never pull in an env file from outside the project. - Cloud site uploads (Lambda and Cloud Run deploySite) leave env files out. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(cli): lambda commands accept a state file whose stack name differs only in case On a case-insensitive disk, deploy --stack-name=Demo and --stack-name=demo share one state file, so a name that matches apart from case is the same stack the user deployed and keeps working as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(cli): snapshot's fallback media folder uses createStagingDir The repository check forbids bare mkdtemp beside a caller-supplied path, because it fails past 260 characters on Windows. Also trims a comment so the new helper file stays within its package's comment share. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(cli): snapshot never hands FFmpeg a remote URL FFmpeg follows redirects and resolves hosts on its own, so a clip the downloader could not fetch must not reach it as a URL. Snapshot now leaves such a clip out and warns, as render does. A fallback media folder is removed when the process exits. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(cli): cover .envrc, .env-local and .env_prod, and test present's private-file 404 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
cf90054613
commit
c96ff540c4
@@ -0,0 +1,18 @@
|
||||
import { relative } from "node:path";
|
||||
import { isPrivateProjectFile, realFilePath } from "@hyperframes/studio-server/safe-path";
|
||||
|
||||
const ENV_FILE = /^\.env([._-].*|rc)?$/;
|
||||
|
||||
export function isEnvOrGitPath(path: string): boolean {
|
||||
const segments = path.toLowerCase().split(/[\\/]/);
|
||||
return segments.includes(".git") || ENV_FILE.test(segments.at(-1) ?? "");
|
||||
}
|
||||
|
||||
/** Project files no composition loads, so none is served or uploaded for one: env files, Git data, tool records. */
|
||||
export function isPrivateCompositionFile(projectDir: string, filePath: string): boolean {
|
||||
return (
|
||||
isEnvOrGitPath(relative(projectDir, filePath)) ||
|
||||
isEnvOrGitPath(relative(realFilePath(projectDir), realFilePath(filePath))) ||
|
||||
isPrivateProjectFile(projectDir, filePath)
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user