* feat(artifacts): inspect PE resource identities and payload ranges * fix(artifacts): reject header payloads overlapping PE sections --------- Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>
50 lines
1.5 KiB
TypeScript
50 lines
1.5 KiB
TypeScript
import {
|
|
AnalysisError,
|
|
type AnalysisErrorOptions,
|
|
} from "./analysisErrorBase.js";
|
|
|
|
/** Artifact inventory or extraction failed a typed safety boundary. */
|
|
export class ArtifactOperationError extends AnalysisError {
|
|
readonly _tag = "ArtifactOperationError";
|
|
|
|
constructor(
|
|
readonly operation:
|
|
| "inventory_artifact"
|
|
| "inspect_artifact"
|
|
| "inspect_pe_resources"
|
|
| "extract_artifact"
|
|
| "decode_interface_builder"
|
|
| "inspect_asset_catalog"
|
|
| "inspect_keyed_archive"
|
|
| "trace_dylib_resolution"
|
|
| "export_web_scripts"
|
|
| "trace_web_module_imports"
|
|
| "trace_web_source_location"
|
|
| "analyze_javascript_application",
|
|
readonly reason:
|
|
| "cancelled"
|
|
| "format"
|
|
| "integrity"
|
|
| "limit"
|
|
| "path"
|
|
| "unavailable"
|
|
| "io",
|
|
readonly artifactDetails?: Readonly<{
|
|
logicalPath: string;
|
|
declaredSha256: string | null;
|
|
calculatedSha256: string | null;
|
|
unpacked: boolean;
|
|
}>,
|
|
/** The specific constraint that failed, such as the colliding path. */
|
|
readonly detail?: string,
|
|
options?: AnalysisErrorOptions,
|
|
) {
|
|
super(
|
|
artifactDetails === undefined
|
|
? `Artifact ${operation} failed: ${reason}`
|
|
: `Artifact ${operation} failed: ${reason} at ${artifactDetails.logicalPath} (declared_sha256=${artifactDetails.declaredSha256 ?? "unavailable"}, calculated_sha256=${artifactDetails.calculatedSha256 ?? "unavailable"}, unpacked=${String(artifactDetails.unpacked)})`,
|
|
options,
|
|
);
|
|
}
|
|
}
|