-
-
Notifications
You must be signed in to change notification settings - Fork 15
feat(intune): implement Windows Autopilot evidence parser outside ESP (issue #362) #450
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
9e29598
Initial plan
Copilot ad9a251
feat(intune): implement Windows Autopilot evidence parser (issue #362)
Copilot aba172e
Merge remote-tracking branch 'origin/main' into copilot/implement-aut…
adamgell 7cd55b9
fix: adapt PR #450 to current main after merge
adamgell File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
120 changes: 114 additions & 6 deletions
120
crates/cmtraceopen-parser/src/intune/enrollment/windows/autopilot/mod.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,118 @@ | ||
| //! Windows Autopilot identity, profile, and OOBE evidence outside ESP. | ||
| //! | ||
| //! Owner: issue #362 of epic #356. Implementation pending. | ||
| //! Owner: issue #362 of epic #356. | ||
| //! | ||
| //! ESP remains a sibling reducer in `crate::esp` and may be correlated through explicit enrollment/session keys; it is not renamed into Autopilot. | ||
| //! # Where the boundary with ESP sits | ||
| //! | ||
| //! This is a reserved slot created by the parser-family skeleton so that issue | ||
| //! #362 can be implemented without editing any file shared with a sibling issue. | ||
| //! Add source classification, reduction, and findings submodules here, and | ||
| //! consume the shared contracts in [`crate::intune::evidence`]. | ||
| //! Autopilot and the Enrollment Status Page are **sibling contracts**, not one | ||
| //! contract under two names. This module owns device registration and identity, | ||
| //! profile discovery, retrieval and application, OOBE mode and deployment | ||
| //! profile facts, diagnostics-page/export evidence, and the handoff into | ||
| //! enrollment and ESP. `crate::esp` continues to own app and policy progress and | ||
| //! blocking status *after* that handoff, and nothing here re-derives it. | ||
| //! | ||
| //! The only thing crossing the boundary is an explicit key. An | ||
| //! [`AutopilotEspSessionFact`] supplied by the ESP side binds to this analysis | ||
| //! when it shares an enrollment, correlation, activity, or device identifier; | ||
| //! overlapping timestamps alone can only ever produce | ||
| //! [`AutopilotEspLinkState::TimeOnlyCandidate`] at low confidence, and are | ||
| //! refused outright when the collection's timezone is missing or unrecognizable. | ||
| //! | ||
| //! # What stays native | ||
| //! | ||
| //! EVTX decoding, registry reads, diagnostics-export generation, and live OOBE | ||
| //! interaction are all outside this crate; see the wasm32 invariant in the crate | ||
| //! root. What crosses the boundary is a set of versioned, self-declaring | ||
| //! documents plus the shared | ||
| //! [`NormalizedWindowsEvent`](crate::intune::normalized::NormalizedWindowsEvent) | ||
| //! type. Nothing here performs I/O. | ||
| //! | ||
| //! # Shape | ||
| //! | ||
| //! Deliberately the same shape as `crate::esp`, so the two read side by side: | ||
| //! | ||
| //! 1. [`sources`] declares the input contract and detects document schemas; | ||
| //! 2. [`normalize`] classifies records against Microsoft's documented event | ||
| //! table, refusing to interpret anything outside it; | ||
| //! 3. [`reduce_autopilot_bundle`] folds observations into an immutable | ||
| //! [`AutopilotSnapshot`]; | ||
| //! 4. [`derive_findings`] turns that snapshot into | ||
| //! [`IntuneFinding`](crate::intune::evidence::IntuneFinding)s, each citing | ||
| //! evidence or a coverage gap and each naming the next smallest artifact; | ||
| //! 5. [`redacted_export_projection`] makes a snapshot safe to share. | ||
| //! | ||
| //! ``` | ||
| //! use cmtraceopen_parser::intune::enrollment::windows::autopilot::{ | ||
| //! reduce_autopilot_bundle, AutopilotBundleInput, AutopilotCaptureMetadata, | ||
| //! AutopilotCaptureState, AutopilotOutcome, AutopilotSourceInput, | ||
| //! }; | ||
| //! | ||
| //! let events = r#"{ | ||
| //! "autopilotDocument": "autopilot.events", | ||
| //! "documentVersion": 1, | ||
| //! "events": [{ | ||
| //! "context": { | ||
| //! "evidenceRef": { "evidenceId": "ap:0", "sourceArtifactId": "autopilot-channel" }, | ||
| //! "provenance": { | ||
| //! "sourceKind": "eventLog", "sourceArtifactId": "autopilot-channel", | ||
| //! "filePath": null, "lineNumber": null, "recordNumber": 1, | ||
| //! "registry": null, "event": null | ||
| //! }, | ||
| //! "sourceTimestamp": null, | ||
| //! "observedAtUtc": "2026-07-31T09:00:00Z", | ||
| //! "sensitivity": "public", "parseState": "parsed", "accessState": "available" | ||
| //! }, | ||
| //! "channel": "Microsoft-Windows-ModernDeployment-Diagnostics-Provider/Autopilot", | ||
| //! "provider": "Microsoft-Windows-ModernDeployment-Diagnostics-Provider", | ||
| //! "eventId": 815, | ||
| //! "level": "error", | ||
| //! "task": null, "keywords": null, "recordId": 1, "activityId": null, | ||
| //! "namedData": [], | ||
| //! "message": "ZtdDeviceHasNoAssignedProfile - No profile assigned to the device." | ||
| //! }] | ||
| //! }"#; | ||
| //! | ||
| //! let snapshot = reduce_autopilot_bundle(&AutopilotBundleInput { | ||
| //! generated_at_utc: "2026-07-31T09:05:00Z".to_string(), | ||
| //! capture: AutopilotCaptureMetadata { | ||
| //! timezone: Some("UTC".to_string()), | ||
| //! ..AutopilotCaptureMetadata::default() | ||
| //! }, | ||
| //! sources: vec![AutopilotSourceInput { | ||
| //! artifact_id: "autopilot-channel".to_string(), | ||
| //! family: "autopilotEvents".to_string(), | ||
| //! capture_state: AutopilotCaptureState::Captured, | ||
| //! original_basename: Some("autopilot-events.json".to_string()), | ||
| //! sanitized_source_path: None, | ||
| //! content: Some(events.to_string()), | ||
| //! ..AutopilotSourceInput::default() | ||
| //! }], | ||
| //! events: Vec::new(), | ||
| //! }); | ||
| //! | ||
| //! assert_eq!(snapshot.outcome, AutopilotOutcome::NoProfileCandidate); | ||
| //! assert!(snapshot.findings_are_evidence_backed()); | ||
| //! ``` | ||
|
|
||
| pub mod models; | ||
| pub mod normalize; | ||
| pub mod redaction; | ||
| pub mod reducer; | ||
| pub mod rules; | ||
| pub mod sources; | ||
|
|
||
| pub use models::*; | ||
| pub use normalize::{ | ||
| classify_event, error_code_from_token, extract_error_code, extract_oobe_setting, | ||
| extract_policy_pair, extract_profile_state, is_autopilot_channel, | ||
| }; | ||
| pub use redaction::{redact_text, redacted_export_projection}; | ||
| pub use reducer::reduce_autopilot_bundle; | ||
| pub use rules::derive_findings; | ||
| pub use sources::{ | ||
| capture_is_validated, classify_timezone, detect_document, is_validated_schema_version, | ||
| is_validated_windows_build, AutopilotBundleInput, AutopilotCaptureState, | ||
| AutopilotDocumentDetection, AutopilotDocumentKind, AutopilotEspSessionDocument, | ||
| AutopilotEventsDocument, AutopilotReportDocument, AutopilotReportSection, AutopilotSourceInput, | ||
| AUTOPILOT_DOCUMENT_VERSION, AUTOPILOT_EVENT_CHANNEL, AUTOPILOT_EVENT_PROVIDER, | ||
| }; | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: adamgell/cmtraceopen
Length of output: 1816
🏁 Script executed:
Repository: adamgell/cmtraceopen
Length of output: 50379
🏁 Script executed:
Repository: adamgell/cmtraceopen
Length of output: 4095
🏁 Script executed:
Repository: adamgell/cmtraceopen
Length of output: 50377
Add
#[serde(default)]toNormalizedWindowsEvent.event_version.AutopilotEventsDocumentdeserializes events directly into this type, so version 1 documents that omiteventVersion, including this doctest, currently fail.🤖 Prompt for AI Agents