You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Stream archive listings to support large imports - #1300
A valid ZIP with 43,462 entries and 85.8 GiB of declared expanded data failed import because 7z l -slt produced more than the 10 MiB execFile stdout buffer. Both archive safety limits were satisfied, but the reported error contained the start of the listing instead of the actual subprocess failure.
Stream archive tool output and parse listing records incrementally. Integrity tests and extraction use the same runner, so verbose output cannot trigger the same buffer failure in a later import stage.
Preserve entry-count, expanded-size, unsafe-path, depth, link, and extraction staging checks, including split-volume RAR continuation handling.
Bound each listing record to 64 KiB and retained entry names to 32 MiB. Stop deterministically refused listings without retrying.
Classify listing password failures from stderr so filenames cannot trigger password prompts. Classify password failures before redacting diagnostic text, preserving the password prompt even for passwords such as password, pass, word, or a.
Keep bounded diagnostic tails with exit codes/signals, avoid password-bearing command-line errors, and reap failed or timed-out children with a forced-kill fallback.
Document the metadata memory limits in the security and operator documentation.
Validation
The generated 43,462-entry listing regression fails on unchanged bbc66b32 and passes with this change. It exceeds 10 MiB without requiring a large archive fixture.
Real subprocess tests cover chunked UTF-8/CRLF records, final unterminated records, multipart RAR continuations, oversized metadata, bounded diagnostics, subprocess failures, password redaction, and process cleanup.
Existing archive safety and extraction tests pass.
TZ=UTC npm test -- --maxWorkers=4: 4,746 passed, 7 skipped
npm run lint
npm run check
npm run build
Prettier checks for all changed files and pre-commit secretlint pass.
Type of change
Bug fix
Documentation update
Checklist
Followed project style and reviewed the diff
Added regression tests and updated existing tests
Updated relevant security and operator documentation
Backend-only change; no UI or database schema changes
Disclosed AI assistance below
AI assistance
Written with OpenAI Codex (GPT-6). The exact model variant and thinking level were not exposed by this session.
Summary by CodeRabbit
Bug Fixes
Improved handling of large archive listings, including valid listings exceeding 10 MiB.
Archives with oversized listing records, excessive filename metadata, or too many entries are rejected promptly, without retrying extraction or creating an extraction destination.
Improved archive-process error reporting with bounded diagnostic output and password-value redaction.
Password-related failures are classified more reliably, while transient listing failures are less likely to be mistaken for password errors.
Documentation
Updated archive security guidance to describe metadata limits and safeguards.
No actionable comments were generated in the recent review.
Recent review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: eb07c644-0f11-4889-ae90-430eefdc9ff5
Commits
Reviewing files that changed from the base of the PR and between b48ac18 and b07156d.
Files selected for processing: 3
server/__tests__/archive_service.test.ts
server/__tests__/archive_tool.test.ts
server/services/archive-tool.ts
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.
Walkthrough
Archive subprocess output now streams through a shared runner. Archive listings are parsed record by record with limits on record size, entry count, and aggregate filename bytes. Failure diagnostics are bounded. Tests and security documentation cover the updated behavior.
Changes: Archive streaming
Layer / File(s)
Summary
Archive process streaming server/services/archive-tool.ts, server/__tests__/archive_tool.test.ts
Adds runArchiveTool to stream and parse process output, limit records, bound diagnostic tails, redact password arguments, and terminate failed or timed-out processes. Tests cover record boundaries, errors, and process cleanup.
ArchiveService streams listing records, applies entry-count and aggregate name-byte limits, and treats listing-limit errors as non-retryable. Tests cover large listings, RAR continuation records, and rejection cases. Documentation describes the limits and bounded diagnostics.
Archive service process tests server/__tests__/archive_service.test.ts
Updates process mocks to use spawn. Adds password-failure cases across ZIP and RAR listing and integrity operations.
Doezer/Questarr#1172: Introduced archive-extraction limit documentation that this change updates for streamed listing and diagnostic limits.
Suggested labels:bug-fix, testing, import
Suggested reviewers:gitar-bot
Merge Risk: Minimal · up to b0715
No actionable merge-blocking risk was established.
Pre-merge checks: 4 · 1
Failed checks: 1 warning
Check name
Status
Explanation
Resolution
Docstring Coverage
Docstring coverage is 16.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documenta…
Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed checks: 4 passed
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
The title "Stream archive listings to support large imports" matches the main change in the changeset. The raw summary and objectives show that archive listing output is now parsed as a stream by runA…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title "Stream archive listings to support large imports" matches the main change in the changeset. The raw summary and objectives show that archive listing output is now parsed as a stream by runArchiveTool and ArchiveService, which lifts the 10 MiB execFile buffer limit that caused large imports to fail. The title is short, specific, and uses no vague terms.
Full details: Docstring Coverage
Explanation
Docstring coverage is 16.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 6 functions across 5 files.
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Warning
Some tools did not complete. Review the errors below.
ESLint
If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.
ESLint install timed out. The project may have too many dependencies for the sandbox.
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
This PR fixes a bug where listing very large archives (e.g., ZIPs with tens of thousands of entries) could exceed the 10 MiB execFile stdout buffer, causing misleading errors during import. It refactors archive listing, integrity checking, and extraction to stream subprocess output incrementally with bounded record and entry-name size limits, while preserving existing safety checks (entry count, expanded size, unsafe paths, links, depth, RAR continuations), and adds bounded diagnostics, passwor…
Review Checklist
Tests present
Breaking change
Docs updated
Analyzed automatically by wshm · This is an automated analysis, not a human review.
🔴 High risk · Streaming archive metadata now feeds import safety checks; a parser regression could miss malicious paths or links and allow writes outside staging.
Streams archive tool output and parses listing records incrementally so large imports no longer hit the 10 MiB execFile buffer, with bounded record and metadata sizes and password classification from stderr before redaction. Password redaction that could mangle 'wrong password' classification was addressed. No open issues found.
✅ 1 closed✅ Bug: Password redaction can mangle 'wrong password' and break classification
📄 server/services/archive-tool.ts:101-112📄 server/services/ArchiveService.ts:334-344
In archive-tool.ts:103-107, every occurrence of the password text in the stderr/stdout tail gets replaced with [redacted]. If the password is a substring of the tool's own diagnostic, the diagnostic itself changes. Passwords like password, pass, word or a all do this: Wrong password? becomes Wrong [redacted]? or Wrong pass[redacted]?.
isPasswordProtectedError (ArchiveService.ts:78-82) then no longer matches wrong password|password is incorrect|.... The wrong-password failure is retried as if transient (about 11s of delay), and the user is told the archive is corrupt and should be re-downloaded. They never see the ArchivePasswordRequiredError that sends the download to the password prompt.
Fix: check for the password failure before redacting. One way is to return the raw-detail classification alongside the redacted message, for example const passwordFailure = isPasswordProtectedError(rawDetail), and throw a distinct error type. Another is to redact only when the password is long enough not to collide with tool text, while still classifying on the raw detail.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
A valid ZIP with 43,462 entries and 85.8 GiB of declared expanded data failed import because
7z l -sltproduced more than the 10 MiBexecFilestdout buffer. Both archive safety limits were satisfied, but the reported error contained the start of the listing instead of the actual subprocess failure.Stream archive tool output and parse listing records incrementally. Integrity tests and extraction use the same runner, so verbose output cannot trigger the same buffer failure in a later import stage.
password,pass,word, ora.Validation
bbc66b32and passes with this change. It exceeds 10 MiB without requiring a large archive fixture.TZ=UTC npm test -- --maxWorkers=4: 4,746 passed, 7 skippednpm run lintnpm run checknpm run buildType of change
Checklist
AI assistance
Written with OpenAI Codex (GPT-6). The exact model variant and thinking level were not exposed by this session.
Summary by CodeRabbit