NM-278: skip autoupdate evaluation on join#3922
Conversation
|
Tenki Code Review - Complete Files Reviewed: 4 By Severity:
The PR introduces a Files Reviewed (4 files) |
There was a problem hiding this comment.
Overview
This PR adds a SkipAutoUpdate bool field to PostureCheckDeviceInfo and updates GetPostureCheckViolations so that the AutoUpdate posture check is skipped when either d.IsUser or d.SkipAutoUpdate is true (previously only for users). The intent appears to be suppressing auto-update enforcement during host admission flows.
Design Concern: Hard-coded Bypass
Both admission-time call sites — controllers/enrollmentkeys.go (host self-registration via enrollment key) and controllers/hosts.go (addHostToNetwork) — now hard-code SkipAutoUpdate: true in the PostureCheckDeviceInfo literal. This means auto-update posture checks are unconditionally disabled for every device joining any network, regardless of the AutoUpdate value the host actually reports and regardless of whether a network administrator has deliberately configured an auto-update posture check for that network.
The periodic background runner (RunPostureChecks) still reads h.AutoUpdate correctly via GetPostureCheckDeviceInfoByNode (line 308 of pro/logic/posture_check.go), so the enforcement asymmetry is: checks pass at admission but may fail on periodic re-evaluation. This is confusing UX and a potential policy gap.
What Was Changed
models/structs.go: AddedSkipAutoUpdate booltoPostureCheckDeviceInfo— struct change looks fine.pro/logic/posture_check.goline 136: Updated skip condition fromd.IsUsertod.IsUser || d.SkipAutoUpdate— correct implementation of the new flag.controllers/enrollmentkeys.goline 385 andcontrollers/hosts.goline 698: ReplacedAutoUpdate: <host>.AutoUpdatewithSkipAutoUpdate: true— this is where the problem lies.
Recommendation
If the intent is that auto-update state cannot be reliably known at registration/join time (e.g., the client hasn't synced its config yet), then:
- Document that rationale with a comment at the call sites.
- Consider computing
SkipAutoUpdatebased on actual host state rather than a hard-codedtrue.
If the intent is to never enforce auto-update posture at admission, the change achieves that — but it silently removes a previously enforced security control with no visible indication to operators.
Describe your changes
Provide Issue ticket number if applicable/not in title
Provide testing steps
Checklist before requesting a review