mirror of
https://github.com/netbirdio/netbird.git
synced 2026-08-25 09:01:29 +02:00
The settings PUT replaces every mutable field, but retention was optional in the schema while the other three toggles were required. That was not merely inconsistent: the handler applies the request to a zero-valued Settings and UpdateSettings copies each field onto the stored row unconditionally, so an omitted retention was written as 0 — which the API documents as "keep indefinitely". A client sending only the required fields silently switched the account from bounded to unbounded access-log retention, with no error and no signal. The nil check in FromAPIRequest looked like it guarded against this but never did: the receiver is a fresh struct, not the loaded row, so skipping the assignment preserved nothing. Marking the field required changes the generated client type from *int to int, so a generated client can no longer omit it. Nothing validates OpenAPI required-ness at runtime, so a hand-rolled body without the field still lands as 0 — the same latitude the three booleans already have, left consistent rather than special-cased, and now pinned by a test that says so explicitly. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>