mirror of
https://github.com/morluto/rea.git
synced 2026-12-05 22:41:36 +00:00
feat(native): carry the value of each fixed structural decoding allowance (#11651)
* feat(native): carry the value of each fixed structural decoding allowance BinaryResourceFailure and relocation-index refusals pass their maximum as limit and unit; the PE certificate decoder allowances drop the value from their names and pass it with a per-payload unit; the ELF note parser names its text ceiling with the enforced value. Kernel-module and unwind providers no longer claim a fixed text or structural allowance for a memory limit that names no ceiling (no parser produces one). * fix(native): report a binary resource ceiling in the unit its producer counts BinaryResourceFailure carries an optional unit; the ELF hardening entry budget says entries and the structural byte budgets say bytes. binaryResourceCeiling reports the unit only when the producer named it, so an entry count is no longer labelled as bytes. The ELF note test takes its expected ceiling from the fixture length instead of the message.
This commit is contained in:
1 parent
9953f0e46e
commit
f060967789
20 files changed
+211
-61
No files matched your search
@@ -24,7 +24,10 @@ import {
|
||||
} from "../../domain/native/kernelModule.js";
|
||||
import { err, ok } from "../../domain/result.js";
|
||||
import { KERNEL_MODULE_PROVIDER } from "../../domain/investigationProviders.js";
|
||||
import { BinaryResourceFailure } from "../../domain/binaryContainer.js";
|
||||
import {
|
||||
BinaryResourceFailure,
|
||||
binaryResourceCeiling,
|
||||
} from "../../domain/binaryContainer.js";
|
||||
import { parseKernelModule } from "./KernelModuleParser.js";
|
||||
|
||||
const OPERATION = "inspect_kernel_module";
|
||||
@@ -75,9 +78,6 @@ export class KernelModuleProvider implements KernelModulePort {
|
||||
}
|
||||
}
|
||||
|
||||
const TEXT_BUDGET =
|
||||
"The kernel-module entry text and hash budget fixed by the admitted image length";
|
||||
|
||||
const inputBudgetRemediation = (
|
||||
boundary: "file-size" | "capacity",
|
||||
input: InspectKernelModuleInput,
|
||||
@@ -106,6 +106,7 @@ const kernelModuleFailurePrimary = (
|
||||
...fixedAllowanceOptions(
|
||||
"The ELF structural decoding allowance",
|
||||
"parser",
|
||||
binaryResourceCeiling(cause),
|
||||
),
|
||||
},
|
||||
);
|
||||
@@ -122,9 +123,8 @@ const kernelModuleFailurePrimary = (
|
||||
cause instanceof ArtifactReaderFailure
|
||||
) {
|
||||
if (cause.reason === "limit") {
|
||||
// Caller-selected read and entry budgets name the bound to raise.
|
||||
// Entry text and hashes are bounded by the admitted image, so host
|
||||
// memory cannot raise that ceiling.
|
||||
// Caller-selected read and entry budgets name the bound to raise; a
|
||||
// memory limit keeps only a ceiling its reader named.
|
||||
const textBudget = cause.boundary === "memory";
|
||||
return new AnalysisResourceConstraintError(
|
||||
OPERATION,
|
||||
@@ -139,7 +139,12 @@ const kernelModuleFailurePrimary = (
|
||||
...(cause.boundary === undefined
|
||||
? {}
|
||||
: textBudget
|
||||
? fixedAllowanceOptions(TEXT_BUDGET, "parser")
|
||||
? cause.fixedAllowance === undefined
|
||||
? {}
|
||||
: {
|
||||
retryable: false as const,
|
||||
fixedAllowance: cause.fixedAllowance,
|
||||
}
|
||||
: {
|
||||
retryable: false as const,
|
||||
remediationAction: inputBudgetRemediation(
|
||||
|
||||
Reference in new issue
Block a user