Skip to content
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

add sender badge to replies #1142

Merged
merged 1 commit into from
Oct 13, 2020
Merged

add sender badge to replies #1142

merged 1 commit into from
Oct 13, 2020

Conversation

sssoleileraaa
Copy link
Contributor

@sssoleileraaa sssoleileraaa commented Aug 25, 2020

Description

Resolves #76

Test Plan

Init setup

  1. run make dev
  2. log into the client as journalist
  3. log into the SI and send a message as a new source
  4. create an additional user account with the username: alice (this will be used at the end to test multiple deleted accounts)

Sending a reply from the JI

  1. log into the JI as dellsberg and reply to the new source
  • confirm that you see de in the badge next to the reply

Changing username

  1. log into the JI as journalist (an admin account) and change dellsberg's username to unknown and wait until next sync
  • confirm that you see the badge initials next to the reply change from de to un

Sending a reply from the JI with a new username

  1. log into the JI as unknown and reply to the source
  • confirm that you see un in the badge next to the new reply

Changing name

  1. while logged in as unknown, change first name to Pizza and last name to Cat and wait until next sync
  • confirm that you see the badge initials next to all existing replies change from un to pc
  • confirm that you see pc in the badge next to the new reply

Multiple journalists responding to the same source

  1. log into the JI as journalist and reply to the source
  • confirm that you see jo in a purple badge next to the reply
  • confirm all replies from Pizza Cat remain pc

Deleting a journalist

Note: #1143 is a known issue

  1. log into the JI as journalist and delete unknown's account
  • confirm that you see a deleted account icon in the badge next to all replies from unknown

Sending a reply from the client: success

  1. log into the client as alice
  • confirm that you see jo in a blue badge now
  1. send a reply to the source
  • confirm that you see al in a purple badge next to the new reply

Sending a reply from the client: failed

  1. close the client
  2. in the securedrop-client root dir, run git clone https://gist.github.com/5ba70d50c12b6a6df6f98ed40ad09645.git
  3. run git apply 5ba70d50c12b6a6df6f98ed40ad09645/failed-reply
  4. log in as alice and send a reply to the source
  • confirm that you see al in a red badge next to the new reply
  • confirm that you see a red status bar

Sending a reply from the client: pending

  1. close the client
  2. in the securedrop-client root dir, run git clone https://gist.github.com/7f19a7d10334359f40dbdbb2354cd13a.git
  3. stash your changes to uploads.py and run git apply 7f19a7d10334359f40dbdbb2354cd13a/pending-reply
  4. log in as alice and send a reply to the source
  • confirm that you see al in a purple badge next to the new reply
  • confirm that you see a purple status bar
  • confirm the background color of the reply widget and the color of the text are faded/ more transparent

Offline mode and switching accounts in the client

  1. stash your changes and now log into the client as journalist
  • confirm that journalist replies have purple badges
  1. logout so that you're in offline mode
  • confirm that all reply badges, including badges for journalist are now blue
  1. click the login button and log in as alice
  • confirm al badges are now purple
  1. close the client and log in in offline mode
  • confirm all badges are blue
  1. click the login button and log in as journalist
  • confirm all badges for journalist are purple

Multiple deleted accounts

Note: #1143 is a known issue

  1. log into the JI as journalist and delete alice's account and wait until next sync
  • confirm that you now see a deleted account icon in badges next to alice's replies that are not failed replies (see next step for what to expect with failed replies that are asscociated with a deleted account)

Failed replies associated with deleted account

Same authenticated journalist with new name across sources

  1. reply to all sources with the same "journalist" account
  2. now change the username from the admin interface in the JI and wait until next sync
  • confirm that you see the new initials in all the relevant reply badges across all the sources
  1. now change the first and/or last name from the admin interface in the JI and wait until next sync
  • confirm that you see the new initials in all the relevant reply badges across all the sources

