fix(javascript): accept the Wakaru 1.x release line and verify 1.14.0 (#1540)
* fix(javascript): accept the Wakaru 1.x release line and verify 1.14.0 Exact --version equality rejected every Wakaru build except 1.13.0, and strict report schemas rejected any added field, so each upstream release broke recovery until REA re-pinned. Wakaru now documents that --version, --json and provenance.json change only by addition within a major version. Admit ^1.13.0 with the verified/compatible split used for Binwalk and Unblob, report the observed version instead of the pinned constant, and add a limitation for unverified releases. Parse reports with loose objects and keep the reported module status as a string; path, identity, range and file-set checks stay exact. Move the audited pin, submodule, CI binary and verifier to 1.14.0, and document where to get the binary from the refusal message. * fix(javascript): project known Wakaru warning fields --------- Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>
This commit is contained in:
@@ -24,11 +24,8 @@ import {
|
||||
} from "./WakaruCommand.js";
|
||||
import { parseWakaruReports } from "./WakaruReport.js";
|
||||
import { publishWakaruArtifacts } from "./WakaruPublication.js";
|
||||
import {
|
||||
RECOVERY_LIMITS,
|
||||
WAKARU_RELEASE,
|
||||
WAKARU_PROVIDER_IDENTITY,
|
||||
} from "./WakaruRelease.js";
|
||||
import { RECOVERY_LIMITS, WAKARU_PROVIDER_IDENTITY } from "./WakaruRelease.js";
|
||||
import { admitWakaruVersion } from "./WakaruVersion.js";
|
||||
|
||||
const OPERATION = "recover_javascript_sources";
|
||||
const MODES = {
|
||||
@@ -66,12 +63,13 @@ const executeWakaruRecovery = async (context: RecoveryWorkspace) => {
|
||||
...commandContext,
|
||||
arguments: ["--version"],
|
||||
});
|
||||
if (
|
||||
version.exit_code !== 0 ||
|
||||
version.stdout.trim() !== `wakaru ${WAKARU_RELEASE.version}`
|
||||
) {
|
||||
const admitted =
|
||||
version.exit_code === 0
|
||||
? admitWakaruVersion(version.stdout.trim())
|
||||
: undefined;
|
||||
if (admitted === undefined || admitted.status === "unsupported") {
|
||||
// The message names the mismatch; the reason also keeps the tool's stderr.
|
||||
const mismatch = `This adapter requires Wakaru ${WAKARU_RELEASE.version}; reported version: ${version.stdout.trim()}; exit: ${String(version.exit_code)}`;
|
||||
const mismatch = `${admitted?.message ?? `Wakaru --version failed; reported version: ${version.stdout.trim()}`}; exit: ${String(version.exit_code)}`;
|
||||
throw new AnalysisCapabilityUnavailableError(
|
||||
"wakaru",
|
||||
OPERATION,
|
||||
@@ -106,20 +104,22 @@ const executeWakaruRecovery = async (context: RecoveryWorkspace) => {
|
||||
sourceBytes: snapshot,
|
||||
files,
|
||||
});
|
||||
return { version, run, parsed };
|
||||
return { version, admitted, run, parsed };
|
||||
};
|
||||
|
||||
/** Publish validated recovery and retain exact source and engine bindings. */
|
||||
export const prepareWakaruExecution = async (context: RecoveryWorkspace) => {
|
||||
const { root, tree, input, source, engine, options } = context;
|
||||
const staging = join(root, "modules");
|
||||
const { version, run, parsed } = await executeWakaruRecovery(context);
|
||||
const { version, admitted, run, parsed } =
|
||||
await executeWakaruRecovery(context);
|
||||
const result = await publishWakaruArtifacts({
|
||||
tree,
|
||||
staging,
|
||||
input,
|
||||
source,
|
||||
engine,
|
||||
admitted,
|
||||
parsed,
|
||||
execution: run,
|
||||
...(options?.signal === undefined ? {} : { signal: options.signal }),
|
||||
@@ -150,25 +150,29 @@ export const prepareWakaruExecution = async (context: RecoveryWorkspace) => {
|
||||
OPERATION,
|
||||
"Configured engine bytes changed during recovery",
|
||||
);
|
||||
return createAnalysisExecution(result, WAKARU_PROVIDER_IDENTITY, {
|
||||
rawResult: jsonValueSchema.parse({
|
||||
version,
|
||||
execution: run,
|
||||
report: parsed.report,
|
||||
provenance: parsed.provenance,
|
||||
}),
|
||||
subject: {
|
||||
path: source.path,
|
||||
sha256: source.sha256,
|
||||
format: "javascript",
|
||||
return createAnalysisExecution(
|
||||
result,
|
||||
{ ...WAKARU_PROVIDER_IDENTITY, version: admitted.version },
|
||||
{
|
||||
rawResult: jsonValueSchema.parse({
|
||||
version,
|
||||
execution: run,
|
||||
report: parsed.report,
|
||||
provenance: parsed.provenance,
|
||||
}),
|
||||
subject: {
|
||||
path: source.path,
|
||||
sha256: source.sha256,
|
||||
format: "javascript",
|
||||
},
|
||||
locations: [
|
||||
{ kind: "artifact-path", path: source.path },
|
||||
...result.modules.map((module) => ({
|
||||
kind: "artifact-path" as const,
|
||||
path: module.artifact.path,
|
||||
})),
|
||||
],
|
||||
limitations: result.limitations,
|
||||
},
|
||||
locations: [
|
||||
{ kind: "artifact-path", path: source.path },
|
||||
...result.modules.map((module) => ({
|
||||
kind: "artifact-path" as const,
|
||||
path: module.artifact.path,
|
||||
})),
|
||||
],
|
||||
limitations: result.limitations,
|
||||
});
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user