heygen-com/hyperframes · critical · Error

Unsafe target "${target}": absolute paths are not allowed.

Error message

Unsafe target "${target}": absolute paths are not allowed.

What it means

Thrown by assertSafeTarget when a registry file target is an absolute path. The guard runs at install time as a defense-in-depth backstop to the JSON schema pattern check, ensuring a registry that bypassed schema validation still can't write outside the project destDir.

Source

Thrown at packages/cli/src/registry/installer.ts:96

export function hasLocalEdits(
  record: InstallRecord,
  target: string,
  onDisk: Buffer | string,
): boolean {
  const installed = record[target];
  if (!installed) return true;
  return installed !== digest(onDisk);
}

/**
 * Reject target paths that would escape `destDir`. Mirrors the pattern check
 * in `packages/core/schemas/registry-item.json#files.items.target`, but runs at
 * install time so a registry that bypasses schema validation still can't write
 * outside the project.
 */
export function assertSafeTarget(destDir: string, target: string): void {
  if (isAbsolute(target)) {
    throw new Error(`Unsafe target "${target}": absolute paths are not allowed.`);
  }
  if (/(^|[/\\])\.\.([/\\]|$)/.test(target)) {
    throw new Error(`Unsafe target "${target}": path segments may not contain "..".`);
  }
  if (/^[A-Za-z]:[/\\]/.test(target)) {
    throw new Error(`Unsafe target "${target}": Windows drive letters are not allowed.`);
  }
  const resolved = resolve(destDir, target);
  const rel = relative(resolve(destDir), resolved);
  if (rel.startsWith("..") || isAbsolute(rel)) {
    throw new Error(`Unsafe target "${target}": resolves outside destDir ${destDir}.`);
  }
}

function isInstalledRegistryBlockComposition(item: RegistryItem, file: FileTarget): boolean {
  return (
    item.type === "hyperframes:block" &&
    file.type === "hyperframes:composition" &&

View on GitHub (pinned to c2996c8626)

Solutions

  1. Change the registry item's file target to a project-relative path
  2. Validate registry items against packages/core/schemas/registry-item.json before publishing
  3. Refuse to install registry items whose targets are absolute
  4. Audit third-party registries before adding them

Example fix

// before
{ "target": "/opt/app/assets/x.html" }
// after
{ "target": "assets/x.html" }
Defensive patterns

Strategy: validation

Validate before calling

import { isAbsolute } from "node:path";
function safeTarget(target: string): boolean {
  return !isAbsolute(target);
}

Type guard

import { isAbsolute } from "node:path";
function isRelativeTarget(target: string): boolean {
  return !isAbsolute(target);
}

Prevention

When it happens

Trigger: assertSafeTarget(destDir, target) is called for each file target during install; isAbsolute(target) is true (e.g. '/etc/passwd', '/usr/local/bin/x') → throw at installer.ts:96.

Common situations: A malicious or buggy registry item declares a file target starting with '/'; Windows UNC/slash absolute paths; hand-crafted registry JSON that skipped the schema; a path-joining bug upstream producing an absolute target.

Related errors


AI-assisted analysis of heygen-com/hyperframes@c2996c8626 (2026-08-12). Data as JSON: /api/errors/6f2f6d8086267a36. Report an issue: GitHub.