Repository navigation
Toolkit: native XDR workbook imports and required Marketplace attribution - #7
Conversation
Keep exact native source and per-query dependency review without a Sentinel parent or fabricated conversion proof. Preserve migrated-workbook gates and shared managed install/registration packaging. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Bind the complete Notebook payload to native review metadata, retain source identity as historical evidence, and allow native-only V3.1 packaging after raw source removal. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Honor the existing required-attribution signal despite offline skip controls, fail before package output on lookup errors, and preserve optional offline behavior. Use Windows atomic replacement while holding the metadata snapshot lock. Add mocked regression coverage and clarify packaging documentation. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
oferInbar
left a comment
There was a problem hiding this comment.
Overall the native XDR workbook import flow (native-workbook-plan / review / import / validate, canonicalPayloadSha256 verification after transient Workbook Sources/Native cleanup) and the fail-closed Marketplace attribution (trackingId / pid-<trackingId>-partnercenter) enforcement look great.
Requested Revision — Standard ASIM Functions (_ prefix)
In Tools/SentinelToXDRMigration/sentinel_xdr_migration/native_workbooks.py (around lines 84–87):
bad = sorted({*analysis["asimFunctions"], *analysis["externalDataSources"]} | (
set(analysis["unknownFunctions"]) if analysis["unknownFunctions"] else set()
))
if bad:
blockers.append(f"Unreviewable native functions/sources: {', '.join(bad)}")We have verified in live testing that standard built-in Log Analytics ASIM functions starting with "_" (such as _ASim_* and _Im_*) work well in Defender XDR Advanced Hunting, Custom Detections, and Defender Workbooks.
Please revise native_workbooks.py so that standard "_"-prefixed Log Analytics / ASIM functions (_ASim_*, _Im_*, etc.) are allowed rather than rejected as unreviewable native functions (matching workbooks.py / converter.py handling of built-in "_" ASIM functions). Everything else in this PR is good to go!
Reuse the shared workbook classifier while preserving opaque dependencies and fail-closed source/review validation. Cover native ASIM import, validation and synthetic V3.1 packaging. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Pushed ASIM changes |
|
@kingwil - This is Aketh and I am a current Microsoft employee from 1P activity ingestion team. Can you kindly share your MSFT alias, if you are a MSFT employee or reach out to me (my alias - aketht)? |
Summary
Correct native XDR workbook validation so the authored
XDR WorkbooksNotebook is the sole required deployable artifact. The raw Notebook is an authoring input for plan/review/import; it may be removed after import and is never copied into or required by the package. This PR does not ship a duplicate Workbook Source.The native artifact retains the truthful original source path and exact-byte SHA256 as historical import evidence and keeps the existing source-path-based UUIDv5 identities. Validation does not read that path. Instead, plan,
nativeReview, and provenance require the samecanonicalPayloadSha256: SHA256 over canonical UTF-8 JSON (sorted keys, compact separators, non-ASCII preserved) of the complete Notebook excluding only top-levelxdrMetadataandcontentProvenance. This catches changes to notices, tabs, layout, or any other payload content. Validation independently recomputes current query hashes, strict lineage, and workload dependencies; stale or incomplete reviews and hash mismatches still fail closed.Changes
import-manifest.json.PassThruSourcereturn the already-validated stripped native Notebook, not load the historical source file.The existing already-approved O365 Notebook can be updated by adding only the computed canonical hash to its native review/provenance metadata. Preserve its IDs, query text, tabs/notices, historical source identity, and all 237 approved query-review entries; no rereview is required when the canonical payload is unchanged. No content worktree or real O365 package build was changed/run for this toolkit correction.
Verification
import-manifest.jsonSHA256 matches the imported schema.No runtime qualification or deployment is claimed.
Required Marketplace attribution guard
This PR also fixes the V3.1 packaging path that could honor offline skip controls and successfully emit nested XDR packages without their customer usage attribution marker. The existing anonymous published Marketplace catalog/template resolver is reused unchanged; no new lookup implementation, plan-selection configuration, incomplete-package override, or content-package rebuild is introduced.
WarnIfMissingsignal now enforces required attribution. Missing/null/blanktrackingIdtriggers automatic lookup even with-SkipAttributionLookup,SENTINEL_SKIP_ATTRIBUTION_LOOKUP=1, or both. Successful discovery saves the exact validated ID in authoritativeSolutionMetadata.jsonand emits the unconditional root marker into JSON/ZIP.File.Replacewhile retaining the writer-excluding snapshot handle; overwrite-move fails with that handle on Windows. Non-Windows persistence, byte preservation, concurrent-edit rejection and failure cleanup remain unchanged.Additional verification
Python 3.12 venv and PowerShell 7, synthetic isolated solutions only:
python -m unittest test_customer_usage_attribution test_defender_workbooks_packaging: 52 passed. Mocked catalog/template HTTP covers automatic metadata+marker population despite each bypass route, explicit-ID offline replay, local and positional pipeline entry points, terminating failures/ambiguity before artifact output, unchanged metadata on failure, optional offline behavior, byte-preserving persistence and write/conflict failures. Workbook-only required-attribution failure is also covered.python -m pytest Tools\SentinelToXDRMigration\tests\test_native_workbooks.py -q: 58 passed, including native-only and mixed native/migrated packaging and tampering/source-removal checks.test_packaging.PackagingTestsselection: 32 passed.git diff --check: passed.The initial unfiltered attribution/packaging run encountered two unrelated existing test limitations, not waived production guards:
test_runs_v3_1_and_returns_workflow_evidencetreats theE5substring in the checkout pathC:\E5Workbooksas a forbidden command argument;test_cli_runs_real_packager_for_same_and_cross_worktree_rootscompletes its synthetic checks but its cleanup hits a Windows open logging-file handle (WinError 32). These tests were not edited; the remaining 32 packaging cases pass. No full content suite, content-worktree edits, real solution package rebuild, production network mutation, runtime qualification or deployment was performed for this fix.Revision: standard built-in ASIM in native workbooks
Commit
db86d16ddbcaddresses the requested standard built-in underscore ASIM support, aligned with the existing workbook classifier and detection-converter behavior._Im_*/_ASim_*parsers, including bare_Im_Authentication, bare and called_ASim_forms, and mixed parser/native-table queries. Query text is preserved.Revision verification
Existing Python 3.12 venv and PowerShell 7, targeted tests and synthetic isolated solutions only:
git diff --check: passed.No content worktrees were modified, no real solutions were rebuilt, and no full validation, runtime qualification or deployment was performed. User-reported live ASIM observations motivate compatibility; these offline toolkit regressions do not establish target-tenant runtime availability or dependency coverage.