--- name: zip-filename-encoding-audit description: "Inspect bounded ZIP central-directory filename bytes for UTF-8 flag errors, Unicode path extra-field conflicts, and decoded-name collisions." category: development risk: safe source: self source_type: self date_added: "2026-12-02" author: Koushik-Katkam tags: [zip, encoding, portability] --- # ZIP Filename Encoding Audit ## Overview Evaluate the stored names of an archive before it is extracted. Compare the selected central-directory representation with the language-encoding bit and Unicode Path field. The result applies to the supplied evidence and the selected profile. ## When to Use - Use when names display incorrectly across ZIP consumers or when a release needs an encoded-name compatibility check. - Use a committed-tree audit for pre-export path conflicts and an independent member inventory for expected payload bytes. ## Prerequisites Supply one approved local single-disk ZIP using the ordinary 32-bit central-directory format. The harness uses Python 3.12 and its standard library. Use [the verification reference](references/verification.md) for the input contract and runnable block. ## How It Works ### 1. Establish the inputs Record the archive identity and the chosen legacy code-page profile. Bound file size, central-directory length and entry count before reading member fields. ### 2. Perform the task Inspect general-purpose bit 11, the name bytes, and optional extra field 0x7075. Use UTF-8 for a set bit. For the documented legacy profile use CP437 unless an applicable version-1 Unicode Path value passes its name CRC check. ### 3. Verify the result Report the entry index and the conflicting rule. Use a separate extraction-policy review if the task also concerns paths, file modes, links, or contents. ## Examples A ZIP producer writes a UTF-8 filename and a stale Unicode Path extra-field CRC. The illustrative expected result is `unicode_path_crc_mismatch` for that entry. Run `python -I verify.py --self-test` on the extracted reference. Audit the selected fixture or evidence with `python -I verify.py --audit release.zip`. ## Limitations - ZIP64, multi-disk archives, masked names, and directory extensions outside the fixed profile are refused. - Central-directory checks do not establish local-header agreement, target filesystem safety, or decompression integrity. - Bit 11 and extra-field layout follow APPNOTE. Legacy decoder selection is compatibility. Rejecting duplicate decoded names is the fixture's policy. ## Safety and side effects Read a bounded local file in a stable directory. Interpret metadata only. Keep members compressed and leave the archive untouched. ## Sources and related skills - [PKWARE ZIP APPNOTE, sections 4.4.4 and 4.6.9](https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT) - [epub-accessibility-audit](https://github.com/sickn33/agentic-awesome-skills/blob/00a4cf931d73804619de50f776cf406a85a77844/skills/epub-accessibility-audit/SKILL.md) - [dotlottie-bundle-validation](https://github.com/sickn33/agentic-awesome-skills/blob/00a4cf931d73804619de50f776cf406a85a77844/skills/dotlottie-bundle-validation/SKILL.md)