Skip to content

Commit 526773b

Browse files
committed
fix(archives): increase timeout for zip bomb test to 15s
- Windows runners are slower at allocating large buffers - Test creates 150MB buffer which can take >10s on Windows
1 parent ee10f06 commit 526773b

File tree

1 file changed

+21
-17
lines changed

1 file changed

+21
-17
lines changed

test/unit/archives.test.mts

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -530,23 +530,27 @@ describe('archives', () => {
530530
})
531531

532532
describe('zip bomb protection', () => {
533-
it('should block files exceeding maxFileSize in zip', async () => {
534-
await runWithTempDir(async tempDir => {
535-
const bombZipPath = path.join(tempDir, 'bomb.zip')
536-
const zip = new AdmZip()
537-
538-
// Create a large buffer (150MB > 100MB default)
539-
const largeBuffer = Buffer.alloc(150 * 1024 * 1024)
540-
zip.addFile('large-file.bin', largeBuffer)
541-
542-
zip.writeZip(bombZipPath)
543-
544-
const extractDir = path.join(tempDir, 'extract')
545-
await expect(extractZip(bombZipPath, extractDir)).rejects.toThrow(
546-
/File size exceeds limit/,
547-
)
548-
}, 'security-zip-bomb-file-')
549-
})
533+
it(
534+
'should block files exceeding maxFileSize in zip',
535+
async () => {
536+
await runWithTempDir(async tempDir => {
537+
const bombZipPath = path.join(tempDir, 'bomb.zip')
538+
const zip = new AdmZip()
539+
540+
// Create a large buffer (150MB > 100MB default)
541+
const largeBuffer = Buffer.alloc(150 * 1024 * 1024)
542+
zip.addFile('large-file.bin', largeBuffer)
543+
544+
zip.writeZip(bombZipPath)
545+
546+
const extractDir = path.join(tempDir, 'extract')
547+
await expect(extractZip(bombZipPath, extractDir)).rejects.toThrow(
548+
/File size exceeds limit/,
549+
)
550+
}, 'security-zip-bomb-file-')
551+
},
552+
15_000,
553+
)
550554

551555
it('should block total size exceeding maxTotalSize in zip', async () => {
552556
await runWithTempDir(async tempDir => {

0 commit comments

Comments
 (0)