Repository navigation
feat(windows): inventory Windows Registry hive base blocks offline - #9865
2SinceJuly wants to merge 42 commits into
Conversation
REA had no offline REGF inspection: inspect-artifact treated a SYSTEM, SOFTWARE or NTUSER.DAT file as an ordinary file, so an analyst holding one outside a Windows host could not ask even whether its header was well formed. Recognise the regf magic from the bytes under any name, then report the base block's versions, sequence pair, checksum status and the hive-bin and cell spans those bins declare. A sequence mismatch is reported as dirty and a checksum mismatch as a limitation rather than a refusal, because a dirty hive is exactly what gets handed to an analyst. A bin or cell that overruns, an unexpected signature or an unread tail stops the walk with a diagnostic naming the offset, so no fact is reported for bytes that were not examined. Key nodes, value records, security descriptors and .LOG1/.LOG2 replay are not decoded and are named in the reader limitation; they are the next steps in docs/specs/native/registry-hive/tasks.md. Verified with npm run check:fast, npm run docs:check, and the src/artifacts and src/domain suites (585 files, 12451 tests). Fixtures are synthesized; no real hive written by a Windows host was tested.
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. |
check:ci:fast failed on format:check for the four files added in the previous commit. oxfmt line-wraps the long import, constructor call, coverageOf signature and the path array; no behavior changes.
REA_REGF_HIVE_MAX_FILE_BYTES defaults to 512 MiB, with a 4096-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_REGF_HIVE_MAX_FILE_BYTES still seeds regf.hive_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 hive 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.
# Conflicts: # docs/specs/README.md # src/artifacts/ArtifactReader.ts # src/artifacts/artifactFormats.test.ts # src/artifacts/artifactFormats.ts # src/artifacts/inventory/ArtifactGraphConstruction.ts # src/domain/artifactFormatMetadata.ts # src/domain/artifactGraph.ts # src/domain/evidenceSubject.ts # src/ghidra/GhidraFunctionValues.test.ts
|
Merged
Verified: |
main moved the shared NTFS schemas into windows/ntfsMftAttributes.ts and grew the settings model. Conflict in src/domain/artifactFormatMetadata.ts resolved by keeping main's shared import and dropping the branch-local ntfsFileReferenceSchema duplicate; the rest auto-merged.
|
Closing this rather than merging it:
Nothing in this branch is lost work worth salvaging — rewriting it onto the current registry would mean porting the witness model, which is a smaller change than the diff here. |
Summary
Fixes #9424(first step).An analyst who receives a
SYSTEM,SOFTWARE,SAM,SECURITYorNTUSER.DATfile outside a Windows host can only inspect its header by hand.inspect_artifacttreated every registry hive as an ordinary file. This changerecognises the REGF format from its bytes and reports what its base block and
hive bins declare, so later steps have an owned, validated parse to build value
decoding on.
Problem and expected behavior
Before:
git grep -i "regf\|registry hive" srcfound nothing, and a hive fileclassified as
filewhatever its name. After: a file beginning with theregfmagic is root format
regf-hive, and the reader reports the base block's majorand minor version, the primary and secondary sequence numbers, whether the
checksum matches, and the hive-bin and cell spans the bins declare.
Change and scope
src/domain/windows/registryHive.tsowns the bytes: base-block validation, thebin walk and the cell walk, each returning a tagged
formatorlimitfailure.
hasRegfHiveSignatureprovides recognition for classification.RegistryHiveArtifactReaderreads the admitted file throughArtifactFileSourceand exposes the facts throughformatMetadata(). A hiveis its own content, so the root occurrence carries every fact and no members
are enumerated.
regf-hivejoins the artifact format ids, the content-format list, the formatregistry,
ARTIFACT_FORMAT_IDS-derived Evidence subjects and the byteclassifier (placed before the plist and executable probes, since the magic is
unambiguous).
A sequence mismatch is reported as
dirtyand a checksum mismatch as alimitation rather than a refusal: a dirty hive is precisely what an analyst is
handed. A bin or cell that overruns, an unexpected signature, or a tail the walk
did not reach stops it with a diagnostic naming the offset, so no fact is
reported for bytes that were not examined.
Intentionally not included: key nodes, value records and typed value decoding,
subkey and value indexes, class data, security descriptors and
.LOG1/.LOG2replay. They are named in the reader limitation and are the next steps in
docs/specs/native/registry-hive/tasks.md.Contract and boundary impact
src/domain/windows/registryHive.tsproduces every parsed fact;
RegistryHiveArtifactReaderreads bytes andclassifyArtifactBytesselects the format. No existing reader or classifierpath changed, and no superseded representation was left behind.
listed as supported in
CONTRIBUTING.md#contribution-scope, and this reads onecaller-selected local file. It adds no target execution, injection, mutation,
protection recovery, network access or host registry access, so no maintainer
scope decision is required — the same reading recorded in
docs/specs/native/windows-shortcut/plan.md.through the existing
inspect_artifactrouting; no command or tool was added.platform-independent; no Windows API, registry mount or privilege is involved.
regf-hivemetadata kind is added to the format-metadata union, and comparisondeclares that its fields come from the file's own bytes.
Expected effects:
Evidence and regression coverage
src/domain/windows/registryHive.test.ts(10) covers aclean hive, a mismatched sequence pair, a wrong checksum, a cell crossing its
bin, a cell size that is not a multiple of eight, a declared bin span longer
than the file, a missing
regfsignature, a short file, the fixed ceiling anduneven chunk feeding.
src/artifacts/RegistryHiveArtifactReader.test.ts(2)drives the real inventory pipeline for a clean and a dirty hive.
ArtifactGraphConstruction.test.tsadds classification underSYSTEM,NTUSER.DATand a neutral name;artifactFormats.test.tsextends thereader-format union.
origin/main(b2f3dc81f) a hive fileclassifies as
file; the new case assertsregf-hive.Windows host was run, and no
.LOG1/.LOG2behaviour is claimed.Validation performed
npm run check:fast— typecheck and lint passed.npm run docs:check— passed (9 readme-consistency tests).npx vitest run src/artifacts/ src/domain/— 585 files, 12451 tests passed,1 skipped.
Compatibility, safety, and release
filenow reports
regf-hiveonly when it actually begins withregf.host interaction.
regular file under a fixed 512 MiB ceiling, never writes to it, and reports
malformed structure as a failure instead of guessing.
Author readiness
Human owner: @2SinceJuly
Before merge
type(scope): outcome.Depends on #9885.
Summary
Part of #9424(base block, hive bins, and cell spans only).inspect_artifactrecognises REGF from its bytes and reports what the base block and hive bins declare.The whole-file ceiling is
regf.hive_max_file_bytes, seeded byREA_REGF_HIVE_MAX_FILE_BYTES(default 512 MiB, floor 4096 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 #9424
Key nodes, typed values,
.LOG1/.LOG2replay, key-path queries, and real hive fixtures stay out of this PR.Validation performed
npm run check:fastandoxfmt --checkpassed onf700a32f4.node scripts/verify/rea-numeric-limits.mjspassed.