Concepts
Safety model
Rind assumes every archive is hostile. This page covers what it checks, the tests that exercise each check, and the limits of the claim.
What it promises
Rind is the engine inside Peel: the peel-core library
and the peel command, MCP server and C library built on it.
It reads archives from untrusted sources, so extraction is built around
four rules:
- Nothing is written outside the destination you chose.
- What an archive expands to is bounded while it is being written, not just read from its headers.
- A failed or cancelled extract leaves no half-made result.
- Failures are reported as a stable kind and exit code, never papered over. See errors.
Every claim here traces to a row in the project’s claim-to-evidence matrix, which names the control, the test and the limit. The matrix was checked against the source of Peel 1.4.0. It is a source-and-test review, not a runtime security audit. The public summary is at /safety.
Protect the destination
Every format adapter passes each entry name through one function,
sanitize_entry_name in
crates/peel-core/src/safety.rs, before it touches the disk.
A name is refused if it is empty, contains a NUL byte, is over 4096
bytes or 64 components deep, starts with /, or contains a
.. component. A backslash counts as a separator, so
..\x is a traversal too.
Here is a ZIP whose entries are named ok.txt,
../escape.txt and /etc/absolute.txt, written
byte for byte so no tool normalised the names:
peel x hostile.zip -o out; echo "exit $?"; ls out 2>&1 || true
peel: extract hostile.zip: path escape blocked: ../escape.txt
exit 13
ls: out: No such file or directorypeel 1.4.0, recorded 2026-11-26.The extract stops at the first bad name with the
unsafe_entry kind (exit 13), and no output folder
remains.
Listing is deliberately more tolerant than extracting.
peel list shows names as the archive stores them, and
peel inspect leaves the unsafe ones out of its entry
list:
peel ls hostile.zip; echo ---; peel inspect -j hostile.zip | grep '"name"'
ok.txt
../escape.txt
/etc/absolute.txt
3 entries
---
"name": "ok.txt",peel 1.4.0, recorded 2026-11-26.A name that passes is still not trusted as a path.
safe_destination checks that no existing ancestor in the
destination is a symbolic link, so a link that was already there is
never written through.
Links
Links inside an archive are the second way out of a folder. Rind creates them last, after every file is written:
- A symbolic link is kept only if it resolves inside the extracted folder. Absolute targets, targets over 4096 bytes, chains of more than 32 hops, and links that lead out through another link are skipped.
- A hard link is made only to a regular file the same archive already extracted.
- 7z extracts into a staging tree that must stay contained, and refuses any symbolic link in it, so a 7z with an internal link fails instead of keeping the link.
Because links come last, a link/pwned.txt entry after a
link -> ../outside entry has nothing to write
through.
Names and permissions
- An existing file is never replaced by default. A taken name gets a
new name (
Collision::Rename). The CLI’s-foverwrites when you ask. The app always renames. - Setuid, setgid and sticky bits are dropped, and the owner always gets read and write, so you can delete what was extracted. In 1.4.0 group and world write bits are kept as the archive set them.
Bound the expansion
A few kilobytes can be built to unpack into terabytes. Rind meters
the bytes as it writes them, through a ResourceBudget in
safety.rs. The defaults:
| Limit | Default | Behaviour |
|---|---|---|
| Entries | 1,000,000 | Refused above this. |
| Free space | The destination’s | An archive larger than the free space is refused before anything is written. A stream of unknown size stops when the disk would fill. |
| Declared size | 64 KiB of slack | An entry that runs more than 64 KiB past the size its header declares is stopped. |
| Compression ratio | 1000 times | Output over 1000 times the archive’s size is stopped. Checked once 1 GiB has been written. |
| Reading one member | 64 MiB | peel cat and the MCP read_member tool
refuse a larger member until you raise --max-bytes. |
| Nested archives | 16 levels | --deep stops there. It is off by default in the
app. |
There is no fixed total size cap, on purpose: a real 50 GB archive
has to extract. The ratio guard and the declared-size check stop bombs
long before the disk fills. Here is a 2 GiB file of zeros packed as
.tar.zst, which is 67,417 bytes:
ls -l bomb.tar.zst | awk '{print $5, $9}'; peel x bomb.tar.zst -o bout; echo "exit $?"; ls bout 2>&1 || true
67418 bomb.tar.zst
peel: extract bomb.tar.zst: This archive is 67.4 KB but unpacks to more than 1.1 GB, over 1000 times its size. It looks built to fill the disk, so nothing was extracted.
exit 9
ls: bout: No such file or directorypeel 1.4.0, recorded 2026-11-26.The extract fails with decompression_bomb (exit 9) and
leaves nothing behind. The numbers in the message come from the archive,
not from a fixed list.
Fail cleanly
An extract into a new folder that fails or is cancelled removes that
folder. An extract into a folder that already exists first writes into a
hidden .peel-stage- folder on the same volume and moves the
result in with a rename only when it succeeds, so a failure leaves only
what was there before. A merge that fails partway is journaled and put
back, and a step that cannot be undone leaves the file set aside, not
deleted. Cancelling with SIGTERM or Ctrl-C, or from the app, removes the
staging folder and any partial output. Staging folders left by a crashed
extract are cleared later, and a folder that only looks like one is
never touched.
A checksum mismatch fails the extract too. ZIP CRCs and the WinZip
AES MAC are checked as the entry is read, and peel test
reads every entry to the end and reports which fail:
peel test demo.zip; echo "exit $?"
OK Zip 11 entries, 8 verified, 0 unchecked demo.zip
exit 0peel 1.4.0, recorded 2026-11-26.Reading one file
Reading a single member goes through the same name checks.
peel cat demo.zip ../x fails with invalid_name
(exit 12). A read is bounded by --max-bytes, and
--offset and --length read a window of at most
1 GiB:
peel cat demo.zip project/docs/chapter-1.md --offset 10 --length 30; echo " [exit $?]"; peel cat demo.zip project/docs/chapter-1.md --max-bytes 100; echo "exit $?"
lorem ipsum dolor sit amet lor [exit 0]
peel: project/docs/chapter-1.md is larger than the read limit of 100 bytes; raise it with --max-bytes
exit 10peel 1.4.0, recorded 2026-11-26.The MCP server
peel mcp adds a path allow-list in front of the engine.
The tools that write, extract and create, only
touch the roots you pass with --root, the roots the client
offers, or the home folder when there are neither. Paths are resolved
first, so a link inside a root cannot lead out of it, and protected
folders such as ~/.ssh, ~/Library/Keychains
and /etc are refused whatever the roots.
create will not replace an existing file unless the call
sets overwrite: true. At most 16 archives are open at once.
See MCP.
How it is tested
The core of the evidence is
crates/peel-core/tests/adversarial.rs, 28 tests at the
1.4.0 release commit. Each builds its hostile archive in code, extracts
it beside a guard file, and requires that:
- nothing was written outside the destination,
- the guard file is unchanged,
- no symbolic link or hard link to an outside file exists in the output.
Controls such as control_detects_a_file_written_outside
prove the checks themselves fail when they should. Some of the named
tests:
| Test | What it covers |
|---|---|
zip_traversal_names, tar_traversal_names,
sevenz_traversal_names |
../, nested a/../../, absolute and
backslash names |
zip_symlink_then_write_through_it,
tar_symlink_then_write_through_it |
A link followed by a file named through it |
zip_symlink_chain_that_escapes_through_another_link_is_removed |
Two links that together lead out |
tar_hard_link_to_outside_file |
A hard link to a file Peel did not extract |
setuid_bits_are_dropped |
Special permission bits |
zip_bomb_is_stopped_by_the_entry_budget |
A 64 MiB single-entry bomb under a tight budget |
safe_destination_refuses_paths_through_an_existing_symlink |
A symbolic link already in the destination |
Other suites cover the rest: clean_failure.rs (an error
never comes back with output in place),
decompression_bombs.rs (the ratio guard on a stream with no
size and on a tar with honest sizes), free_space.rs,
cancel_cleanup.rs, macos_fidelity.rs
(quarantine against ditto and bsdtar), and 10
fuzz targets under fuzz/fuzz_targets/ with regression
inputs. Disk images and app bundles have their own hostile tests, built
at test time with hdiutil. Fuzzing runs on demand, not on
every change.
Where it stops
The limits are part of the claim:
- Hostile fixtures cover ZIP, TAR (including
.tar.gz), 7z, DMG and app bundles. RAR relies on name checks, UnRAR’s own link checks and a post-write link check, with no hostile RAR fixture, because no RAR writer exists outside the proprietary tool. About twenty rarer formats use the same shared checks without fixtures of their own. - Decoder memory and CPU time are not bounded, only what is written to disk. Fuzzing is the defence there.
- A crash, power loss or failing disk can leave a partly
written new folder. Cleanup covers errors Peel handles and
cancellation. Nothing is
fsynced. - The 1000 times ratio check is off for DMG and app bundles.
- Quarantine is best effort. Files from a downloaded archive keep macOS’s download flag, but drives that cannot store extended attributes (FAT, some network shares) do not get it, and an archive without the flag passes nothing on.
- Previews, Spotlight and mounts parse untrusted data with their own, smaller limits and are not covered by the extraction tests.
- Plain
.tarhas no checksum for file data, only for headers. 7z and RAR depend on their libraries’ own checks.
See formats for what each format supports, and architecture for where these checks sit in the layers.