The route read the whole upload into memory, up to its 200 MB cap, opened the
zip from that buffer, and read each attachment whole, up to 100 MB, to put
it on the board JSON as base64. The upload is now written to a temporary
file as it arrives, under the same cap, the zip is opened from the file, and
each attachment streams from its entry into storage through TrelloCreator,
counted against the same per-file limit and the same 1 GB budget of
everything inflated (server/lib/boundedZipEntry.js boundedZipEntryStream).
Only the board JSON files are held in memory. The .zip import takes the
people choice too. Removed from TODO Later.
Thanks to markusst1982 and xet7 !
The Trello zip import checked entry sizes from entry.vars.uncompressedSize, a
field unzipper's directory entries do not have - the size is
entry.uncompressedSize - so every size check saw 0, and an archive of a few
hundred kilobytes inflated without limit in memory: any logged-in user could
exhaust the server. The WeKan zip import read wekan.json with no cap. A
declared size is the archive's own claim anyway, so entries are now read
through readZipEntryBounded, which counts the bytes that actually inflate and
stops past a per-entry and a per-archive limit.
POST /api/import/zip also allowed any active member to import into a board;
importing writes, so it needs write access, like the DDP import method.
The test builds a real small archive that inflates to megabytes and reads it
through unzipper; the negative test fails on any server code that inflates a
zip entry whole or reads entry.vars.
Thanks to xet7 !