fix: accept stock wireless/network shapes + carry write-only secrets through JSON Patch#10
Merged
raspbeguy merged 1 commit intoJun 21, 2026
Conversation
…through JSON Patch
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.
Summary
Closes out the remaining findings from the stricter-than-platform audit (the rest landed in #9). Four fixes:
reject_422 (validation stricter than the platform)
country: stock x86 shipscountry=''(unset) and 6 GHz ships'00'(world domain). The schema pattern^[A-Za-z]{2}$rejected both.fromUcinow coerces''→ null, and the pattern is^([A-Za-z]{2}|00)$.encryption='owe': stock 6 GHz interfaces use OWE (Opportunistic Wireless Encryption, RFC 8110, keyless). It was missing fromVALID_ENCRYPTIONand would also have been forced to carry a key. Addedowe, and aNO_KEY_ENCRYPTIONset (none/wep/owe) so the key-required check skips it.type:config_generateemits anonymousconfig deviceoptions-override sections (name + macaddr, no type) on some targets.validaterequiredtype. Now optional (enum-checked only when present);openapi_requireddropstype.JSON Patch write-only secret carry-forward
has_key, notkey), so a patch leaving the secret alone produced a post-image without it and tripped conditional-required validation ("key is required when encryption is …"). The write path now carries forward anywriteOnlyfield the patch didn't set (key,preshared_key,private_key,tls_auth,pkcs12) — mirroring what the merge-patch path'smerge_for_patchalready did. A patch that explicitly sets a new secret is left intact (post[k] == nullguard).Tests
network_wireless_test.uc): type-less device accepted; empty country → null;'00'accepted;oweaccepted without a key.handler_test.uc): JSON Patch not touching the masked key preserves it (no spurious 422); JSON Patch setting a new key is not clobbered.Verification
make lint+make test(756 pass, +6) +make coverage(80.8% direct, 100% module) +make openapi-check(regenerated) all green.existingcarries cleartext at both call sites, clobber guard holds, merge-patch path untouched, regex accepts only00numeric, type-less sections don't NPE or wrongly demand vid).Notes
wireless.*andnetwork.devicestype-less are excluded from the integration round-trip test (wireless needs hwsim; the CI VM's device section has a type), so these are verified by unit tests.owe-transition(mixed open/OWE) intentionally out of scope; this matches only the stock 6 GHzowedefault.