#602·archify

[Bug]: Brand capture accepts incomplete WebP chunks and missing image data

Author: To3akaRinCreated Sep 28, 2026Updated Sep 28, 2026

Version and environment

Git clone of dev at e825eb20faab530f911368b2a41a4c10fc915b41, Node 22.23.1, macOS. Remote brand capture and pinned validation.

Minimal reproduction

Run from the repository root. The server returns a 16-byte RIFF/WEBP prefix plus VP8 FourCC, with no complete chunk header or image data.

bash
node --input-type=module <<'JS'
import http from 'node:http';
import { execFile } from 'node:child_process';
import { promisify } from 'node:util';
import fs from 'node:fs';
import os from 'node:os';
import path from 'node:path';
const cli = path.resolve('archify/bin/archify.mjs');
const temp = fs.mkdtempSync(path.join(os.tmpdir(), 'archify-webp-repro-'));
const bytes = Buffer.alloc(16);
bytes.write('RIFF'); bytes.writeUInt32LE(8, 4);
bytes.write('WEBP', 8); bytes.write('VP8 ', 12);
const server = http.createServer((_req, res) => {
  res.writeHead(200, { 'content-type': 'image/webp' }); res.end(bytes);
});
await new Promise(resolve => server.listen(0, '127.0.0.1', resolve));
const run = args => promisify(execFile)(process.execPath, [cli, ...args], {
  env: { ...process.env, ARCHIFY_BRAND_ALLOW_PRIVATE: '1' }
});
try {
  const url = `http://127.0.0.1:${server.address().port}/bad.webp`;
  const capture = await run(['brands', 'capture', url, '--json']);
  console.log('capture:', capture.stdout);
  const spec = JSON.parse(fs.readFileSync('archify/examples/web-app.architecture.json'));
  spec.components[0].brand = JSON.parse(capture.stdout).brand;
  const input = path.join(temp, 'pinned.json');
  fs.writeFileSync(input, JSON.stringify(spec));
  console.log('validate:', (await run(['validate', 'architecture', input, '--json'])).stdout);
} finally {
  await new Promise(resolve => server.close(resolve));
  fs.rmSync(temp, { recursive: true, force: true });
}
JS

The private-address override is confined to the fixture child processes.

Actual behavior

Capture and pinned validate both exit 0, returning a captured digest and ok: true, despite missing image data. The same commands also accept an empty VP8 chunk, a chunk declaring an unavailable payload, metadata-only content, a standalone VP8X header, and an ANMF frame with no image subchunk.

Valid lossy VP8, lossless VP8L, transparent extended WebP and animation controls were encoded and independently decoded with Pillow, and remain accepted by the CLI.

Expected behavior and bounded scope

Reject incomplete chunk headers, payloads or required padding within the declared RIFF boundary. Require non-empty image data, including within each animation frame. Continue normal candidate fallback; matching digests must not bypass structural checks.

The Google container specification defines the chunk and ANMF boundaries. The fix should preserve valid unknown chunks, metadata, extended/animated images and reader-compatible data trailing the RIFF range. Hash the unchanged complete original bytes.

This is a necessary container check, not a full image decoder or complete WebP conformance validator. No codec dependency, pixel decoding or broad format refactor is proposed. I plan to contribute the focused fix and public CLI regressions.

Related work and checks

  • ICO #585/#587 is already an independent PR, validating a different directory format. This WebP follow-up has distinct RIFF/padding/frame compatibility requirements and will not expand that ICO PR.
  • Searched WebP issues/PRs; no duplicate container-range fix found. #515 concerns HTTP content codings.
  • No credentials, private data or customer content in the reproduction.