mirror of
https://github.com/morluto/rea.git
synced 2026-12-04 01:54:49 +00:00
* feat(metadata)!: give NTFS, Maven report and NuGet budgets typed per-call controls inspect_ntfs_journal refused acquisitions above a fixed 64 MiB allowance; it now takes max_file_bytes (default 64 MiB) and re-admits a retained acquisition under the call's budget, so lowering it cannot reuse a larger cached read. inspect_maven_gradle_metadata refused at six fixed report allowances; they are now report_limits fields (CLI --report-limits JSON) with today's values as defaults. Maven max_file_bytes and NuGet max_file_bytes, max_entries and max_nuspec_bytes refusals now report details.limit from the same bounds objects the schemas use. The Ghidra installation-properties read allowance is registered as a protocol bound: it reads the provider's own short installation descriptor, not analysis input. BREAKING CHANGE: NTFS and Maven report refusals report details.limit instead of a fixed_ceiling refusal, and parseMavenGradleMetadata and the inspect_ntfs_journal input contract gain the new controls. * fix(metadata): keep omitted NTFS budgets omitted and type host and maximum recovery inspect_ntfs_journal recorded the default max_file_bytes as if the caller had chosen it; the field is now optional and resolved for execution only, so Evidence keeps omission. A host allocation failure while holding an admitted acquisition is reported as measured memory exhaustion instead of generic I/O. A Maven report refusal whose need exceeds the control's maximum no longer suggests raising it. A public CLI/MCP test covers report_limits refusal and recovery for a POM.
41 lines
2.0 KiB
TypeScript
41 lines
2.0 KiB
TypeScript
import { decodeLimit } from "../domain/parseFailure.js";
|
|
import type { MavenGradleReportLimitField } from "../domain/java/mavenGradleMetadata.js";
|
|
/** The ParseFailure format of a Maven POM or Gradle module metadata file. */
|
|
export const MAVEN_GRADLE_METADATA_FORMAT = "maven-gradle-metadata";
|
|
|
|
const REPORT_REFUSALS: Readonly<
|
|
Record<
|
|
MavenGradleReportLimitField,
|
|
(required: number, limit: number) => string
|
|
>
|
|
> = {
|
|
repeated_variant_name_chars: (required, limit) =>
|
|
`Gradle module metadata would repeat ${String(required)} characters of variant names across its dependency rows, above the ${String(limit)}-character report allowance.`,
|
|
dependency_rows: (required, limit) =>
|
|
`Metadata declares ${String(required)} dependency and constraint rows, above the ${String(limit)}-row report allowance.`,
|
|
variants: (required, limit) =>
|
|
`Gradle module metadata declares ${String(required)} variants, above the ${String(limit)}-variant report allowance.`,
|
|
exclusions: (required, limit) =>
|
|
`Metadata declares ${String(required)} dependency exclusions, above the ${String(limit)}-exclusion report allowance.`,
|
|
unresolved_records: (required, limit) =>
|
|
`Metadata needs at least ${String(required)} unresolved reference and coordinate records, above the ${String(limit)}-record report allowance.`,
|
|
xml_nodes: (required, limit) =>
|
|
`Maven POM holds more than ${String(limit)} XML nodes (at least ${String(required)} counted), above the ${String(limit)}-node allowance for its document tree.`,
|
|
};
|
|
|
|
/**
|
|
* Refuse a report that would grow far past the input bytes. Each dependency
|
|
* row (with its unresolved-coordinate records), variant, exclusion and
|
|
* repeated variant name expands a few input bytes into a much larger report.
|
|
*/
|
|
export const metadataReportLimit = (
|
|
allowance: MavenGradleReportLimitField,
|
|
maximum: number,
|
|
required: number,
|
|
) =>
|
|
decodeLimit(
|
|
MAVEN_GRADLE_METADATA_FORMAT,
|
|
REPORT_REFUSALS[allowance](required, maximum),
|
|
{ name: allowance, maximum, required },
|
|
);
|