diff --git a/docs/reverse-engineering-tools.md b/docs/reverse-engineering-tools.md index e1e233e262..1c68091910 100644 --- a/docs/reverse-engineering-tools.md +++ b/docs/reverse-engineering-tools.md @@ -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. diff --git a/src/application/reverse/ReverseEngineeringService.ts b/src/application/reverse/ReverseEngineeringService.ts index ca6c2a7b58..06769bc7d0 100644 --- a/src/application/reverse/ReverseEngineeringService.ts +++ b/src/application/reverse/ReverseEngineeringService.ts @@ -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", diff --git a/tests/boundary/filesystem/reverseEngineeringToolIdentity.test.ts b/tests/boundary/filesystem/reverseEngineeringToolIdentity.test.ts index b49a600010..4a05572b2f 100644 --- a/tests/boundary/filesystem/reverseEngineeringToolIdentity.test.ts +++ b/tests/boundary/filesystem/reverseEngineeringToolIdentity.test.ts @@ -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); }, );