v2026.09.24.001: device_id survives the engine; report sent as UTF-8 - #1
Open
cdburgess75 wants to merge 2 commits into
Open
cdburgess75 wants to merge 2 commits into
cdburgess75 wants to merge 2 commits into
Conversation
…report sent as UTF-8 Two field failures at one client site, both silent on the endpoint. Devices "ignored". v2026.09.08.001 dropped the Defender catch that set $defSigs = 'Unknown'. Where every probe fails (Get-MpComputerStatus throws under SYSTEM, and MSFT_MpComputerStatus is missing or has no signature date because a third-party AV owns the box or Defender is removed), reading the unset $defSigs in the MachineInfo literal threw under StrictMode 2. Invoke-SafeBlock logged it and moved on, MachineInfo stayed empty, and device_id went out null. Battlefield fell back to host:<name>, which frozen enrollment does not know for a UUID-enrolled device, so every POST got 200 "ignored" and nothing was stored. This is very likely the 2026-09-09 reporting drop that v2026.09.15.001 could not explain. $defSigs, and $wuStr (unset on an empty Windows Update history), now start as 'Unknown'. Device identity (UUID -> MachineGuid -> host:<name>, same values) moved out of the engine into its own block that runs first and regardless of AssessmentEngine_Enabled. $Script:DeviceId starts at the host:<name> fallback, is never null, and feeds both MachineInfo and the payload. An engine failure now costs machine details, never the check-in. HTTP 400 "body is not valid JSON". Windows PowerShell 5.1 encodes a string -Body as ISO-8859-1 when -ContentType has no charset, so one character in U+0080..U+00FF (e.g. in an Event 7045 service name) became an invalid UTF-8 byte and the whole report was rejected until the event left the 7-day window. The report is now POSTed as UTF-8 bytes with 'application/json; charset=utf-8'. tests/Test-DeviceIdentity.ps1 runs the Phase 2 code verbatim under StrictMode 2 with mocked cmdlets. It fails on origin/main (engine aborts on $defSigs and $wuStr, device_id null) and passes here. It is a mock test, not a Windows run. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review follow-ups on v2026.09.24.001: - Inside the engine, the identity code only ran once Win32_OperatingSystem had answered, so with WMI down the report went out as host:<name>. The new standalone block would have fallen through to MachineGuid instead, re-enrolling a UUID-known machine under a new id that neither adoption nor Battlefield's hostname fallback can match. MachineGuid is now used only when WMI answers, as before; a wmi-down scenario covers it. - Changelogs say plainly that passive network inventory stays disabled, and CHANGELOG.md points at the in-file history for .09.08.x-.09.15.001. - The test restores $env:COMPUTERNAME, which is process-wide in CI. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
This was referenced Sep 25, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Two silent field failures
1. Devices "ignored" since 2026-09-08.
catch { $defSigs = 'Unknown' }. On a box where every Defender probe fails,$defSigsis never assigned. Typical cases:Get-MpComputerStatusthrows under SYSTEM, andMSFT_MpComputerStatusis missing or has no signature date;$defSigsin theMachineInfoliteral then throws under StrictMode 2. The whole Assessment Engine is skipped anddevice_idgoes out null.host:<name>, which a UUID-enrolled device doesn't match. Enrollment is frozen, so the server answers200 ignored.2.
400 body is not valid JSONsince 2026-09-17 (RLG Windows 11).-Bodyas ISO-8859-1 when no charset is given. Any U+0080..U+00FF character becomes an invalid UTF-8 byte.", which breaks the JSON outright.Changes
Invoke-SafeBlock. It runs ahead of the engine and regardless ofAssessmentEngine_Enabled.host:<name>.$Script:DeviceIdstarts athost:<name>, so it can never be null.$defSigsand$wuStrstart as'Unknown'(an empty Windows Update history also used to abort it).application/json; charset=utf-8.tests/Test-DeviceIdentity.ps1runs the engine code verbatim under StrictMode 2 with mocks across 11 scenarios. It fails 20 assertions against origin/main and passes on this branch; CI runs it. The AST parse shows 0 errors, and no non-ASCII bytes were added.Review: three independent reviewers, covering PS 5.1/StrictMode, fleet safety and diff correctness. Their follow-ups are in 3aa3256. Known engine hazards that were already there are left for a follow-up:
quser, a null LastBootUpTime, and WMI-ErrorAction Stop. None of them can nulldevice_idany more. The child-scope bug is also left: antivirus, edr and defender always report defaults.Before merging: one real run on an affected machine
Run this on RLG-JANE-PC or RLG-DCFS, in an elevated Windows PowerShell 5.1:
When it finishes, check the newest
C:\ProgramData\ShellKnight\Logs\ShellKnight_*.log:Device identity skippedand noAssessment Engine skippedline;Battlefield push OK - run_id: <n>.In Battlefield, the device should show a v2026.09.24.001 run under its existing UUID. Then remove the test task with
schtasks /delete /tn SK-Test /f.🤖 Generated with Claude Code