mirror of
https://github.com/morluto/rea.git
synced 2026-11-26 22:28:44 +00:00
fix(rizin): state that the executable digest precedes both launches
REA hashes the selected executable before the -v probe and the command run, so a file replaced in between gives a SHA-256 of the old file beside the identity and output of the new one. The documentation said so, but inline Evidence did not. Evidence that records provider_executable_sha256, identified or assumed, now carries a limitation saying the digest was read before both launches and does not prove the bytes that ran.
This commit is contained in:
1 parent
f160a56f20
commit
a2fc5a11fb
3 files changed
+16
-1
No files matched your search
@@ -102,7 +102,8 @@ since the cut could fall inside its version. The budget and the recorded banner
|
||||
cover the line as printed, surrounding whitespace included; only identification
|
||||
ignores that whitespace. These describe the file at that path when
|
||||
REA checked it; they cannot prove the exact bytes executed if the file changes
|
||||
before the launch. A different tool that accepts the same arguments, such as
|
||||
before the launch, and Evidence that records the SHA-256 says so in a limitation.
|
||||
A different tool that accepts the same arguments, such as
|
||||
radare2, still runs: its Evidence names that tool and adds a limitation. A probe
|
||||
that fails, times out, prints output that is not valid UTF-8 or prints an
|
||||
unrecognized banner leaves the version unknown, and the command still runs.
|
||||
|
||||
@@ -893,6 +893,9 @@ export class ReverseEngineeringService {
|
||||
identity: profile.identity,
|
||||
limitations: [
|
||||
`The executable version and supported formats are reported as unknown because ${reason}.`,
|
||||
...(observed?.provider_executable_sha256 === undefined
|
||||
? []
|
||||
: [EXECUTABLE_DIGEST_TIMING]),
|
||||
...(probe === undefined ? [] : [probe.assumedIdentity]),
|
||||
],
|
||||
parameters:
|
||||
@@ -1014,6 +1017,7 @@ export class ReverseEngineeringService {
|
||||
identity: identification.identity,
|
||||
limitations: [
|
||||
`The executable version comes from ${banner}; supported formats remain unknown.`,
|
||||
EXECUTABLE_DIGEST_TIMING,
|
||||
...identification.limitations,
|
||||
],
|
||||
parameters: { ...bannerParameters, provider_identity: "banner" },
|
||||
@@ -1165,6 +1169,10 @@ type VersionProbeOutcome =
|
||||
};
|
||||
|
||||
/** Why a probe that read no usable banner leaves the version unknown. */
|
||||
/** A digest read before launch cannot bind the bytes that ran. */
|
||||
export const EXECUTABLE_DIGEST_TIMING =
|
||||
"The executable's SHA-256 was read before the probe and the command launched, so it does not prove the bytes that ran.";
|
||||
|
||||
export const VERSION_PROBE_FAILURE_REASONS = {
|
||||
failed: "did not complete successfully",
|
||||
"timed-out": "reached the command deadline",
|
||||
|
||||
@@ -6,6 +6,7 @@ import { expect, expectTypeOf, it, vi } from "vitest";
|
||||
|
||||
import {
|
||||
digestFile,
|
||||
EXECUTABLE_DIGEST_TIMING,
|
||||
type ReverseEngineeringProcesses,
|
||||
VERSION_PROBE_FAILURE_REASONS,
|
||||
} from "../../../src/application/reverse/ReverseEngineeringService.js";
|
||||
@@ -90,6 +91,8 @@ posix(
|
||||
provider_version_banner_truncated: false,
|
||||
provider_identity: "banner",
|
||||
});
|
||||
// The digest precedes both launches, which Evidence states.
|
||||
expect(result.value.limitations).toContain(EXECUTABLE_DIGEST_TIMING);
|
||||
}
|
||||
// Each call probes, then runs its command, both from the resolved path
|
||||
// and within the call's budget.
|
||||
@@ -283,6 +286,7 @@ posix(
|
||||
expect(result.value.parameters).not.toHaveProperty(
|
||||
"provider_version_banner",
|
||||
);
|
||||
expect(result.value.limitations).toContain(EXECUTABLE_DIGEST_TIMING);
|
||||
expect(result.value.raw_result).toMatchObject({
|
||||
stdout: "command output",
|
||||
});
|
||||
@@ -670,6 +674,8 @@ posix(
|
||||
expect(result.value.limitations).toContain(
|
||||
"The executable version and supported formats are reported as unknown because the executable could not be read (EACCES).",
|
||||
);
|
||||
// Without a digest there is no digest timing to qualify.
|
||||
expect(result.value.limitations).not.toContain(EXECUTABLE_DIGEST_TIMING);
|
||||
},
|
||||
);
|
||||
|
||||
|
||||
Reference in new issue
Block a user