Failed-to-decrypt errors

  1. start the client, and before logging in, delete the submission key:
  • gpg --homedir ~/.securedrop_client/gpg --delete-secret-keys --yes 65A1B5FF195B56353CC63DFFCC40EF1228271441
  • gpg --homedir ~/.securedrop_client/gpg --delete-keys --yes 65A1B5FF195B56353CC63DFFCC40EF1228271441
  1. log in and send a reply
  • confirm failed-to-send error with urgent coral badge
  1. Send a reply from the JI
  • confirm reply appears with a gray badge
  1. Send a message from the JI
  • confirm message appears with a gray badge
  1. Delete account from the JI
  • confirm failed-to-decrypt reply badge is now gray with the deleted account icon
  1. log out
  • confirm all failed-to-send and failed-to-decrypt status bars, badges, and other styling remain unchanged
  1. restart the client
  • confirm all failed-to-decrypt messages and replies are now decrypted with normal styling

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:

  • I have tested these changes in the appropriate Qubes environment
  • I do not have an appropriate Qubes OS workstation set up (the reviewer will need to test these changes)
  • These changes should not need testing in Qubes

If these changes add or remove files other than client code, the AppArmor profile may need to be updated. Please check as applicable:

  • I have updated the AppArmor profile
  • No update to the AppArmor profile is required for these changes
  • I don't know and would appreciate guidance

If these changes modify the database schema, you should include a database migration. Please check as applicable:

  • I have written a migration and upgraded a test database based on main and confirmed that the migration applies cleanly
  • I have written a migration but have not upgraded a test database based on main and would like the reviewer to do so
  • I need help writing a database migration
  • No database schema changes are needed

@sssoleileraaa
Copy link
Contributor Author

sssoleileraaa commented Sep 24, 2020

Update:

Failed replies associated with deleted account

@sssoleileraaa sssoleileraaa force-pushed the journalist-initials-in-reply branch from 81e2eba to 5f0a336 Compare September 29, 2020 06:43
@sssoleileraaa sssoleileraaa marked this pull request as ready for review September 29, 2020 07:21
@sssoleileraaa sssoleileraaa force-pushed the journalist-initials-in-reply branch from 5f0a336 to de27c31 Compare September 29, 2020 07:38
@sssoleileraaa
Copy link
Contributor Author

this is ready for review, but should wait for #1147 to be merged first

@sssoleileraaa sssoleileraaa force-pushed the journalist-initials-in-reply branch 2 times, most recently from b0f013f to fe703fe Compare September 30, 2020 00:16
@eloquence
Copy link
Member

Functional testing, part 1:

Sending a reply from the JI

  1. log into the JI as dellsberg and reply to the new source
  • confirm that you see de in the badge next to the reply

Changing username

  1. log into the JI as journalist (an admin account) and change dellsberg's username to unknown and wait until next sync
  • confirm that you see the badge initials next to the reply change from de to un

Sending a reply from the JI with a new username

  1. log into the JI as unknown and reply to the source
  • confirm that you see un in the badge next to the new reply

Changing name

  1. while logged in as unknown, change first name to Pizza and last name to Cat and wait until next sync
  • confirm that you see the badge initials next to all existing replies change from un to pc
  • confirm that you see pc in the badge next to the new reply

Multiple journalists responding to the same source

  1. log into the JI as journalist and reply to the source
  • confirm that you see jo in a purple badge next to the reply
  • confirm all replies from Pizza Cat remain pc

Deleting a journalist

Note: #1143 is a known issue

  1. log into the JI as journalist and delete unknown's account
  • confirm that you see a deleted account icon in the badge next to all replies from unknown

Sending a reply from the client: success

  1. log into the client as alice
  • confirm that you see jo in a blue badge now
  1. send a reply to the source
  • confirm that you see al in a purple badge next to the new reply

Sending a reply from the client: failed

  1. close the client
  2. in the securedrop-client root dir, run git clone https://gist.github.com/5ba70d50c12b6a6df6f98ed40ad09645.git
  3. run git apply 5ba70d50c12b6a6df6f98ed40ad09645/failed-reply
  4. log in as alice and send a reply to the source
  • confirm that you see al in a red badge next to the new reply
  • confirm that you see a red status bar

@eloquence
Copy link
Member

Part 2:

Sending a reply from the client: pending

  1. close the client
  2. in the securedrop-client root dir, run git clone https://gist.github.com/7f19a7d10334359f40dbdbb2354cd13a.git
  3. stash your changes to uploads.py and run git apply 7f19a7d10334359f40dbdbb2354cd13a/pending-reply
  4. log in as alice and send a reply to the source
  • confirm that you see al in a purple badge next to the new reply
  • confirm that you see a purple status bar
  • confirm the background color of the reply widget and the color of the text are faded/ more transparent

