anthropics/skills · error · ValueError

symlink archive entry not allowed: {m.filename!r}

Error message

symlink archive entry not allowed: {m.filename!r}

What it means

pptx copy of the symlink extraction guard (same as error 6): safe_extract() refuses any zip member stored with symlink mode bits before extracting, preventing crafted archives from planting links that redirect subsequent writes outside the destination (zip-slip via symlink). Standard PPTX files never contain symlinks, so hitting this means the input is crafted or non-standard.

Source

Thrown at skills/pptx/scripts/office/helpers/__init__.py:78

    return posixpath.join(owner_dir.as_posix(), rels_file.name[: -len(".rels")]).lstrip("./")


def part_text(data: bytes) -> str:
    return data.decode("utf-8", "surrogateescape")


XML_SPACE = " \t\r\n"


def rendered_text(text: str, preserve: bool) -> str:
    return text if preserve else text.strip(XML_SPACE)


def safe_extract(zf: zipfile.ZipFile, dest: Path) -> None:
    dest = dest.resolve()
    for m in zf.infolist():
        if stat.S_ISLNK(m.external_attr >> 16):
            raise ValueError(f"symlink archive entry not allowed: {m.filename!r}")
        target = (dest / m.filename).resolve()
        if not target.is_relative_to(dest):
            raise ValueError(f"unsafe archive entry: {m.filename!r}")
        zf.extract(m, dest)


def rezip(src_dir: Path, out_path: Path) -> None:
    files = sorted(p for p in src_dir.rglob("*") if p.is_file())
    ct = src_dir / "[Content_Types].xml"
    fd, tmp_name = tempfile.mkstemp(
        prefix=out_path.name + ".", suffix=".tmp", dir=out_path.parent
    )
    tmp_out = Path(tmp_name)
    try:
        with os.fdopen(fd, "wb") as fh:
            with zipfile.ZipFile(fh, "w", zipfile.ZIP_DEFLATED) as zf:
                if ct.exists():
                    zf.write(ct, ct.relative_to(src_dir), compress_type=zipfile.ZIP_STORED)

View on GitHub (pinned to f6656c1256)

Solutions

  1. Quarantine the input; the guard correctly flagged a dangerous archive.
  2. If you built the archive, rebuild it from plain files with no symlinks.
  3. Add a pre-scan step rejecting S_ISLNK entries before the pipeline touches the file.
  4. Trace which producer created the symlink entry and fix it.

Example fix

# pre-scan gate
import stat, zipfile
def has_symlinks(path):
    with zipfile.ZipFile(path) as zf:
        return any(stat.S_ISLNK(m.external_attr >> 16) for m in zf.infolist())
if has_symlinks(upload):
    quarantine(upload)
Defensive patterns

Strategy: validation

Validate before calling

import stat, zipfile

def has_symlink_entries(path: str) -> bool:
    with zipfile.ZipFile(path) as zf:
        return any(stat.S_ISLNK(m.external_attr >> 16) for m in zf.infolist())

Try / catch

from office.helpers import safe_extract
try:
    safe_extract(zf, dest)
except ValueError as e:
    if "symlink archive entry" in str(e):
        quarantine(path)
    else:
        raise

Prevention

When it happens

Trigger: Unpacking a pptx/zip with an entry whose external_attr indicates S_IFLNK — e.g. 'ppt/presentation.xml -> /etc/passwd' — during any unpack-based pipeline step.

Common situations: Untrusted uploaded decks; archives rebuilt with symlink-preserving tools; security testing payloads.

Related errors


AI-assisted analysis of anthropics/skills@f6656c1256 (2026-08-14). Data as JSON: /api/errors/4aa8df7c70cf3b3a. Report an issue: GitHub.