-
Notifications
You must be signed in to change notification settings - Fork 47
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
More robust config validation logic #379
Conversation
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.
Suggested verifying the GPG key, flagged that the USB device check is almost obsolete. 🙂
If this is something that will eventually be reporting to journalists, we might want to print nicer messages. If it's just for us, asserts are OK.
1fcdf07
to
5267415
Compare
Retains the two previous checks: 1. Does config.json exist? 2. Does sd-journalist.sec exist? Adds several checks verifying the contents of config.json. There's a minimum of user-friendly messages explaining specifically what the problem is. We can add those messages over time, aiming to balance utility for Admins and developers. Assumes that a v2 Onion URL is used. We can update that logic when we add support for v3 Onion URLs.
Since both v2 and v3 are supported, check v3 first, but if validation fails, continue validation by trying matches for v2. If both return invalid, then fail validation.
Suggested by @rmol during review. Calling `gpg <key_file>` will return non-zero if the key isn't valid.
5267415
to
91a36b9
Compare
@rmol Great comments, thanks for taking a look. I've rebased and appended a few changes here, namely to add v3 support, and implement the
Very much dev-focused right now. Deferring a friendlier experience for when we tackle the overall admin provisioning story. At that time, we'll likely crib a fair amount of code from https://github.com/freedomofpress/securedrop/blob/43245829ff93e0a84999526f7ecd0435f89eb52a/admin/securedrop_admin/__init__.py#L60 Ready for re-review! |
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.
Realized one problem with the USB device check, but don't think it's critical as that's going away. Approving as is, happy to make the change if necessary.
Retains the two previous checks:
Adds several checks verifying the contents of config.json.
There's a minimum of user-friendly messages explaining specifically what
the problem is. We can add those messages over time, aiming to balance
utility for Admins and developers.
Assumes that a v2 Onion URL is used. We can update that logic when we
add support for v3 Onion URLs.
Closes #240.
Testing
make validate
passes in dom0 with v3 Onion URL infomake validate
passes in dom0 with v2 Onion URL infomake validate
fails when a known-bad value is inconfig.json
as appending characters to the Onion URL