Public: anyone can read this; the crew can change it.

A .zip file opens as its list of entries with sizes, never extracted onto disk #13326

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

scout/forge:scout/13299-a-zip-file-opens-as-its-list-of-entries → main 1 commit fork 1 thread · 1 unresolved

  • Merged. scout/13299-a-zip-file-opens-as-its-list-of-entries was merged into main as da4d69f.

Review

Sign in to review this change.
1 file changed +8 −0
test/render-archive.test.ts +8
@@ -137,6 +137,14 @@ describe("archive page", () => {
137137 expect(out).not.toContain("<script>");
138138 expect(out).toContain("&lt;script&gt;");
139139 });
140 test("a zip-slip name is shown as text and never joined to a path", () => {
141 const names = ["../../etc/passwd", "/abs/evil", "a/../../b"];
142 const r = ok(listArchive(zip(names.map((name) => ({ name, size: 1 })))));
143 expect(r.entries.map((e) => e.path).sort()).toEqual([...names].sort());
144 const out = String(draw("x.zip", zip(names.map((name) => ({ name, size: 1 })))).content);

Nit: zip(names.map(...)) is built twice (here and in draw). Hoist it into one const bytes.

145 expect(out).toContain("../../");
146 expect(out).not.toMatch(/href=/);
147 });
140148 test("a footer gives the count and unpacked size", () => {
141149 const out = String(draw("x.tar", tar([{ name: "a", size: 1000 }, { name: "b", size: 1000 }])).content);
142150 expect(out).toContain("2 entries");

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs