[GH-ISSUE #6767] [Bug] Artifact inventory rejects a valid ELF when unrelated trailing bytes end in GDPC #4123

Closed
opened 2026-10-31 00:46:59 +00:00 by bsakaguchi · 0 comments
Owner

Originally created by @coygeek on GitHub (Oct 23, 2026).
Original GitHub issue: https://github.com/morluto/rea/issues/6767

Before submitting

  • I searched the open and closed issues for a related report.
  • I removed credentials, tokens, private paths, and sensitive target data.

Area

Evidence, artifacts, or reconstruction

Observed behavior

The production artifact inventory rejects an ordinary ELF with a twelve-byte overlay ending in GDPC, reporting Godot PCK trailer declares an invalid pack range. The same ELF with a same-length overlay ending in ABCD inventories successfully as elf. Neither fixture contains a PCK header. This was reproduced at the inventory boundary shared by inspect-artifact; the CLI command itself was not executed.

Reproduction

From a source checkout with locked dependencies installed, run the following with node --import tsx --input-type=module. The script below restates the executed two-case probe with portable imports and compact output; each case was run once. It copies a system ELF into a disposable directory and never executes either fixture.

import { readFile, writeFile, mkdtemp } from 'node:fs/promises';
import { join } from 'node:path';
import { tmpdir } from 'node:os';
import { ArtifactResourceScope } from './src/artifacts/ArtifactResourceScope.ts';
import { inventoryArtifact } from './src/artifacts/inventory/ArtifactInventory.ts';
const dir = await mkdtemp(join(tmpdir(), 'rea-pck-marker-'));
const original = await readFile('/bin/true');
for (const [name, suffix] of [['control', '12345678ABCD'], ['marker', '12345678GDPC']]) {
  const path = join(dir, name);
  await writeFile(path, Buffer.concat([original, Buffer.from(suffix)]));
  const scope = new ArtifactResourceScope();
  try {
    const result = await inventoryArtifact(path, { resourceScope: scope, environment: {} });
    console.log(name, result.occurrences.find(x => x.logical_path === '.')?.artifact_format);
  } catch (error) {
    console.log(name, error.name, error.reason, error.message);
  } finally {
    await scope.close();
  }
}

Expected behavior

Inventory should retain the ELF classification and content hash when a file contains no validated PCK. A four-byte suffix alone does not establish an embedded pack. The Godot guide describes detection through a validated trailer, and the artifact classifier already preserves executable classification when probing trailing ZIP archives.

Impact and scope

An incidental suffix prevents the caller from obtaining any inventory for an otherwise supported native artifact. Observed for the two Linux ELF fixtures above; PE and Mach-O were not tested. The original files were not modified. A practical workaround preserving the exact selected artifact was not verified.

REA version

Source revision 5f702dd6ccd9e8e505e224854b91678439c3b41f (main, package version 6.7.0). The PCK reader is newer than the published rea-agents-6.7.0 tag; this report concerns the named source revision.

Runtime and platform

Node.js v24.22.1; Linux x64; repository-locked dependencies.

Target and artifact context

ELF64 little-endian x86-64 position-independent executable, copied from /bin/true, with twelve appended bytes. readelf -h accepted both copies and reported identical ELF header fields.

Interface

Other

Earliest failure stage

Artifact or evidence registration

Relevant output or evidence

Observed probe output, abbreviated to the relevant fields:

control: ok=true, rootFormat=elf, rootNodeFormat=elf
marker: ok=false, type=ArtifactReaderFailure, reason=format
message: Godot PCK trailer declares an invalid pack range

The PCK locator throws after matching only the final four bytes and interpreting the preceding eight as a length. The root classifier invokes it before ordinary native classification, so the exception prevents fallback. The documented carrier behavior requires a trailer in an executable carrier.

Typed outcome or recovery expected

Return the native artifact inventory when the candidate trailer does not establish a PCK. A restoration check should preserve the successful control and restore successful inventory of the GDPC fixture while retaining real embedded-PCK detection.

Analysis or suspected cause

Source-derived explanation: the optional PCK probe treats an invalid candidate trailer as a fatal format error for the entire artifact, before another format can claim it.

Triage assessment

  • Impact level: P2
  • Assessment status: supported
  • Impact basis: A bounded, content-dependent false rejection blocks the ordinary artifact inventory; both the failure and the same-length control were observed.
  • Workaround status: unverified
  • Workaround basis: No alternate invocation preserving the exact artifact was tested; editing the suffix would change the evidence.
Originally created by @coygeek on GitHub (Oct 23, 2026). Original GitHub issue: https://github.com/morluto/rea/issues/6767 ## Before submitting - [x] I searched the open and closed issues for a related report. - [x] I removed credentials, tokens, private paths, and sensitive target data. ## Area Evidence, artifacts, or reconstruction ## Observed behavior The production artifact inventory rejects an ordinary ELF with a twelve-byte overlay ending in `GDPC`, reporting `Godot PCK trailer declares an invalid pack range`. The same ELF with a same-length overlay ending in `ABCD` inventories successfully as `elf`. Neither fixture contains a PCK header. This was reproduced at the inventory boundary shared by `inspect-artifact`; the CLI command itself was not executed. ## Reproduction From a source checkout with locked dependencies installed, run the following with `node --import tsx --input-type=module`. The script below restates the executed two-case probe with portable imports and compact output; each case was run once. It copies a system ELF into a disposable directory and never executes either fixture. ```js import { readFile, writeFile, mkdtemp } from 'node:fs/promises'; import { join } from 'node:path'; import { tmpdir } from 'node:os'; import { ArtifactResourceScope } from './src/artifacts/ArtifactResourceScope.ts'; import { inventoryArtifact } from './src/artifacts/inventory/ArtifactInventory.ts'; const dir = await mkdtemp(join(tmpdir(), 'rea-pck-marker-')); const original = await readFile('/bin/true'); for (const [name, suffix] of [['control', '12345678ABCD'], ['marker', '12345678GDPC']]) { const path = join(dir, name); await writeFile(path, Buffer.concat([original, Buffer.from(suffix)])); const scope = new ArtifactResourceScope(); try { const result = await inventoryArtifact(path, { resourceScope: scope, environment: {} }); console.log(name, result.occurrences.find(x => x.logical_path === '.')?.artifact_format); } catch (error) { console.log(name, error.name, error.reason, error.message); } finally { await scope.close(); } } ``` ## Expected behavior Inventory should retain the ELF classification and content hash when a file contains no validated PCK. A four-byte suffix alone does not establish an embedded pack. The Godot guide describes detection through a validated trailer, and the artifact classifier already preserves executable classification when probing trailing ZIP archives. ## Impact and scope An incidental suffix prevents the caller from obtaining any inventory for an otherwise supported native artifact. Observed for the two Linux ELF fixtures above; PE and Mach-O were not tested. The original files were not modified. A practical workaround preserving the exact selected artifact was not verified. ## REA version Source revision `5f702dd6ccd9e8e505e224854b91678439c3b41f` (`main`, package version 6.7.0). The PCK reader is newer than the published `rea-agents-6.7.0` tag; this report concerns the named source revision. ## Runtime and platform Node.js v24.22.1; Linux x64; repository-locked dependencies. ## Target and artifact context ELF64 little-endian x86-64 position-independent executable, copied from `/bin/true`, with twelve appended bytes. `readelf -h` accepted both copies and reported identical ELF header fields. ## Interface Other ## Earliest failure stage Artifact or evidence registration ## Relevant output or evidence Observed probe output, abbreviated to the relevant fields: ```text control: ok=true, rootFormat=elf, rootNodeFormat=elf marker: ok=false, type=ArtifactReaderFailure, reason=format message: Godot PCK trailer declares an invalid pack range ``` The [PCK locator](https://github.com/morluto/rea/blob/5f702dd6ccd9e8e505e224854b91678439c3b41f/src/artifacts/GodotPckLocation.ts#L67-L85) throws after matching only the final four bytes and interpreting the preceding eight as a length. The [root classifier](https://github.com/morluto/rea/blob/5f702dd6ccd9e8e505e224854b91678439c3b41f/src/artifacts/inventory/classify.ts#L187-L207) invokes it before ordinary native classification, so the exception prevents fallback. [The documented carrier behavior](https://github.com/morluto/rea/blob/5f702dd6ccd9e8e505e224854b91678439c3b41f/docs/godot-pck.md#L32-L38) requires a trailer in an executable carrier. ## Typed outcome or recovery expected Return the native artifact inventory when the candidate trailer does not establish a PCK. A restoration check should preserve the successful control and restore successful inventory of the `GDPC` fixture while retaining real embedded-PCK detection. ## Analysis or suspected cause Source-derived explanation: the optional PCK probe treats an invalid candidate trailer as a fatal format error for the entire artifact, before another format can claim it. ## Triage assessment - Impact level: P2 - Assessment status: supported - Impact basis: A bounded, content-dependent false rejection blocks the ordinary artifact inventory; both the failure and the same-length control were observed. - Workaround status: unverified - Workaround basis: No alternate invocation preserving the exact artifact was tested; editing the suffix would change the evidence.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#4123
No description provided.