The SecureDrop Client is designed to connect over an Onion service. Tor can be slow: several-second latency is not uncommon. When working on the Client UI, it's easy to overlook how rendering will happen on a production install, if you're connecting to services on your location workstation (e.g. via make dev
in the SecureDrop repo).
Enter toxiproxy. That tool will allow you to inject latency between the client and the server sockets on your workstation.
git clone https://github.com/shopify/toxiproxy
cd toxiproxy
make build # requires golang, otherwise fetch the artifacts from release page
cd dist
./toxiproxy-server # this blocks, so you'll need a separate terminal to continue
./toxiproxy-cli create --listen localhost:8088 --upstream localhost:8081 sd
./toxiproxy-cli toxic add -t latency -a latency=5000 sd
Then you'll need to edit the client code to use the proxy:
diff --git a/securedrop_client/app.py b/securedrop_client/app.py
index 6b95eda..22dd482 100644
--- a/securedrop_client/app.py
+++ b/securedrop_client/app.py
@@ -218,7 +218,7 @@ def start_app(args, qt_args) -> NoReturn: # type: ignore [no-untyped-def]
gui = Window()
controller = Controller(
- "http://localhost:8081/",
+ "http://localhost:8088/",
gui,
session_maker,
args.sdc_home,
That's all! Run make dev
in the SD repo, and ./run.sh
in the client repo, and you're all set.
tremendously useful. thanks conor.