refactor(artifacts): break the artifacts-firmware and artifacts-gpu import cycles (#11331)

* refactor(domain): move BinaryContainer into src/domain

BinaryContainer imports only domain modules and is shared by artifacts, firmware, gpu, go, il2cpp, python, rust and native. Living under src/native made artifacts and firmware import native for its failure types and BinaryReader. Pure move: git mv plus import specifier updates.

* refactor(firmware): move the devicetree parser into src/domain/firmware

The FIT artifact reader in src/artifacts parses embedded devicetree blobs with the parser that lived under src/firmware, while firmware's providers import src/artifacts: the two units imported each other. The parser and its fixture are pure and now sit beside domain/firmware/devicetree.ts. Pure move: git mv plus import specifier and baseline key updates.

* refactor(artifacts): break the artifacts-gpu import cycle (#11335)

* refactor(artifacts): move the LZ4 block decoder into src/artifacts

Pure move: git mv plus import specifier updates. The next commit removes its GPU-specific budget.

* refactor(artifacts): take the LZ4 output budget from the caller

decodeLz4Block bounded every decode by the GPU object budget and threw through rejectGpu, so UnityFS decoding in src/artifacts imported src/gpu while gpu imports artifacts. Callers now pass their budget: GPU payloads keep GPU_OBJECT_BYTES; UnityFS passes its 64 MiB block bound, which its size checks already enforce before decoding. Malformed blocks still throw BinaryFormatFailure with the same messages.

* test(architecture): drop the artifacts-firmware and artifacts-gpu cycles from the layer baseline

* refactor(artifacts): move the PE resource reader into src/artifacts/pe (#11347)

refactor(artifacts): move the PE resource layout and parser into src/artifacts/pe

The Node SEA and Deno standalone readers in src/artifacts locate PE resources with the layout and parser that lived under src/native/pe, while those modules already read through src/artifacts (ArtifactReaderFailure, assertArtifactReadActive). Pure move: git mv plus import specifier, baseline key and spec path updates.
This commit is contained in:
morluto authored and GitHub committed 2026-11-16 03:44:53 +08:00
1 parent 0c8d8cc879
commit 264dcd5fee
113 files changed
+191 -167

No files matched your search

-2
View File
@@ -55,8 +55,6 @@
"application <-> frida",
"application <-> providers",
"artifacts <-> dotnet",
"artifacts <-> firmware",
"artifacts <-> gpu",
"artifacts <-> javascript",
"artifacts <-> native",
"artifacts <-> process",
+3 -3
View File
@@ -514,7 +514,7 @@ checkCounted(
);
// Byte-format parsers read untrusted input. Bounds, truncation and failure
// kind belong to BinaryReader (src/native/metadata/BinaryContainer.ts) and
// kind belong to BinaryReader (src/domain/binaryContainer.ts) and
// the ParseFailure algebra (src/domain/parseFailure.ts), not to each parser.
const PARSER_FOLDERS = [
"src/android/",
@@ -564,11 +564,11 @@ const parserFiles = files.filter((file) =>
// An unchecked Buffer or DataView read throws a bare RangeError past the end,
// which a catch site cannot tell from a host stack or string limit.
checkCounted(
"raw Buffer or DataView numeric read (use BinaryReader from src/native/metadata/BinaryContainer)",
"raw Buffer or DataView numeric read (use BinaryReader from src/domain/binaryContainer)",
"raw-buffer-read",
files,
/\.(?:read(?:Big)?U?Int(?:8|16|32|64)?(?:LE|BE)?|readBigUint64(?:LE|BE)|readUint(?:8|16|32)(?:LE|BE)?|read(?:Float|Double)(?:LE|BE)|get(?:Big)?(?:Uint|Int)(?:8|16|32|64)|getFloat(?:32|64))\(/gu,
["src/native/metadata/BinaryContainer.ts"],
["src/domain/binaryContainer.ts"],
);
// An input fault is a ParseFailureError; a broken internal assumption is a
@@ -1,7 +1,7 @@
{
"src/browser/WebSourceMapFetcher.ts": 1,
"src/captures/parseFieldDiscovery.ts": 1,
"src/firmware/devicetree/DevicetreeParser.ts": 1,
"src/domain/firmware/devicetreeParser.ts": 1,
"src/signals/SigrokRecordingProvider.ts": 1,
"src/signals/parseDecoderDiscovery.ts": 1,
"src/v8/V8CodeCache.errors.ts": 1
@@ -20,6 +20,9 @@
"src/artifacts/fit/FitStructure.ts": 3,
"src/artifacts/nodeSea/NodeSeaBlob.ts": 4,
"src/artifacts/nodeSea/NodeSeaLocation.ts": 2,
"src/artifacts/pe/PeResourceLayout.ts": 3,
"src/artifacts/pe/PeResourceParser.ts": 11,
"src/artifacts/pe/PeResourceTreeFacts.ts": 9,
"src/artifacts/pyinstaller/CArchiveLayout.ts": 8,
"src/artifacts/pyinstaller/PyzArchive.ts": 1,
"src/browser/PngVisualDiff.ts": 7,
@@ -45,6 +48,7 @@
"src/domain/elfRelocation.ts": 6,
"src/domain/elfSectionHeader.ts": 6,
"src/domain/elfSymbol.ts": 8,
"src/domain/firmware/devicetreeParser.ts": 4,
"src/domain/firmware/fitImage.ts": 1,
"src/domain/gamecubeDol.ts": 6,
"src/domain/godotPckFormat.ts": 5,
@@ -83,7 +87,6 @@
"src/dotnet/ManagedPeReader.ts": 5,
"src/dotnet/ManagedTypeDefinitionRows.ts": 1,
"src/erlang/BeamParser.ts": 3,
"src/firmware/devicetree/DevicetreeParser.ts": 4,
"src/flutter/DartElf.ts": 2,
"src/ghidra/GhidraLoadImageValues.ts": 1,
"src/ghidra/extensions/GhidraExtensions.ts": 1,
@@ -123,9 +126,6 @@
"src/native/pe/PeCertificateAsn1.ts": 2,
"src/native/pe/PeCertificateParser.ts": 3,
"src/native/pe/PeLoadConfigParser.ts": 7,
"src/native/pe/PeResourceLayout.ts": 3,
"src/native/pe/PeResourceParser.ts": 11,
"src/native/pe/PeResourceTreeFacts.ts": 9,
"src/native/pwndbg/CoreFileMappingAuthority.ts": 1,
"src/native/pwntools/PwntoolsRecordedCrashProvider.ts": 1,
"src/native/pwntools/RecordedCrashSourceBindings.ts": 6,