-
Notifications
You must be signed in to change notification settings - Fork 42
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
Fix print preflight status check #2102
Conversation
dc45843
to
2a24939
Compare
Tested on Qubes 4.2.2-rc2 + tip of this branch and these changes allow successful printing |
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.
Looks good, @rocodes! Nice that the "no surprising return values" and the "no untrusted input" goals converge here. I'll approve and merge based on visual review since (a) you've tested this (and I'm not set up to do so) and (b) this will be retested via freedomofpress/securedrop-workstation#1103.
Noting for future work: could this pattern be factored out into some sort of stderr_to_enum(stderr, Enum)
helper so that it's easy to do the right thing for both goals?
if output_untrusted: | ||
logger.debug(f"Result is {output_untrusted}") | ||
|
||
# The final line of stderr is the status. |
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.
It would be good to document what could come before this and why we're discarding it.
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.
Yeah that's fair. It's like
securedrop-client/client/securedrop_client/export.py
Lines 211 to 212 in 937483a
# This is a bit messy, but make sure we are just taking the last line | |
# (no-op if no newline, since we already stripped whitespace above) |
[0.11.0] Backport printer preflight status fix (#2102)
@cfm not sure if this is similar to what you're talking about but on Dangerzone we are using exceptions instead of Enums. Each exception is mapped to a certain qrexec server process exit code. Then the have one method which reconstructs the exceptions on the client (trusted part), based on the exit codes. This way we basically eliminate any client-side parsing. |
Status
Ready for review
Description
Fixes #2101
Test Plan
Checklist
If these changes modify code paths involving cryptography, the opening of files in VMs or network (via the RPC service) traffic, Qubes testing in the staging environment is required. For fine tuning of the graphical user interface, testing in any environment in Qubes is required. Please check as applicable:
If these changes add or remove files other than client code, the AppArmor profile may need to be updated. Please check as applicable:
If these changes modify the database schema, you should include a database migration. Please check as applicable:
main
and confirmed that the migration is self-contained and applies cleanlymain
and would like the reviewer to do so