asserts: disallow duplicate devices in request messages - #17401
Conversation
There was a problem hiding this comment.
Pull request overview
This PR tightens validation in the asserts request-message parsing layer by rejecting repeated device identifiers in the devices header, ensuring request targeting is explicit and unambiguous within snapd’s assertion processing.
Changes:
- Detect and reject duplicate entries in the
devicesheader when decoding request-message assertions. - Add a unit test to confirm duplicate devices now produce a deterministic decode error.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| asserts/messages.go | Adds duplicate detection to parseDevices while decoding request-message headers. |
| asserts/messages_test.go | Extends invalid decode coverage to assert duplicates in devices are rejected with the expected error. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #17401 +/- ##
=======================================
Coverage 78.81% 78.81%
=======================================
Files 1410 1406 -4
Lines 196929 196862 -67
Branches 2498 2498
=======================================
- Hits 155208 155165 -43
+ Misses 32367 32347 -20
+ Partials 9354 9350 -4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Wed Jul 29 07:21:55 UTC 2026 Failures:Preparing:
Executing:
Restoring:
Skipped tests from snapd-testing-skipIf you wish to have any of the below tests run in your PR, in your PR description, add 'unskip:' followed by a copy-and-pasted list of the below tests you wish to run (unskip plus test list must be valid yaml)
|
When parsing the
devicesheader of a request message, snapd previously accepted repeated values without complaint. This PR fixes that.checkClusterDevicesinasserts/cluster.goalso fails on error, instead of silently deduplicating.