Skip to content
This repository has been archived by the owner on Jan 7, 2024. It is now read-only.

add journalist name to session and reply obj #125

Merged
merged 1 commit into from Sep 3, 2020

Conversation

sssoleileraaa
Copy link
Contributor

Description

In preparation for journalist badges in the conversation view (see freedomofpress/securedrop-client#76), this PR adds journalist_first_name and journalist_last_name to the Reply, and makes a minor refactor so that the currently authenticated user details are:
username, first_name, and last_name

to differentiate from the reply sender details, which are called:
journalist_username, journalist_first_name, and journalist_last_name

@sssoleileraaa
Copy link
Contributor Author

Oops I auto-generated the test data for APIProxy on Debian instead of in Qubes which is why all these json an yml files look incorrect.

@sssoleileraaa sssoleileraaa marked this pull request as draft August 6, 2020 17:17
@eloquence eloquence added this to In Development in SecureDrop Team Board Aug 6, 2020
@sssoleileraaa
Copy link
Contributor Author

@kushaldas: I'm following the readme docs for generating sdk data files and still getting stuck. Here's what I did and where the failures occur:

To test or to generate new test data file for the APIProxy class in
test_apiproxy.py file, you will have to setup
QubesOS system.

I already had Qubes installed so skipped.

There should be one VM (let us call it sd-journalist), where we can run
latest securedrop server code from the development branch using
NUM_SOURCES=5 make -C securedrop dev command. The same VM should also have
securedrop-proxy project installed, either from the source by hand or using
the latest Debian package from the FPF repository.

I downloaded the deb from https://apt.freedom.press/pool/main/s/securedrop-proxy/ and installed it using dpkg -i securedrop-proxy_0.3.0+buster_all.deb on my sd-dev-buster vm.

Below is an example configuration for proxy /etc/sd-proxy.yaml:

host: 127.0.0.1
scheme: http
port: 8081
target_vm: sd-svs
dev: False

I added this .yaml file to sd-dev-buster and copied it exactly except for replacing sd-svs with sd-app.

Then I ran NUM_SOURCES=5 make -C securedrop dev.

Then we can create our second developent VM called sd-svs, in which we can checkout/develop
the securedrop-sdk project. The required configuration file is at /etc/sd-sdk.conf

[proxy]
name=sd-journalist

I added this .conf file to sd-app and copied it exactly except for replacing sd-journalist with sd-dev-buster.

We should also add a corresponding entry in /etc/qubes-rpc/policy/securedrop.Proxy file
in dom0.

sd-svs sd-journalist allow
@anyvm @anyvm deny

I added this .Proxy file to dom0 which already had this entry: sd-app sd-proxy allow so I just added a new entry so that the contents of this file looked like:

sd-app sd-dev-buster allow
sd-app sd-proxy allow
@anyvm @anyvm deny

The above mentioned setup can also be created using securedrop-workstation project.

I don't understand what this means.

Now, delete any related JSON file under data/ directory, or remove all of
them, and then execute make test TEST=tests/test_apiproxy.py. This is
command will generate the new data files, which can be used in CI or any other
system.

I removed all of the data files via rm -r data/* in the securedrop-sdk repo on the sd-app VM.

Then I ran make test TEST=tests/test_apiproxy.py and saw all of the tests/test_apiproxy.py::TestAPIProxy::test_* tests fail.

Note: Remember that file download checks don't read actual file path in the APIProxy tests as it requires QubesOS setup. You can manually uncomment those lines to execute them on QubesOS setup.

I don't know where this was mentioned before in the docs, so I don't recall this and don't understand.

@sssoleileraaa
Copy link
Contributor Author

Now, delete any related JSON file under data/ directory, or remove all of
them, and then execute make test TEST=tests/test_apiproxy.py. This is
command will generate the new data files, which can be used in CI or any other
system.

I removed all of the data files via rm -r data/* in the securedrop-sdk repo on the sd-app VM.

Then I ran make test TEST=tests/test_apiproxy.py and saw all of the tests/test_apiproxy.py::TestAPIProxy::test_* tests fail.

Based on feedback from Kushal, simply deleting the cassettes and rerun the test code is not enough to regenerate cassettes. There is a requirement to also comment out the decorator (here:

@dastollervey_datasaver
) in order to regenerate cassettes. Once I get this working I will definitely update the docs.

@eloquence eloquence mentioned this pull request Aug 20, 2020
4 tasks
@sssoleileraaa
Copy link
Contributor Author

blocked on #128

@sssoleileraaa sssoleileraaa marked this pull request as ready for review September 2, 2020 16:29
@sssoleileraaa
Copy link
Contributor Author

This is ready now. Just going to rebase and sign...

@sssoleileraaa sssoleileraaa moved this from In Development to Ready for Review in SecureDrop Team Board Sep 2, 2020
Copy link
Contributor

@kushaldas kushaldas left a comment

Choose a reason for hiding this comment

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

This is okay, tests are good.

@kushaldas kushaldas merged commit 75ef554 into main Sep 3, 2020
SecureDrop Team Board automation moved this from Ready for Review to Done Sep 3, 2020
@emkll emkll deleted the add-journalist-name-to-reply branch September 3, 2020 21:28
@emkll emkll restored the add-journalist-name-to-reply branch September 8, 2020 14:05
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

2 participants