How open-context Guards Against Zip Slip on ChatGPT Exports
open-context never writes a file from an uploaded ZIP without first confining the extraction to a
single-use temporary directory, and it relies on adm-zip's built-in path-containment
checks to block "Zip Slip" — the directory-traversal bug class that lets a crafted archive escape
its intended extraction folder. That's the short answer to "is it safe to upload my ChatGPT export
here," and the rest of this post walks through exactly what happens, step by step, between the
moment you pick a ZIP file and the moment its contents become markdown.
Key takeaways
- Every uploaded ZIP is extracted into a fresh, single-use temp directory — never a shared or long-lived folder.
adm-zip, the library open-context uses, has shipped a path-containment check since the version that fixed CVE-2018-1002204, the original "Zip Slip" bug in the package; open-context pins a release line well past that fix.- Zip Slip itself is a 2018 Snyk disclosure (CWE-22): a malicious entry name like
../../etc/cron.d/xcan make a naive extractor write outside the target folder. - Extraction fails closed — if
conversations.jsonisn't found after extracting, the extractor throws immediately and no parser ever touches the files. - Cleanup is unconditional: both the uploaded ZIP and the extracted temp directory are removed in a
finallyblock, whether the conversion succeeds or fails.
Why a ZIP importer needs a security story at all
It's tempting to wave this off because "it's just your own export file." But the actual attack
surface isn't who created the file — it's the shape of the code that handles it: a file-shaped
input gets parsed by a program with filesystem write access. That's exactly the pattern behind
Zip Slip,
the archive-extraction vulnerability class Snyk's security research team publicized in 2018. A ZIP
(or TAR, JAR, WAR, or RAR) entry can carry a name like ../../../home/user/.bashrc, and
an extractor that blindly joins that name onto its target directory will happily write outside it.
open-context's whole job is reading a third-party export archive and writing files to disk from its
contents — so it's worth being explicit about what that step can and can't do, even when the "third
party" is an export you generated yourself.
What actually happens when you upload a ZIP
Both entry points — the CLI's convert command and the web UI's
/api/convert endpoint — route through the same ZipExtractor class in
src/extractor.ts. The web UI adds one extra hop: Multer saves the upload to a temp
uploads folder on disk first, since ZipExtractor needs a file path, not a stream.
1. Every extraction gets its own disposable directory
Before touching the archive, extractZip() creates a directory unique to that run —
join(tmpdir(), `opencontext-${Date.now()}`) — and every file the ZIP contains is
written inside it, nowhere else. There's no shared "uploads" folder that accumulates other users'
or other runs' files.
2. The library itself blocks path traversal
open-context extracts with adm-zip,
which had its own Zip Slip CVE: versions before 0.4.9 let a crafted entry name write outside the
target folder during extraction (CVE-2018-1002204).
The fix added a check that every resolved entry path must stay inside the destination folder before
it's written. A later audit (GHSL-2020-198)
found a bypass in that original prefix check and it was fixed shortly after. open-context's
package.json pins adm-zip@^0.6.0 — several major releases past both fixes
— so the library-level containment check is active by default, not something open-context has to
reimplement.
3. Content is validated, not just extracted
Extraction alone doesn't mean the archive is trusted. After extractAllTo() runs,
extractZip() checks that conversations.json actually exists in the temp
directory. user.json and an images/ directory are checked too, but
treated as optional — their paths come back undefined if absent rather than causing a
failure, since ChatGPT exports don't always include them.
4. Cleanup is unconditional, not best-effort
If the conversations.json check fails, or extraction throws for any other reason, the
catch block inside extractZip() calls cleanup() on the temp
directory before re-throwing — so a bad archive never leaves extracted files behind. On the happy
path, both the CLI and the server wrap the rest of the pipeline in a finally block:
the server's /api/convert route deletes the uploaded ZIP itself
(fs.rmSync(req.file.path)) and calls extractor.cleanup(tempDir)
regardless of whether conversion succeeded, failed partway through, or the Ollama analysis step
errored out.
What's deliberately out of scope
open-context doesn't run malware or antivirus scanning on uploaded archives, and the web UI's
upload route doesn't currently enforce a file-size limit. Neither omission is an oversight so much
as a reflection of the threat model: this is a local, self-hosted tool you run against your own
ChatGPT export, on your own machine or your own Docker host — not a multi-tenant service accepting
arbitrary files from the public internet. If you're embedding ZipExtractor in a context
where untrusted strangers upload archives, that's a materially different threat model, and you'd
want to add size limits and content scanning on top of what's described here.
Why this still matters for an export you made yourself
You trust OpenAI's export pipeline, and you trust your own download. The reason path-containment still matters is defense in depth: a corrupted download, a export file that's passed through other tools before reaching you, or simply a dependency with a bug shouldn't be able to turn "convert my chat history" into "write a file somewhere outside a temp folder." That's the same reasoning behind how open-context handles database credentials in its BYODB connection strings — treat every external input as something to validate and contain, not just something to parse.
Convert your own ChatGPT export in about five minutes.
See the full migration guide →FAQ
Is it safe to upload my ChatGPT export ZIP to open-context?
Yes. Extraction happens entirely on your own machine or your own Docker host, into a unique temporary directory created for that run only, using a zip library that validates every entry stays inside that directory before writing it.
What is "Zip Slip," and does it affect open-context?
Zip Slip is a directory-traversal vulnerability class, disclosed by Snyk in 2018, where a crafted archive entry name like ../../.ssh/authorized_keys makes a naive extractor write a file outside the intended folder. open-context's zip library, adm-zip, has included a path-containment check since the version that patched this exact bug (CVE-2018-1002204), and open-context pins a release line well past that fix.
Does open-context scan the ZIP for malware?
No. open-context doesn't run antivirus or content scanning on uploaded archives; it only extracts the archive and looks for conversations.json. Its threat model is a ZIP you exported yourself from your own ChatGPT account, not an arbitrary file from an untrusted third party.
What happens if my ZIP doesn't contain conversations.json?
The extractor throws "conversations.json not found in zip archive" immediately, and the partially extracted temporary directory is deleted on the way out. No parser ever runs against an archive that doesn't look like a ChatGPT export.
Does open-context keep a copy of my ZIP after conversion?
No. Both the uploaded ZIP and the extracted temporary directory are removed in a finally block, so cleanup runs whether the conversion succeeds or fails. Nothing from the archive persists past that single run except the markdown and preferences files you asked it to generate.