Archive names become extraction paths
A slash or parent-directory component in an entry name can have consequences after extraction. Duplicate names can overwrite earlier files or confuse reviewers. A manifest makes the bundle understandable without requiring unsafe filenames full of prompt text.
What to do next
- 01
Freeze the bundle selection
Record the exact authorized asset IDs and versions included in the export. Do not let a changing selected-output pointer silently alter the bundle while it is being built, and recheck access at the export boundary.
- 02
Generate unique safe entries
Use a conservative root plus stable identifiers and validated extensions. Reject absolute paths, parent traversal and duplicate normalized names; keep descriptive titles in manifest fields rather than path components.
- 03
Verify before publishing
List archive entries and compare them with the frozen manifest, checking counts and unique names. Test titles containing separators, dots and Unicode variants, and bound total uncompressed size and scratch usage during construction.
A concrete example
Illustrative example: two projects share the title Final. The bundle contains assets/a17.png and assets/a23.png, with a manifest linking each to its project and revision. Neither file overwrites the other when extracted.
Before you call it ready
- Archive paths remain inside the intended root.
- Entry names are unique after normalization.
- Manifest and included assets agree.
A locally executed, reproducible check
A ZIP archive can contain two members with the same name, while a lookup by that name resolves to only one.
We executed this exact synthetic fixture on November 16, 2026 with Python 3.12.10 and SQLite 3.49.1. It ran locally with no network requests, account data or model generation. The recorded output below is an observation from that environment, not a platform benchmark. Copy the code into a separate Python file to repeat it in a suitable local environment; compare the mechanism and check your runtime version.
import io,zipfile,warnings
buffer=io.BytesIO()
with warnings.catch_warnings():
warnings.simplefilter('ignore',UserWarning)
with zipfile.ZipFile(buffer,'w') as archive:
archive.writestr('result.png',b'first synthetic bytes')
archive.writestr('result.png',b'second synthetic bytes')
with zipfile.ZipFile(io.BytesIO(buffer.getvalue())) as archive:
print('member names:',archive.namelist())
print('name lookup:',archive.read('result.png').decode())
print('individual members:',[archive.read(info).decode() for info in archive.infolist()])
Recorded output and interpretation
The warning is suppressed only to keep the expected teaching output stable. Production code should detect and prevent duplicate names, not suppress the warning and continue. This creates an in-memory ZIP without extracting paths or testing another archive reader.
A matching local output establishes only the illustrated library or database behavior under these inputs. It does not certify a production integration. Preserve the approved action, authorization boundaries and current AISwapLab request contract when applying the idea.
member names: ['result.png', 'result.png']
name lookup: second synthetic bytes
individual members: ['first synthetic bytes', 'second synthetic bytes']
When to stop or choose another method
Stop exposing an archive whose paths come directly from customer-controlled names or whose contents can drift during export creation.
