-
Notifications
You must be signed in to change notification settings - Fork 587
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
o/devicestate,asserts: sign confdb-control assertions with the device key #14723
base: master
Are you sure you want to change the base?
o/devicestate,asserts: sign confdb-control assertions with the device key #14723
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #14723 +/- ##
==========================================
+ Coverage 78.20% 78.28% +0.07%
==========================================
Files 1151 1153 +2
Lines 151396 152156 +760
==========================================
+ Hits 118402 119114 +712
- Misses 25662 25686 +24
- Partials 7332 7356 +24
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this can be locked down to only sign confdb-control assertions the way SignDeviceSessionRequest does... but we'd have to wait for #14705 to go in first.
I'd say that's the better approach. 14705 is close to landing anyway so it should be fine
Thanks. I'll refactor this after #14705 lands. |
be04655
to
4ae7fad
Compare
52f3add
to
e097810
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks, some comments
c.Assert(cc.Revision(), Equals, 5) | ||
|
||
// Confirm we can ack it | ||
// AddMany panics on error, that's why we aren't c.Assert'ing anything |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is mentioned in AddMany's doc and we already call it above, so I don't think we need this comment
// AddMany panics on error, that's why we aren't c.Assert'ing anything |
} | ||
|
||
// signKey returns the public key of the device that signed this assertion. | ||
func (cc *ConfdbControl) signKey(db RODatabase) (PublicKey, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this requires a new interface, it's just a different implementation but the customSigner
abstraction still works. We can add an RODatabase parameter to customSigner and have ConfdbControl implement that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've made the changes to customSigner
.
// validation failure | ||
groups := []interface{}{map[string]interface{}{"operator-id": "jane"}} | ||
_, err = s.mgr.SignConfdbControl(groups, 4) | ||
c.Assert( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The failing validation checks should be in individual tests. Maybe they can be in a single table test if doesn't make it too annoying to deal with the prerequisites for each case
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, thank you
The process to update a
confdb-control
assertion (see SD172 & SD186) looks like this:/v2/confdbs
with an action likedelegate
orrevoke
This PR adds a method to
devicestate.DeviceManager
that can be used to signconfdb-control
assertions.Its usage would (roughly) look like:
daemon/api_confdbs
:CC @miguelpires @pedronis