Switching journalist accounts in the client

  1. stash your changes and now log into the client as journalist
  • confirm that journalist replies have purple badges

Multiple deleted accounts

Note: #1143 is a known issue

  1. log into the JI as journalist and delete alice's account and wait until next sync
  • confirm that you now see a deleted account icon in badges next to alice's replies that are not failed replies (see next step for what to expect with failed replies that are asscociated with a deleted account)

Failed replies associated with deleted account

Same authenticated journalist with new name across sources

  1. reply to all sources with the same "journalist" account
  2. now change the username from the admin interface in the JI and wait until next sync
  • confirm that you see the new initials in all the relevant reply badges across all the sources
  1. now change the first and/or last name from the admin interface in the JI and wait until next sync
  • confirm that you see the new initials in all the relevant reply badges across all the sources

@eloquence
Copy link
Member

eloquence commented Sep 30, 2020

Functional testing per test plan looks great! Will do a bit more exploratory testing tomorrow. >:)

tests/test_logic.py Outdated Show resolved Hide resolved
tests/test_logic.py Outdated Show resolved Hide resolved
tests/test_logic.py Outdated Show resolved Hide resolved
tests/test_logic.py Outdated Show resolved Hide resolved
@eloquence
Copy link
Member

Did a bit more exploratory testing and wasn't able to break things (e.g. deleting individual replies via JI, using pseudo-delete functionality in Source UI, renaming user right after logging in and before sending first reply). :)

@sssoleileraaa sssoleileraaa force-pushed the journalist-initials-in-reply branch from fe703fe to 9eaec46 Compare September 30, 2020 19:33
@sssoleileraaa
Copy link
Contributor Author

I added one more test section to the test plan around offline mode and switching accounts, so please make sure to focus here upon second review:

## Offline mode and switching accounts in the client
1. stash your changes and now log into the client as journalist
- [ ] confirm that journalist replies have purple badges
2. logout so that you're in offline mode
- [ ] confirm that all reply badges, including badges for journalist are now blue
3. click the login button and log in as alice
- [ ] confirm `al` badges are now purple
4. close the client and log in in offline mode
- [ ] confirm all badges are blue
5. click the login button and log in as journalist
- [ ] confirm all badges for journalist are purple

@sssoleileraaa sssoleileraaa force-pushed the journalist-initials-in-reply branch from 9eaec46 to 60af203 Compare September 30, 2020 20:45
@sssoleileraaa
Copy link
Contributor Author

just learned there is one more state around reply badges that we need to test: the failed-to-decrypt state. will update the test plan and push one more change so this is ready for the night crew :)

@sssoleileraaa sssoleileraaa force-pushed the journalist-initials-in-reply branch from 60af203 to 9768bc7 Compare October 6, 2020 07:13
@sssoleileraaa
Copy link
Contributor Author

sssoleileraaa commented Oct 6, 2020

This is ready for review again! I add a new test section to the test plan to account for changes made to handle decryption errors:

Failed-to-decrypt errors

  1. start the client, and before logging in, delete the submission key:
  • gpg --homedir ~/.securedrop_client/gpg --delete-secret-keys --yes 65A1B5FF195B56353CC63DFFCC40EF1228271441
  • gpg --homedir ~/.securedrop_client/gpg --delete-keys --yes 65A1B5FF195B56353CC63DFFCC40EF1228271441
  1. log in and send a reply
  • confirm failed-to-send error with urgent coral badge
  1. Send a reply from the JI
  • confirm reply appears with a gray badge
  1. Send a message from the JI
  • confirm message appears with a gray badge
  1. Delete account from the JI
  • confirm failed-to-decrypt reply badge is now gray with the deleted account icon
  1. log out
  • confirm all failed-to-send and failed-to-decrypt status bars, badges, and other styling remain unchanged
  1. restart the client
  • confirm all failed-to-decrypt messages and replies are now decrypted with normal styling

@sssoleileraaa sssoleileraaa force-pushed the journalist-initials-in-reply branch from 188fa92 to 882024d Compare October 8, 2020 01:25
@sssoleileraaa
Copy link
Contributor Author

updated to include new artwork added from the issue this resolves (still ready for review)

Copy link
Contributor

