Sanitize entry paths (the traversal gate)
sanitize_entry_pathsSanitize archive entry names by resolving each to a safe relative path or null when a rule blocks it. Use this to guard extraction or filesystem writes against path traversal, absolute paths, and reserved names.
Instructions
Apply zipnative's single traversal gate sanitizeEntryPath() to a list of names: the safe '/'-separated relative form each maps to (join it under your extraction root — never the raw name), or null with the rule that fired (empty, NUL byte, absolute, drive letter, UNC, '..' traversal, NTFS alternate data stream ':', Windows reserved device name CON/NUL/COM1…). Use it when you extract with another tool or plan an external filesystem sink. No archive needed.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| names | Yes | Entry names to check (as stored in an archive). | |
| fields | No | Dot-path projection applied after verbosity (e.g. ['entryCount', 'entries.name']); array segments map over elements; unmatched paths are reported in _meta.unmatchedFields. | |
| verbosity | No | 'summary' returns only the scalar verdict fields (drops arrays and payloads) — the token-frugal form. | full |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| count | No | ||
| results | No | ||
| rejectedCount | No | ||
| rejectedNames | No | summary only: the rejected names. |