fix(wasm): state the accepted WABT release range from its owning constant (#14205)

* fix(wasm): state the accepted WABT release range from its owning constant

`WabtRelease.ts` admits caller-supplied WABT `>=1.0.42 <1.1.0`, but the
`inspect_wasm_artifact` description, the capability inventory
remediation and the WASM static-inspection guidance said "WABT 1.0.42",
and a source comment and the WASM guide claimed managed downloads stay
pinned, although REA downloads no WABT.

The accepted range and the caller-facing release line now live in the
domain beside `WABT_VERSION`, so the contract description, inventory
remediation, error guidance and adapter messages all render the same
"WABT >=1.0.42 <1.1.0 (verified with 1.0.42)". The download claim is
removed, and the guides and skill source state the range.

* docs(wasm): state the accepted WABT release range in one owning guide section

The bundled WABT README still required an exact 1.0.42 banner while the
guide and supported-targets table stated the admitted range. Keep the range
in the WASM guide's Configure WABT section and link to it from the README
and the supported-targets table; the README keeps the verified release,
source commit and archive digest.

* test(wasm): derive WABT version assertions from the owning constants

Assert the verified release and caller-facing release line through
WABT_VERSION and WABT_RELEASE_LINE, and drop the literal range pin that the
owner-level admission boundary checks already cover.

* test(wasm): type the WABT version probe fixture by its owning type

Deriving expected_version from WABT_VERSION in an untyped literal widened
it to string; annotate the fixture as WabtVersionProbe instead.
This commit is contained in:
morluto
2026-11-24 00:28:27 +00:00
committed by GitHub
parent 8ed819573b
commit af53dd9df1
13 changed files with 57 additions and 45 deletions
+6 -2
View File
@@ -1,8 +1,8 @@
# Offline WebAssembly artifacts
`inspect_wasm_artifact` / `inspect-wasm-artifact` inspects explicitly selected
local WASM bytes using caller-supplied WABT 1.0.42 or a later 1.0.x release
(verified with 1.0.42). No active binary target is required. REA does not install tools or fetch artifacts and does not execute WASM.
local WASM bytes using caller-supplied WABT tools
([accepted releases](#configure-wabt)). No active binary target is required. REA does not install tools or fetch artifacts and does not execute WASM.
`open_binary` is not the WASM inspection route. A recognized WASM v1 header
returns `target_unavailable` with category `unsupported_target` and constraint
@@ -18,6 +18,8 @@ The recognized WASM header is checked before automatic database routing from a
diagnostic. An explicit database selection or raw/COM format selection retains
the caller's requested interpretation; ordinary .hop database routing is unchanged.
## Configure WABT
Set `REA_WABT_BIN_DIRECTORY` to an absolute directory containing executable
`wasm-validate`, `wasm-objdump` and `wasm2wat` (with `.exe` on Windows). Missing
executables, unsupported banners and inaccessible tools produce actionable
@@ -42,6 +44,8 @@ MCP, change the server's launch environment and restart/reconnect that server;
exporting a variable in a different shell does not update a running server.
REA never installs tools or relaxes version admission to recover.
## Inspect a module
```bash
REA_WABT_BIN_DIRECTORY=/absolute/wabt/bin rea inspect-wasm-artifact \
/artifacts/module.wasm --glue_paths /artifacts/glue.js \
+1 -1
View File
@@ -25,7 +25,7 @@ The table lists what REA returns for each target and which tools or host it requ
| Linux kernel modules | .modinfo keys, __versions CRCs, this_module presence, and signature trailer | Built-in static ELF inspection; [kernel modules](../kernel-modules.md) |
| Erlang BEAM | IFF chunks, atoms, exports, imports, lambdas and the Code header | Built-in static BEAM inspection; [Erlang BEAM](../erlang-beam.md) |
| NuGet packages | Package identity, dependency groups, license, repository and ZIP contents | Built-in static .nupkg inspection; [NuGet packages](../guides/managed/nuget-nupkg.md) |
| WASM artifact | Validation, sections, exact import/export WAT forms and decoded WAT | Caller-supplied WABT 1.0.42; `inspect_wasm_artifact` |
| WASM artifact | Validation, sections, exact import/export WAT forms and decoded WAT | Caller-supplied [WABT](../guides/wasm/wasm-artifacts.md#configure-wabt); `inspect_wasm_artifact` |
| EVM bytecode | Dispatch selectors, byte offsets, inferred arguments and mutability | Local raw/hex carrier on Linux x64; [offline EVM guide](../guides/evm/evm-bytecode.md) |
| SQLite databases | Tables, columns, indexes, views, triggers and selected ordinary-table rows | Local database/WAL snapshot; Node.js 24.x >=24.15 or 26+ with native SQLite limits |
| Recorded Linux crashes | Raw notes, every recorded thread's registers/signals and optional mapping candidates | Caller-supplied pwntools on Linux x64; optional GDB/pwndbg; [recorded crashes](../guides/native/recorded-crashes.md) |
+2 -2
View File
@@ -1,4 +1,5 @@
import { PCAP_CAPTURE_UNSUPPORTED_HOST_REASON } from "../domain/pcap/pcapAnalysis.js";
import { WABT_RELEASE_LINE } from "../domain/wasm/wasmArtifact.js";
import { DEFAULT_CALL_RELATIONSHIP_DIRECTION } from "../contracts/enhancedInputs.js";
import {
FIRMWARE_OPERATION_ENGINES,
@@ -592,8 +593,7 @@ const workflowAvailabilityFor = (
? { reason: "available", remediation: null }
: {
reason: "provider_missing",
remediation:
"Supply WABT 1.0.42 via absolute REA_WABT_BIN_DIRECTORY. No active binary target is required; tools are checked at execution.",
remediation: `Supply ${WABT_RELEASE_LINE} via absolute REA_WABT_BIN_DIRECTORY. No active binary target is required; tools are checked at execution.`,
};
if (kind === "android-provider")
return policy.androidAnalysisAvailability?.status === "available"
+2 -2
View File
@@ -1,6 +1,7 @@
import { COMPARE_WASM_INTERFACES_CONTRACT } from "./wasmComparisonContracts.js";
import {
inspectWasmArtifactInputSchema,
WABT_RELEASE_LINE,
wasmArtifactSchema,
} from "../../domain/wasm/wasmArtifact.js";
import type { ToolContract } from "../toolContractTypes.js";
@@ -30,8 +31,7 @@ export const INSPECT_WASM_ARTIFACT_CONTRACT = {
),
kind: "artifact-provider",
requiresActiveTarget: true,
description:
"Validate and inspect local WASM with caller-supplied WABT 1.0.42, without executing it or fetching dependencies. Returns artifact SHA-256, sections, import/export WAT forms and decoded WAT; custom-section interpretation warnings do not invalidate the core module. Default complete returns full Evidence; detail summary retains it for inspect_analysis_view kind wasm using normalized_result.parent_evidence_id, with import/export rows or UTF-16 WAT pages. Delivery does not change analysis. Optional JavaScript glue associations preserve ambiguous candidates. Configure absolute REA_WABT_BIN_DIRECTORY. Per-call command_timeout_ms, input/tool/output, interface-precision and auxiliary-path budgets are independent; reported limit errors identify the control to adjust. No installation or original-source claim.",
description: `Validate and inspect local WASM with caller-supplied ${WABT_RELEASE_LINE}, without executing it or fetching dependencies. Returns artifact SHA-256, sections, import/export WAT forms and decoded WAT; custom-section interpretation warnings do not invalidate the core module. Default complete returns full Evidence; detail summary retains it for inspect_analysis_view kind wasm using normalized_result.parent_evidence_id, with import/export rows or UTF-16 WAT pages. Delivery does not change analysis. Optional JavaScript glue associations preserve ambiguous candidates. Configure absolute REA_WABT_BIN_DIRECTORY. Per-call command_timeout_ms, input/tool/output, interface-precision and auxiliary-path budgets are independent; reported limit errors identify the control to adjust. No installation or original-source claim.`,
inputSchema: wasmArtifactInspectionInputSchema,
outputSchema: analysisDetailOutputSchemaOf(
wasmArtifactSchema,
+2 -1
View File
@@ -1,4 +1,5 @@
import { describeResidualUnknownGraphConstraint } from "./residualUnknownGraphError.js";
import { WABT_RELEASE_LINE } from "./wasm/wasmArtifact.js";
import { knownArgumentMistakeRemediation } from "./inputArgumentGuidance.js";
import {
AnalysisAccessDeniedError,
@@ -219,7 +220,7 @@ export const analysisErrorRemediationAction = (
error instanceof BinaryTargetError &&
error.constraint === "wasm_requires_static_inspection"
)
return `For static inspection, call inspect_wasm_artifact with ${JSON.stringify({ path: error.path })}. This separate lane requires caller-supplied WABT 1.0.42 via absolute REA_WABT_BIN_DIRECTORY; check its availability in binary_session. REA does not execute WASM or install tools, and the header alone does not establish that the complete module is valid.`;
return `For static inspection, call inspect_wasm_artifact with ${JSON.stringify({ path: error.path })}. This separate lane requires caller-supplied ${WABT_RELEASE_LINE} via absolute REA_WABT_BIN_DIRECTORY; check its availability in binary_session. REA does not execute WASM or install tools, and the header alone does not establish that the complete module is valid.`;
if (
error instanceof AnalysisAccessDeniedError ||
(error instanceof BinaryTargetError && error.systemCode !== undefined)
+11
View File
@@ -11,6 +11,17 @@ import { absoluteLocalPathStringSchema } from "../localPath.js";
import { sha256Hex } from "../../kernel/sha256Hex.js";
/** Exact upstream release whose tool profile REA verified. */
export const WABT_VERSION = "1.0.42";
/**
* Releases admitted for caller-configured tools; REA does not download WABT.
* WABT changes `wasm-validate`, `wasm-objdump` and `wasm2wat` output only by
* addition within a minor version. The upper bound is exclusive of 1.1.0 so
* admission matches the `1.0.x` banners `wasmArtifactSchema` accepts; letting
* 1.1.0 through would admit a tool profile whose report the schema then
* rejects after inspection ran.
*/
export const WABT_ACCEPTED_RANGE = `>=${WABT_VERSION} <1.1.0`;
/** Caller-facing accepted releases, naming the verified build. */
export const WABT_RELEASE_LINE = `WABT ${WABT_ACCEPTED_RANGE} (verified with ${WABT_VERSION})`;
const WABT_MINIMUM_PATCH = Number(WABT_VERSION.split(".")[2]);
/** Upstream revision known for the verified release only. */
export const WABT_SOURCE_COMMIT = "ff0ef7e0009402740c805a9744c09b05be063e48";
+3 -3
View File
@@ -9,6 +9,7 @@ import { WasmArtifactService } from "../application/wasm/WasmArtifactService.js"
import {
wasmArtifactSchema,
WASM_RESOURCE_DEFAULTS,
WABT_VERSION,
} from "../domain/wasm/wasmArtifact.js";
import { PrivateRuntimeRoot } from "../process/PrivateRuntimeRoot.js";
import { PrivateRuntimeRootUnavailableError } from "../domain/privateRuntimeRootUnavailableError.js";
@@ -17,7 +18,7 @@ import { OwnedCommandFailure } from "../process/OwnedCommand.js";
import { projectAnalysisError } from "../domain/analysisErrorProjection.js";
import { primaryAnalysisError } from "../domain/analysisErrorBase.js";
import { AnalysisCancelledError } from "../domain/analysisErrorCore.js";
import { admitWabtVersion, WABT_ACCEPTED_RANGE } from "./WabtRelease.js";
import { admitWabtVersion } from "./WabtRelease.js";
/** Classify a raw failure the way the provider does, through WABT's dialect. */
const wabtFailure = (
@@ -27,9 +28,8 @@ const wabtFailure = (
// Admission must not outrun the `1.0.x` banners wasmArtifactSchema accepts.
it("admits 1.0.x releases but not the 1.1.0 upper boundary", () => {
expect(WABT_ACCEPTED_RANGE).toBe(">=1.0.42 <1.1.0");
expect(admitWabtVersion("1.0.41").status).toBe("unsupported");
expect(admitWabtVersion("1.0.42").status).toBe("verified");
expect(admitWabtVersion(WABT_VERSION).status).toBe("verified");
expect(admitWabtVersion("1.0.99").status).toBe("compatible");
expect(admitWabtVersion("1.1.0").status).toBe("unsupported");
expect(admitWabtVersion("2.0.0").status).toBe("unsupported");
+5 -8
View File
@@ -50,6 +50,7 @@ import { projectAnalysisError } from "../domain/analysisErrorProjection.js";
import {
wasmArtifactSchema,
WABT_SOURCE_COMMIT,
WABT_RELEASE_LINE,
WABT_VERSION,
DEFAULT_WASM_COMMAND_TIMEOUT_MS,
wasmResourceLimits,
@@ -66,11 +67,7 @@ import {
type ArtifactCommandPath,
} from "../process/ArtifactCommandPath.js";
import { WabtRuntime } from "./WabtRuntime.js";
import {
WABT_PROVIDER_IDENTITY,
admitWabtVersion,
wabtReleaseLine,
} from "./WabtRelease.js";
import { WABT_PROVIDER_IDENTITY, admitWabtVersion } from "./WabtRelease.js";
import {
wabtFailureDialect,
wabtConfigurationRecoveryAction,
@@ -438,7 +435,7 @@ export class WabtArtifactProvider implements WasmArtifactPort {
executable_path: command.path,
tool: command.tool,
expected_version: WABT_VERSION,
accepted_releases: wabtReleaseLine(),
accepted_releases: WABT_RELEASE_LINE,
};
const version = await execute(command, ["--version"]);
const admission =
@@ -459,13 +456,13 @@ export class WabtArtifactProvider implements WasmArtifactPort {
);
}
if (admission === undefined || admission.status === "unsupported") {
const reason = `${admission?.message ?? `Unsupported ${command.tool} version banner`}; expected stdout from ${wabtReleaseLine()} with empty stderr.`;
const reason = `${admission?.message ?? `Unsupported ${command.tool} version banner`}; expected stdout from ${WABT_RELEASE_LINE} with empty stderr.`;
rejectVersion(reason);
}
// All three tools come from one directory, so admit only banners that agree.
if (observedRelease === undefined) observedRelease = admission.version;
if (observedRelease !== admission.version) {
const reason = `Configured WABT tools report different releases (${observedRelease} and ${admission.version}); select one complete ${wabtReleaseLine()} installation.`;
const reason = `Configured WABT tools report different releases (${observedRelease} and ${admission.version}); select one complete ${WABT_RELEASE_LINE} installation.`;
rejectVersion(reason);
}
if (admission.status === "compatible")
+10 -6
View File
@@ -2,10 +2,14 @@ import { spawn } from "node:child_process";
import { expect, it } from "vitest";
import { ArtifactReaderFailure } from "../resources/ArtifactReader.js";
import { projectAnalysisError } from "../domain/analysisErrorProjection.js";
import { wabtFailureDialect } from "./WabtFailures.js";
import { wabtFailureDialect, type WabtVersionProbe } from "./WabtFailures.js";
import { classifyProviderFailure } from "../providers/classifyProviderFailure.js";
import { WASM_RESOURCE_DEFAULTS } from "../domain/wasm/wasmArtifact.js";
import {
WABT_RELEASE_LINE,
WABT_VERSION,
WASM_RESOURCE_DEFAULTS,
} from "../domain/wasm/wasmArtifact.js";
import { OwnedCommandFailure } from "../process/OwnedCommand.js";
import { UnclassifiedProviderFailure } from "../domain/unclassifiedProviderFailure.js";
@@ -174,12 +178,12 @@ it.each([
? { cancellation: { reason: callerReason } }
: undefined,
);
const probe = {
configuration_key: "REA_WABT_BIN_DIRECTORY" as const,
const probe: WabtVersionProbe = {
configuration_key: "REA_WABT_BIN_DIRECTORY",
executable_path: "/tools/wasm2wat",
tool: "wasm2wat",
expected_version: "1.0.42" as const,
accepted_releases: "WABT >=1.0.42 <1.1.0 (verified with 1.0.42)",
expected_version: WABT_VERSION,
accepted_releases: WABT_RELEASE_LINE,
};
const failure = wabtFailure(cause, "configuration", "/selected.wasm", {
commandTimeoutMs: 1234,
+2 -1
View File
@@ -28,12 +28,13 @@ import { WabtAdmissionError } from "./WabtAdmissionError.js";
import type { AnalysisControlLimit } from "../domain/analysisSettings.js";
import {
DEFAULT_WASM_COMMAND_TIMEOUT_MS,
WABT_ACCEPTED_RANGE,
WABT_VERSION,
WASM_RESOURCE_DEFAULTS,
WASM_RESOURCE_MAXIMUMS,
type WasmResourceLimits,
} from "../domain/wasm/wasmArtifact.js";
import { WABT_ACCEPTED_RANGE, WABT_PROVIDER_IDENTITY } from "./WabtRelease.js";
import { WABT_PROVIDER_IDENTITY } from "./WabtRelease.js";
import { errorMessage } from "../kernel/errorMessage.js";
const OUTPUT_LIMIT_EXCERPT_BYTES = 4096;
const OPERATION = "inspect_wasm_artifact";
+6 -15
View File
@@ -1,15 +1,10 @@
import { satisfies, valid } from "semver";
import { WABT_VERSION } from "../domain/wasm/wasmArtifact.js";
import {
WABT_ACCEPTED_RANGE,
WABT_RELEASE_LINE,
WABT_VERSION,
} from "../domain/wasm/wasmArtifact.js";
/**
* Releases admitted for caller-configured tools. WABT changes `wasm-validate`,
* `wasm-objdump` and `wasm2wat` output only by addition within a minor version;
* 1.0.42 is the release this adapter verified. Managed downloads stay pinned.
* The upper bound is exclusive of 1.1.0 so admission matches the `1.0.x`
* banners `wasmArtifactSchema` accepts; letting 1.1.0 through would admit a
* tool profile whose report the schema then rejects after inspection ran.
*/
export const WABT_ACCEPTED_RANGE = `>=${WABT_VERSION} <1.1.0`;
export const WABT_PROVIDER_IDENTITY = {
id: "wabt-artifact",
name: "REA WABT artifact adapter",
@@ -26,10 +21,6 @@ export type WabtVersionAdmission =
}
| { readonly status: "unsupported"; readonly message: string };
/** Caller-facing accepted releases, naming the verified build. */
export const wabtReleaseLine = (): string =>
`WABT ${WABT_ACCEPTED_RANGE} (verified with ${WABT_VERSION})`;
/**
* Release warning for inspections that did not reach a report. Successful
* reports carry the same text through the admission limitation, so a failure
@@ -44,7 +35,7 @@ export const admitWabtVersion = (banner: string): WabtVersionAdmission => {
if (valid(token) !== token || !satisfies(token, WABT_ACCEPTED_RANGE))
return {
status: "unsupported",
message: `Unsupported WABT version ${token.length === 0 ? "banner" : token}; accepted releases are ${wabtReleaseLine()}`,
message: `Unsupported WABT version ${token.length === 0 ? "banner" : token}; accepted releases are ${WABT_RELEASE_LINE}`,
};
if (token === WABT_VERSION) return { status: "verified", version: token };
return {
@@ -9,6 +9,7 @@ import { createDoctorHostFixture } from "../../../src/application/Doctor.fixture
import { parseBinaryTarget } from "../../../src/application/BinaryTargetResolver.js";
import { projectAnalysisError } from "../../../src/domain/analysisErrorProjection.js";
import { pe } from "../../../src/domain/binaryTarget.fixture.js";
import { WABT_RELEASE_LINE } from "../../../src/domain/wasm/wasmArtifact.js";
import { createTestTempDirectory } from "../../fixtures/temporaryDirectory.js";
describe("executable format refusal diagnostics", () => {
@@ -176,7 +177,7 @@ describe("target route diagnostics", () => {
"rea inspect-wasm-artifact",
);
expect(projected.remediation.action).toContain("REA_WABT_BIN_DIRECTORY");
expect(projected.remediation.action).toContain("WABT 1.0.42");
expect(projected.remediation.action).toContain(WABT_RELEASE_LINE);
expect(await systemDoctorHost().inspectTarget(path)).toMatchObject({
ok: false,
classification: "unsupported_target",
+5 -3
View File
@@ -4,14 +4,16 @@ REA does not bundle, patch, install or download WABT executables. Operators sele
an existing tool directory with `REA_WABT_BIN_DIRECTORY`.
- Upstream: https://github.com/WebAssembly/wabt
- Admitted release: https://github.com/WebAssembly/wabt/releases/tag/1.0.42
- Verified release: https://github.com/WebAssembly/wabt/releases/tag/1.0.42
- Source commit: `ff0ef7e0009402740c805a9744c09b05be063e48`
- Upstream license: Apache-2.0, https://github.com/WebAssembly/wabt/blob/1.0.42/LICENSE
- Runtime tools: `wasm-validate`, `wasm-objdump`, `wasm2wat`.
- Verification fixture compiler: `wat2wasm` (not a runtime prerequisite).
The adapter requires every version banner to report `1.0.42` and records the
resolved executable path, SHA-256, exact banner and arguments for each tool.
The adapter admits the release range stated in the
[WASM guide](https://github.com/morluto/rea/blob/main/docs/guides/wasm/wasm-artifacts.md#configure-wabt);
1.0.42 is the only verified release. It records the resolved executable path,
SHA-256, exact banner and arguments for each tool.
Version admission identifies the supported producer profile; it does not certify
publisher authenticity. Operators remain responsible for trusted executable
provenance. No `wasm-interp`, decompiler, replacement binary parser or target