@emkll emkll left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(@emkyll oh friday mistakes... i accidentally edited your comment and now i'm unable to get your comment back with all of the formatting, so we can just look at the github comment history here to see what you said orignally :bushes:)

@sssoleileraaa
Copy link
Contributor Author

sssoleileraaa commented Oct 9, 2020

@emkyll - you'll see above that i accidentally edited your comment and lost all the nice formatting you did so... for efficiency, i captured just the part of the test plan that needs focus (the rest passed without issue):

Failed-to-decrypt errors

  1. start the client, and before logging in, delete the submission key:
  • gpg --homedir ~/.securedrop_client/gpg --delete-secret-keys --yes 65A1B5FF195B56353CC63DFFCC40EF1228271441
  • gpg --homedir ~/.securedrop_client/gpg --delete-keys --yes 65A1B5FF195B56353CC63DFFCC40EF1228271441
  1. log in and send a reply
  • confirm failed-to-send error with urgent coral badge
  1. Send a reply from the JI
  • ❗ confirm reply appears with a gray badge: (though this is to be expected, I think?)
  1. Send a message from the JI
  • ❗ confirm message appears with a gray badge: For the current user it appears as purple (though this is to be expected, I think?)

Just to double check, you're saying that in step 3 and 4 the new reply from a journalist and message from a source did not show up in gray with the "cannot decrypt message", even though you deleted the submission key locally? If so I am unable to reproduce. In case it helps try this:

  1. start the client, and before logging in, delete the submission key via those gpg commands above (remember that when you run ./run.sh the test submission key will be recreated so we're trying to avoid running the client after deleting the key)
  2. in the JI, send a reply as "journalist"
  3. wait in the client with the source you sent a reply to selected
  4. when the reply shows up you'll need to scroll to the bottom to see the new reply due to a bug currently on main where the scrollbar doesn't automatically scroll you to the bottom to see the new content
  • confirm that the reply says in italics "cannot decrypt reply" and the reply bar and badge should be gray

For test #3 above, you need to do the same thing but with a source message instead of a journalist reply.

Copy link
Contributor

@emkll emkll left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @creviera confirmed the thorough test plan is now passing in an sd-app VM in Qubes, including the failed to decrypt scenario. (see below). Thanks for your hard work on this, changes look great.

There are a couple of todo's still outstanding (one which is dependent on freedomofpress/securedrop-sdk#134) . Would you like to address these as part of this PR or open follow-up issues? IMO this PR if good to merge as-is, and the todo's are small incremental improvements that can be merged separately.

Sending a reply from the JI

  1. log into the JI as dellsberg and reply to the new source
  • confirm that you see de in the badge next to the reply

Changing username

  1. log into the JI as journalist (an admin account) and change dellsberg's username to unknown and wait until next sync
  • confirm that you see the badge initials next to the reply change from de to un

Sending a reply from the JI with a new username

  1. log into the JI as unknown and reply to the source
  • confirm that you see un in the badge next to the new reply

Changing name

  1. while logged in as unknown, change first name to Pizza and last name to Cat and wait until next sync
  • confirm that you see the badge initials next to all existing replies change from un to pc
  • confirm that you see pc in the badge next to the new reply

Multiple journalists responding to the same source

  1. log into the JI as journalist and reply to the source
  • confirm that you see jo in a purple badge next to the reply
  • confirm all replies from Pizza Cat remain pc

Deleting a journalist

Note: #1143 is a known issue

  1. log into the JI as journalist and delete unknown's account
  • confirm that you see a deleted account icon in the badge next to all replies from unknown

Sending a reply from the client: success

  1. log into the client as alice
  • confirm that you see jo in a blue badge now
  1. send a reply to the source
  • confirm that you see al in a purple badge next to the new reply

Sending a reply from the client: failed

  1. close the client
  2. in the securedrop-client root dir, run git clone https://gist.github.com/5ba70d50c12b6a6df6f98ed40ad09645.git
  3. run git apply 5ba70d50c12b6a6df6f98ed40ad09645/failed-reply
  4. log in as alice and send a reply to the source
  • confirm that you see al in a red badge next to the new reply
  • confirm that you see a red status bar

Sending a reply from the client: pending

  1. close the client
  2. in the securedrop-client root dir, run git clone https://gist.github.com/7f19a7d10334359f40dbdbb2354cd13a.git
  3. stash your changes to uploads.py and run git apply 7f19a7d10334359f40dbdbb2354cd13a/pending-reply
  4. log in as alice and send a reply to the source
  • confirm that you see al in a purple badge next to the new reply
  • confirm that you see a purple status bar
  • confirm the background color of the reply widget and the color of the text are faded/ more transparent

Offline mode and switching accounts in the client

  1. stash your changes and now log into the client as journalist
  • confirm that journalist replies have purple badges
  1. logout so that you're in offline mode
  • confirm that all reply badges, including badges for journalist are now blue
  1. click the login button and log in as alice
  • confirm al badges are now purple
  1. close the client and log in in offline mode
  • confirm all badges are blue
  1. click the login button and log in as journalist
  • confirm all badges for journalist are purple

Multiple deleted accounts

Note: #1143 is a known issue

  1. log into the JI as journalist and delete alice's account and wait until next sync
  • confirm that you now see a deleted account icon in badges next to alice's replies that are not failed replies (see next step for what to expect with failed replies that are asscociated with a deleted account)

Failed replies associated with deleted account

Same authenticated journalist with new name across sources

  1. reply to all sources with the same "journalist" account
  2. now change the username from the admin interface in the JI and wait until next sync
  • confirm that you see the new initials in all the relevant reply badges across all the sources
  1. now change the first and/or last name from the admin interface in the JI and wait until next sync
  • confirm that you see the new initials in all the relevant reply badges across all the sources

Failed-to-decrypt errors

  1. start the client, and before logging in, delete the submission key:
  • gpg --homedir ~/.securedrop_client/gpg --delete-secret-keys --yes 65A1B5FF195B56353CC63DFFCC40EF1228271441
  • gpg --homedir ~/.securedrop_client/gpg --delete-keys --yes 65A1B5FF195B56353CC63DFFCC40EF1228271441
  1. log in and send a reply
  • confirm failed-to-send error with urgent coral badge
  1. Send a reply from the JI
  • confirm reply appears with a gray badge
  1. Send a message from the JI
  • confirm message appears with a gray badge
  1. Delete account from the JI
  • confirm failed-to-decrypt reply badge is now gray with the deleted account icon
  1. log out
  • confirm all failed-to-send and failed-to-decrypt status bars, badges, and other styling remain unchanged
  1. restart the client
  • confirm all failed-to-decrypt messages and replies are now decrypted with normal styling

self.set_normal_styles()
self.error.hide()
if self.uuid == uuid:
self.status = "SUCCEEDED" # TODO: Add and use success status in db.ReplySendStatusCodes
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason we aren't adding db.ReplySendStatusCodes as part of this PR

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, db.ReplySendStatusCodes only includes 'FAILED' and 'PENDING' statuses. I see other areas of the code that have to hardcode an implied 'SUCCEEDED' status, so I followed suit and made note of how we can improve this: we can add a success status to db.ReplySendStatusCodes and start tracking successful replies with a non-null status. This will require several unrelated updates so I left it out of this PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"""
Add a reply from a journalist to the source.
"""
try:
send_status = reply.send_status.name
except AttributeError:
send_status = "SUCCEEDED"
send_status = "SUCCEEDED" # TODO: Add and use success status in db.ReplySendStatusCodes
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

@@ -1658,11 +1747,12 @@ def __init__(
update_signal,
download_error_signal,
index: int,
error: bool = False,
failed_to_decrypt: bool = False,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious as to why this was renamed, unless there's no other error that could occur with replies (other than failure to decrypt)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there was a bug during implementation: error is also the name of the error message widget so when we checked to see if error was null, it always said, nope!

also there are a couple types of errors: decryption/download and failure to send.

@emkll
Copy link
Contributor

emkll commented Oct 13, 2020

Follow up is being tracked in #1156, and we will improve the journalist updating logic once the sdk is released with the changes in freedomofpress/securedrop-sdk#134.

@emkll emkll merged commit 9bfbff3 into main Oct 13, 2020
@emkll emkll deleted the journalist-initials-in-reply branch October 13, 2020 16:42
@sssoleileraaa sssoleileraaa changed the title add sender badge in replies add sender badge to replies Oct 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Show which journalist sent a given reply
3 participants