fleet/server/mdm
Jordan Montgomery f1662e1da6
Mark dep assignments as failed on certain server errors (#31523)
Putting this up for comments

On certain errors(like a network error, perhaps even Apple ratelimiting)
we previously would drop assignments during the DEP sync and leave the
host_dep_assignments row null and the assignment unset on the Apple
side. Because of how the sync works it is entirely possible when this
happens that we would happily go along, update the cursor and never
return to resync these devices unless and until the admin did something
that forced a resync like changing something about the cloud config
profile.

Now any devices that for any reason don't get returned by the response
get marked as failed so that our logic for retrying and processing
cooldowns picks them up for later retry.

Explanation here as far as what I think is going wrong:
https://github.com/fleetdm/fleet/issues/31385#issuecomment-3145117080

# Checklist for submitter

If some of the following don't apply, delete the relevant line.

- [ ] Changes file added for user-visible changes in `changes/`,
`orbit/changes/` or `ee/fleetd-chrome/changes`.
See [Changes
files](https://github.com/fleetdm/fleet/blob/main/docs/Contributing/guides/committing-changes.md#changes-files)
for more information.

- [ ] Input data is properly validated, `SELECT *` is avoided, SQL
injection is prevented (using placeholders for values in statements)
- [ ] If paths of existing endpoints are modified without backwards
compatibility, checked the frontend/CLI for any necessary changes

## Testing

- [x] Added/updated automated tests
- [x] Where appropriate, [automated tests simulate multiple hosts and
test for host
isolation](https://github.com/fleetdm/fleet/blob/main/docs/Contributing/reference/patterns-backend.md#unit-testing)
(updates to one hosts's records do not affect another)

- [x] QA'd all new/changed functionality manually
2025-08-06 13:15:43 -04:00
..
android Updated SQL modes in tests to match production. (#31445) 2025-08-03 08:18:13 +02:00
apple Mark dep assignments as failed on certain server errors (#31523) 2025-08-06 13:15:43 -04:00
assets Updated SQL modes in tests to match production. (#31445) 2025-08-03 08:18:13 +02:00
crypto Update nanomdm dependency with latest bug fixes and improvements. (#23906) 2024-11-20 11:47:11 -06:00
cryptoutil Refactoring crypto code for future reuse. (#25148) 2025-01-07 16:14:12 -06:00
internal/commonmdm friday tidy up party (#18106) 2024-04-08 08:42:42 -03:00
lifecycle BMAA: Add personal enrollment type including aggregate counts (#31091) 2025-07-22 17:24:19 -04:00
linux Linux Encryption Docs (#23622) 2024-12-10 08:26:46 -07:00
maintainedapps Generate SHA from file if FMA sha is no_check (#30558) 2025-07-07 11:05:19 -05:00
microsoft fix windows configuration profile failing to verify if using CDATA escape (#31564) 2025-08-04 17:04:59 +02:00
nanodep Implement service discovery for Apple MDM account-driven enrollment (#31027) 2025-07-18 15:45:05 -05:00
nanomdm Fix flaky test async last seen by using channel sync instead of time sleep (#31128) 2025-07-22 18:19:44 +02:00
scep fleetd generate TPM key and issue SCEP certificate (#30932) 2025-07-18 11:31:52 -03:00
testing_utils Add datastore methods for host certificates feature (#26416) 2025-02-18 17:49:02 -06:00
mdm.go fix: Detect file starting with comment in mdm.go as well (#27673) 2025-03-31 19:16:13 -05:00
mdm_test.go fix: Detect file starting with comment in mdm.go as well (#27673) 2025-03-31 19:16:13 -05:00