diegosouzapw/OmniRoute · error

ZIP archive contains

Error message

ZIP archive contains ${jsonEntries.length} .json files — max allowed is ${maxFiles}

What it means

Zip-bomb / resource guard in extractJsonZip: the number of .json entries inside the archive exceeds options.maxFilesBytes (default DEFAULT_MAX_FILES). Fires when a crafted or pathological archive would otherwise force iterating an unbounded number of files during OAuth credential import.

Solutions

  1. Repack the archive with only the needed .json files (e.g. just auth.json)
  2. Raise maxFiles in ExtractZipOptions only for trusted sources
  3. Strip unrelated JSON files from the export before uploading
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/lib/oauth/utils/jsonZipExtract.ts:50 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of diegosouzapw/OmniRoute@a179ffed5b (2026-08-25). Data as JSON: /api/errors/6011668e66cdba81. Report an issue: GitHub.

Appendix: source

Thrown at src/lib/oauth/utils/jsonZipExtract.ts:50

  const maxFileSize = options.maxFileSizeBytes ?? DEFAULT_MAX_FILE_SIZE;
  const maxTotal = options.maxTotalSizeBytes ?? DEFAULT_MAX_TOTAL;

  let unzipped: Unzipped;
  try {
    unzipped = unzipSync(new Uint8Array(zipBuffer));
  } catch {
    throw new Error("Could not parse ZIP archive — file may be corrupt or not a valid ZIP");
  }

  const entries = Object.entries(unzipped).filter(([, data]) => data !== undefined);
  const jsonEntries = entries.filter(([name]) => name.toLowerCase().endsWith(".json"));

  if (jsonEntries.length === 0) {
    throw new Error("ZIP archive contains no .json files");
  }

  if (jsonEntries.length > maxFiles) {
    throw new Error(
      `ZIP archive contains ${jsonEntries.length} .json files — max allowed is ${maxFiles}`
    );
  }

  let totalBytes = 0;
  const result: ExtractedZipFile[] = [];

  for (const [entryName, data] of jsonEntries) {
    const baseName = path.basename(entryName);

    if (!isSafeEntryName(baseName)) {
      throw new Error(
        `ZIP entry "${baseName}" has an unsafe filename (must be a .json file without path traversal)`
      );
    }

    if (!isSafeEntryName(entryName)) {
      throw new Error(

View on GitHub (pinned to a179ffed5b)