* feat(erlang): inspect BEAM IFF chunks and tables Replay the Erlang BEAM inspection workflow, including table bounds, OTP 28+ atom layouts, the shared absolute-path policy, and empty-path CLI coverage, without carrying GitHub workflow edits. Co-authored-by: morluto <morluto@users.noreply.github.com> * fix(erlang): use publicInputStrictObject for BEAM tool input inspect_erlang_beam advertised a public input built with bare z.strictObject, so later shared input-policy changes would miss it. Result and internal objects stay on their own constructors. Co-authored-by: morluto <morluto@users.noreply.github.com> --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: morluto <morluto@users.noreply.github.com>
81 lines
2.5 KiB
TypeScript
81 lines
2.5 KiB
TypeScript
import {
|
|
projectArtifactIntegrityDetails,
|
|
type ArtifactIntegrityDetails,
|
|
} from "./artifactIntegrity.js";
|
|
import {
|
|
AnalysisError,
|
|
type AnalysisErrorOptions,
|
|
} from "./analysisErrorBase.js";
|
|
|
|
/** Admission named by the producing reader, with its effective byte ceiling and its source. */
|
|
export interface ArtifactAdmissionLimit {
|
|
readonly kind: "asar-header";
|
|
readonly maximumBytes: number;
|
|
readonly source: "default" | "setting";
|
|
}
|
|
|
|
/** Artifact inventory or extraction failed a typed safety boundary. */
|
|
export class ArtifactOperationError extends AnalysisError {
|
|
readonly _tag = "ArtifactOperationError";
|
|
override readonly userMessage: string | undefined;
|
|
readonly admission: ArtifactAdmissionLimit | undefined;
|
|
|
|
constructor(
|
|
readonly operation:
|
|
| "inventory_artifact"
|
|
| "inspect_artifact"
|
|
| "inspect_desktop_application"
|
|
| "inspect_pe_resources"
|
|
| "inspect_pe_certificates"
|
|
| "inspect_elf_notes"
|
|
| "inspect_erlang_beam"
|
|
| "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?: ArtifactIntegrityDetails,
|
|
/** The specific constraint that failed, such as the colliding path. */
|
|
readonly detail?: string,
|
|
options?: AnalysisErrorOptions & {
|
|
readonly userMessage?: string;
|
|
readonly admission?: ArtifactAdmissionLimit;
|
|
},
|
|
) {
|
|
super(
|
|
artifactDetails === undefined
|
|
? `Artifact ${operation} failed: ${reason}`
|
|
: artifactDetailsMessage(operation, reason, artifactDetails),
|
|
options,
|
|
);
|
|
this.admission = options?.admission;
|
|
this.userMessage =
|
|
options?.userMessage ??
|
|
(options?.admission === undefined ? undefined : detail);
|
|
}
|
|
}
|
|
|
|
const artifactDetailsMessage = (
|
|
operation: string,
|
|
reason: string,
|
|
details: ArtifactIntegrityDetails,
|
|
): string => {
|
|
const { logical_path, ...facts } = projectArtifactIntegrityDetails(details);
|
|
const description = Object.entries(facts)
|
|
.map(([key, value]) => `${key}=${String(value ?? "unavailable")}`)
|
|
.join(", ");
|
|
return `Artifact ${operation} failed: ${reason} at ${logical_path} (${description})`;
|
|
};
|