Skip to content

fix(cli): templates pull unpacks only plain files and folders - #7576

Merged
jrusso1020 merged 2 commits into
mainfrom
fix/templates-pull-plain-files
Nov 12, 2026
Merged

jrusso1020 merged 2 commits into
mainfrom
fix/templates-pull-plain-files

Conversation

@jrusso1020

Copy link
Copy Markdown
Collaborator

What

hyperframes templates pull now refuses an archive that holds anything other than plain files and folders, such as a symlink, hard link or device entry. Nothing is unpacked in that case, and no partial folder is left behind.

Why

A pulled template lands inside the user's project, where preview, render and publish treat its files as project content. A link in there would let those tools reach files elsewhere on the machine. Desktop already unpacks its example films and templates under this rule, and the CLI was the one unpacker that didn't.

Related work

No overlapping open PR.

How

assertSafeEntries already lists the archive's names and refuses any absolute or .. path. It now also reads the long listing (tar -tvzf -), whose first character is the entry type, and refuses any line that doesn't start with - (file) or d (folder). GNU tar and bsdtar both print it this way.

Test plan

  • Unit test added: an archive holding a symlink is refused, and no templates/<slug> folder remains. vitest run src/commands/templates.test.ts passes 21/21. With templates.ts reverted to main, the new test fails and the other 20 pass.
  • lint, format, typecheck and fallow pre-commit hooks pass.
  • Manual testing performed (not applicable; the published templates hold only plain files and folders)
  • Documentation updated (not applicable)
  • Comments follow CONTRIBUTING.md "Comments".

— Rames Jusso

🤖 Generated with Claude Code

`templates pull` already refuses entries that climb out of the target
folder. It now also reads the archive's long listing and refuses any entry
that isn't a plain file or folder (a symlink, hard link or device), the
same rule Desktop applies when it unpacks example films and templates.

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

@heygengenesis heygengenesis Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: REQUEST CHANGES · 1 blocker · 0 important · 0 nits · cafe76ac62

The fix itself is right: the symlink test fails with templates.ts reverted and passes on this head (21/21 locally). GNU tar lists hard links as h, symlinks as l and FIFOs as p, so all three are refused. The one blocker is the red Comments run. ↓ inline

Scope

Read templates.ts (assertSafeEntries, extract, unpack) and the new test. The archives are already pinned by sha256 and byte count, so this is defence in depth. I didn't download the published packs to confirm they contain no hard links. The PR body says they hold only plain files and folders.

— Genesis

Comment thread packages/cli/src/commands/templates.ts Resolved
…mmenting it

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

@heygengenesis heygengenesis Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: APPROVE — 1 resolved, 0 open, 0 new · cafe76ac62 → 33bb980b6e. CI is green; attempt 1 failed only on the producer stall test (renderOrchestrator.stall.test.ts), which this diff doesn't touch.

— Genesis

@jrusso1020
jrusso1020 added this pull request to the merge queue Nov 12, 2026
Merged via the queue into main with commit ab66e5b Nov 12, 2026
109 of 111 checks passed
@jrusso1020
jrusso1020 deleted the fix/templates-pull-plain-files branch November 12, 2026 01:22
@heygengenesis heygengenesis Bot mentioned this pull request Nov 12, 2026
terencecho added a commit that referenced this pull request Nov 12, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sshlg pushed a commit to ssheleg/hyperframes-agent that referenced this pull request Nov 12, 2026
* chore: release v0.9.37

* docs(release): add heygen-com#7576 to v0.9.37 notes

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

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant