Skip to content
Interface language: English
Audit / Signal

AI delivers a ZIP. Check its contents before extracting it

Check archive contents, write destination and limits separately from later assessment of extracted files.

Article language: English

Illustration: part of a stone column, with a thin line marking a crack.
In this article

The package should extract into one folder, contain the agreed materials and replace nothing outside it. That sounds modest for an AI project, but it is precisely the promise worth checking before opening the finished documents. A ZIP archive organises file transfer. It does not certify that its contents will behave well.

First distinguish the contents list, what is written on extraction and the later use of individual files. Each stage answers a different question. An attractive chart does not prove an unnecessary data source was omitted from the package. A correct list of names does not yet prove where the tool will write the entries or whether it will replace anything.

We will look at a small test of our own, then at process requirements. The examples use harmless material. Operational acceptance does not replace specialist examination of untrusted or suspicious files; that scope needs an appropriate environment and expertise.

Three files that actually passed through a package

For this version, a new reproducible offline test was prepared using an archive containing three short text files; its materials and result accompany the editorial package. One contains a handover instruction, another fictional CSV numbers and the third legend text. Their names identify the folders "przekazanie" (handover), "dane" (data) and "wykres" (chart), respectively. The material did not come from a model or an external package. We know its contents because it was prepared for this demonstration.

The zip and unzip tools created the archive, read its listing and then extracted it to a separate empty folder. The list contained the three expected files. Comparing each input's bytes with the corresponding output confirmed identical content. The archive, test result and file hashes were retained. These are actions performed in the new test, not evidence about the earlier account.

The evidence has a narrow scope: this ordinary package transferred three known files without changing their contents. It did not test refusal to write outside a folder, an oversized archive or the behaviour of suspicious entries. Success in the harmless case does not answer all those questions. It does show how to connect the declared material with the result received.

For file hashes in an AI report (in Polish) (in Polish), that connection to actual bytes must be retained. A string in the implementer's message alone does not yet establish identity. Even a correctly calculated hash does not decide whether content is appropriate for the task or safe to run.

In a fictional report project, we expect an instruction, numbers and a legend. A working customer history file is not part of that order. If it appears in the listing, it needs explanation before onward transfer, regardless of whether the chart uses it on screen. "The model added everything for completeness" is not a decision about what may be shared.

The inventory should distinguish files from entries representing folders. Otherwise the implementer counts archive entries while the recipient counts documents, and each gives a different, apparently contradictory number. For a small package the clearest option is a complete list with the role of every item. A large handover needs an agreed comparison method; the visible beginning of a list does not prove the whole inventory is complete.

If the contents of some entries cannot be read, mark them unchecked. That includes files requiring a password or a tool the recipient does not have. A visible name does not justify recording "content reviewed". The handover owner should provide the agreed access route or remove the unnecessary item and prepare a new package.

Such an inventory can form part of accepting materials after a project with AI agents (in Polish) (in Polish). For the ZIP itself we need full internal names, entry types and their relationship to the order. The archive's title is not a substitute. "Final" at the end of a name remains the author's aspiration until we know what is inside.

A name in the listing and a write location are different things

A file inside an archive can have a name containing its folder location. The tool must translate that information into a write destination. The recipient should know the permitted target folder and the rule for a name that falls outside it. A preview window showing a familiar text file is not enough.

Python documentation distinguishes name handling in extract and extractall from the zipfile.Path interface, which does not perform that normalisation and leaves name checking to the caller. It also warns against extracting untrusted archives without prior inspection. A library name alone therefore does not describe the acceptance path used.

The person commissioning the work accepts a concrete effect: nothing should land outside the specified place. The technical implementer must explain how the particular program resolves the target path and what it rejects. We are not designing a ready-made defence by searching for one piece of text in a name. The check must match the system, entry types and actual writing method.

Go archive/zip documents ErrInsecurePath conditionally, with GODEBUG set to `zipinsecurepath=0`. It also notes that the calling program can ignore the error. The mere presence of a checking mechanism does not prove an application ends the operation by refusing it.

The record therefore needs an answer about the behaviour of the whole application in use, not just a link to a dependency. When a name is rejected, what will the operator see? Will the rest of the package be written? Will a partial result be marked incomplete? These process decisions should be agreed before the test.

Name collisions also need a decision. In the fictional package, two different folders may each contain an "opis.txt" file. Preserving the structure keeps them distinct. If a later importer flattens everything into one folder, it needs an explicit rule to refuse, rename or otherwise organise the result. It should not silently choose one text. Comparing only the final parts of names is not enough to accept such a change.

Python also documents that its module overwrites files by default when the same archive is extracted again. That is behaviour of the specified module. We do not assume every program reacts identically, but acceptance must name the rule for an already existing destination.

Aeneia conceptual photography

Our test began with an empty folder, so it did not check a collision with an earlier file. A separate control case should use only harmless content prepared for that test. Record the expectation before running it: refuse, retain the older entry or deliberately replace it. Compare both states in the result, not just a completion message.

Name the permitted entry types separately. If the handover requires ordinary files and folders, a link, an entry pointing somewhere else, needs explanation. The recipient need not be able to analyse every archive variation. They need an agreed stopping condition and the right person to carry out the check, rather than the reflex "let's extract it and hope".

This route can be discussed in an Aeneia Audit operational review of file handovers. We will choose the material, expected effect and required evidence. Implementing an extraction mechanism or carrying out a specialist security assessment requires a separately agreed technical scope.

Do not transfer conclusions from checking an AI-prepared shell command (in Polish) (in Polish). An archive name can be passed to a program correctly while names inside it are then handled incorrectly. This is another data boundary; correct command quoting does not settle the package structure.

A small file does not determine the amount of work

The downloaded archive size and the combined size of extracted material are different parameters. Agreeing to accept a small ZIP should not mean unlimited writing of its contents. We do not need a demonstration that burdens a computer. We need explicit limits and evidence of the response in a controlled environment.

OWASP recommends considering decompressed size when an accepted file will be extracted. The uploaded-file limit and further-processing limit address different resource constraints. Acceptance should establish which the application actually enforces.

In an ordinary report handover, limits on entry count, total written size and individual file size can help. The process owner agrees them with the implementer based on required materials. A limit should not be created solely by copying an arbitrary setting. A report with three texts and a package of source photographs may need different values.

If further archives are allowed inside, establish whether the application only stores them or also extracts them automatically. Finding a ZIP inside a ZIP does not mean a second stage occurred. Conversely, automatically entering the next container must be within the scope of checks. For a simple report handover it may be easier to request one clear structure without such nesting.

The person responsible for the environment prepares a boundary test. They can use small, controlled limit values instead of creating a huge archive. The record should show the expected refusal, actual message and state of remaining materials. In a test environment for automation (in Polish) (in Polish), the point is to control effects; a "test" label on screen does not limit disk use.

Also consider retrying after an interruption. Does the application begin in a new empty place, remove its own partial result or ask to replace it? Each route requires identifying which files belong to that test. Do not clear an entire shared folder merely to reset acceptance of one archive conveniently.

Aeneia Audit

Let us organise one way to accept AI packages: expected contents, write destination, limits and response to an incomplete result. From that, we will prepare requirements for the appropriate implementer to check.

Discuss evidence for accepting an AI file package

Extracted materials still need their own acceptance

After completion, compare the result with the inventory and order. Do all necessary files exist? Are they in the agreed structure? Was material omitted whose absence will become apparent only when the report is opened? The extraction program's success should not replace this conformity check.

For a missing item, record whether it was absent from the listing, rejected before writing or failed to write. These results lead to different fixes. Do not add a file from the author's computer during acceptance without recording the change. The recipient should get the complete specified version, not instructions to reproduce a lucky coincidence of local files.

When correcting an archive, retain the earlier version and identify the difference. Replacing a data file can change report content, while replacing instructions can change its use. If the package is created again, evidence about the previous one does not automatically confirm the new contents. Name the version actually received.

Then apply checks appropriate to each format. An HTML and SVG preview (in Polish) (in Polish) concerns active content and document dependencies, not ZIP structure. A file may be written in exactly the right place and still need separate assessment before display. Extraction and execution should not be one indistinguishable action.

In our harmless example, the final comparison confirmed three identical texts. For the actual process the decision should additionally state who may open each material and for what purpose. If a report was ordered for reading, there is no reason for acceptance to silently expand into executing an included program.

A handover can be accepted when we have a specific package, matching contents and a checked acceptance method. If we cannot establish the effect of extraction, the implementer must provide appropriate evidence or a simpler form of the materials. A file should make taking over work easier. The recipient should not have to solve the puzzle of what they received.

Aeneia / Aeneia editorial

Editorial article. Source links are included in the text.

About Aeneia

Brands we have worked with

  • L’Oréal
  • Garnier
  • Netflix
  • Carrefour
  • Warner Bros. Discovery
  • Biedronka
  • HBO Max
  • Wolt
  • Żabka
  • COSRX
  • Embassy of China in Poland
  • Mixa
Aeneia / Initium

From knowledge to a decision

Tell us what you want to put in order. We will agree on where to start.

Contact Aeneia

We partner with and use solutions from:

  • Google
  • OpenAI
  • Microsoft
  • Stripe
  • Anthropic
  • Linear