Repository navigation
feat(artifacts): inventory NTFS $MFT record headers offline - #9868
2SinceJuly wants to merge 40 commits into
Conversation
An acquired $MFT stream had no reader, so an analyst holding one could only treat it as an opaque file. Recognize the FILE signature of the first record and inventory every record's header: sequence number, flags, used and total bytes, base record reference and update-sequence array. Each record's update-sequence fixups are verified against its sector trailers. A mismatch keeps the header facts, is reported on the record and is counted in the metadata, so a record that was not cleanly written is visible rather than silently accepted. A missing or short array is reported as unverified, a wrong signature stops the scan at its offset, and a trailing partial record is reported as a byte count. Attributes, filenames and the $UsnJrnl:$J journal are not decoded, so no path or change history is claimed. Fixes morluto#9867
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
The new NTFS $MFT files were committed unformatted, so the Static checks lane failed on format:check. Formatting only; no behaviour change.
REA_NTFS_MFT_MAX_FILE_BYTES defaults to 512 MiB, with a 48-byte floor and an 8 GiB maximum. A file past the effective ceiling names the setting, its source, and the range, and says to restart REA. There is no runtime override.
REA_NTFS_MFT_MAX_FILE_BYTES still seeds ntfs.mft_max_file_bytes. Each inventory reads the accepted snapshot, and update_analysis_settings changes the next call inside the existing floor and maximum.
Part of morluto#9881. Record every numeric REA_ limit and fail static checks when one is neither a runtime analysis setting nor a documented exception with a reason.
Part of morluto#9881. Add effect immediate or next_process and keep rea_restart_required, restart_required, and restartRequired as compatibility aliases.
Callers read update_mode to see whether update_analysis_settings can change a limit, and pending_restart only when a configured value is not active in this process.
GitHub CI tests the merge with main. Main now removes copied authentication even when command cleanup fails, which the evaluation command test still required to remain.
Main removes copied authentication even when command cleanup stays incomplete, and CI tests that merge. Keep the incomplete-cleanup diagnostics and the retained run directory, and expect auth.json to be gone.
Depends on morluto#9885. That branch replaces rea_restart_required with update_mode and pending_restart and forbids the legacy fields.
…tions The numeric-limit check now treats REA_WEB_BUNDLE_ENDPOINT_LITERAL_CANDIDATES as a count limit and does not count registry text as a producer.
Invalid ChangeTime settings now carry update_mode and pending_restart through the configuration error and its projection, including startup parsing. Runtime recoveries name update_analysis_settings instead of telling the caller to restart REA.
Depends on morluto#9885. The $MFT limit uses update_mode and pending_restart, and the setting declares updateMode so the numeric-limit check accepts it.
Discovery no longer treats comments or registration-list entries as producers. The three limits moving on their own PRs must join ANALYSIS_SETTINGS; the exception registry cannot classify them.
artifact_limits and web-network budgets report update_mode parameter because update_analysis_settings cannot change them. The legacy-name scan no longer reads docs, and the 2026-11-09 Ghidra receipts are restored to the fields they recorded.
A quoted name after an identifier, call, or optional chain is a producer. Only declaration arrays and comments stay out of discovery.
Property access, element access, and helper-call arguments are producers. Comments and array literals are excluded by the tree, so a later argument such as read(environment, "REA_NEW_MAX_BYTES") stays classified.
Relative links from the limit inventory into src escape the documentation site base. Point them at the repository files instead.
analysis_timeout_ms, max_heap_mb, and command_timeout_ms keep the source chosen by the caller, the runtime override, or the built-in default. A request value reports update_mode parameter because update_analysis_settings cannot change that call.
Main already expects copied auth.json to be removed when evaluation cleanup stays incomplete, and the run directory to remain.
Main left describe("Ghidra bridge script processor context contract")
with no tests after moving that check to the real provider probe.
Vitest rejects the empty suite during source tests.
…all guard dependency-free Object bindings, in-checks, and object keys that a spread can copy are producers. The architecture guard skips the TypeScript parse until typescript6 is installed, and the inventory links stay inside the published site.
The changelog and the limit migration now name runtime, restart, and parameter. parameter is the mode for a value this call supplied.
The fork credential cannot update workflow files. Leave ghidra-bridge-sources.yml at the revision already on this branch.
This branch cannot update ghidra-bridge-sources.yml, so that workflow still launches ReaArmContextProbe.java. Restore that script beside the renamed probe.
A one-test suite named for the bridge script was collected with no tests in the full source run, which failed the file. The same assertion now sits directly on the file.
Keep the Ghidra bridge context assertion on the file. Main's empty suite is the collection failure.
The main merge dropped the fs import that the file-level assertion uses.
Depends on morluto#9885. Bring the allowlist, tracked-limit rules, parameter update mode, and restored historical receipts.
|
Superseded by merged #9911, which incorporated this NTFS MFT reader with original authorship and completed public artifact admission, bounded inventory, coverage, and source-validation handling. The reader and ntfs-mft registration are present on main. Subsequent extension metadata work landed in #10006; remaining attribute/USN follow-up is tracked separately in #9914. Closing this original implementation PR to avoid merging the same capability twice. |
Summary
An acquired
$MFTstream had no reader, so an analyst holding one could onlytreat it as an opaque file. This adds offline, read-only inventory of a
selected
$MFT: every FILE record's header, flags, record extent andupdate-sequence fixup result.
Fixes #9867.Problem and expected behavior
Given a captured
$MFT(or a run ofFILErecords), the artifact inventoryhad no format for it and no facts about it. Expected:
inspect_artifactrecognizes the stream by the
FILEsignature of its first record, under anyfile name, and reports the record headers and whether their fixups survived
acquisition.
Change and scope
src/domain/windows/ntfsMft.tsowns the FILE record bytes: header fields,record-size selection (declared power of two, else the 1024-byte NTFS
default), the update-sequence array and the per-sector trailer check.
NtfsMftArtifactReaderreads the admitted file throughArtifactFileSource, reports the record-count facts informatMetadata(),and sets coverage to
unknownwith the limitations when a record's fixup doesnot verify or its array does not cover every sector.
ntfs-mftis a new artifact format id:classifyArtifactBytesprobes thesignature next to the other unambiguous magics, and the format descriptor
carries the reader limitation.
Intentionally not included, per the first-step split in the issue: attributes
and
$FILE_NAMEdecoding (so no path, hard link or timestamp is claimed), and$UsnJrnl:$Jparsing and correlation. Those are the next two steps and arerecorded as unchecked tasks in the spec.
Follows the contribution scope: reads one caller-selected local file, with no
target execution, injection, mutation, protection recovery, network access,
volume mount or live filesystem access. No maintainer scope decision needed.
Contract and boundary impact
src/domain/windows/ntfsMft.tsowns the parsed record facts;
artifactFormatMetadata.tsgains thentfs-mftstrict schema; the reader andclassifyArtifactBytesconsume it.No superseded path is removed.
artifact-reader boundaries; not applicable.
inspect_artifactroutes thenew format through the existing inventory path, and routing for every
existing format is unchanged.
is host-independent and reads bytes only.
occurrence carries the metadata; limitations flow through coverage.
caller selects one regular file; nothing else is touched.
Expected effects:
Evidence and regression coverage
src/domain/windows/ntfsMft.test.ts(14 tests: cleanrecord, failed fixup, missing array, short array, extension and directory
records, wrong signature mid-stream, trailing partial record, undeclared
record size, 4 KiB record, short file, missing signature, file-size ceiling,
chunked decoding);
src/artifacts/NtfsMftArtifactReader.test.ts(2 tests:root-occurrence metadata and coverage when a fixup fails);
ArtifactGraphConstruction.test.ts(classification under three file names);artifactFormats.test.ts(reader-format union).git grep -i "mft\|usn journal" srconorigin/mainb2f3dc81ffinds no parser, andntfs-mftwas not a format id.$MFTcapture from aWindows host has been parsed, so real record layouts, sparse MFTs and
fragmented attribute lists are unverified — and attributes are not decoded at
all in this step.
For evidence-bearing changes:
header fields are observed; a failed fixup is reported as a failed check, not
as a decoded attribute claim.
Validation performed
npm run check:fast— typecheck and lint pass (2/2 successful).npx vitest run src/artifacts src/domain/windows— 83 files, 1435 passed, 1 skipped.npm run docs:check— passes (readmeConsistency 9 tests).npm run verify:test-discovery— all 3354 test files discovered exactly once.Compatibility, safety, and release
target interaction.
file up to a fixed 512 MiB ceiling; no mount, no volume access, no mutation.
Author readiness
Human owner: @2SinceJuly
Before merge
type(scope): outcome.Depends on #9885.
Summary
An acquired
$MFTstream had no reader. This adds offline, read-only inventory of a selected$MFT: every FILE record's header, flags, record extent and update-sequence fixup result.Part of #9867.The whole-file ceiling is
ntfs.mft_max_file_bytes, seeded byREA_NTFS_MFT_MAX_FILE_BYTES(default 512 MiB, floor 48 bytes, maximum 8 GiB). Each inventory reads the accepted runtime snapshot. A file above the effective ceiling names the setting, the current value, its source (default,setting, orruntime), and the allowed range.update_analysis_settingschanges it for the next operation (update_mode: "runtime",pending_restart: false). A value outside the range is rejected and leaves the current ceiling unchanged.Still open on #9867
Header and fixup inventory is only the first step. Attributes,
$FILE_NAME,$UsnJrnl:$J, correlation, and real Windows captures stay out of this PR.Validation performed
npm run check:fastandoxfmt --checkpassed on5ff8f4f58.node scripts/verify/rea-numeric-limits.mjspassed.