Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Add a script that sets up a trusted MITM proxy (#24698)

Mikayla Maki5293f5724c41
diff --git a/script/mitm-proxy.sh b/script/mitm-proxy.sh
new file mode 100755
index 00000000000..9cf4784591c
--- /dev/null
+++ b/script/mitm-proxy.sh
@@ -0,0 +1,18 @@
+#!/usr/bin/env bash
+
+set -e
+
+CONTAINER_ID=$(docker run -d --rm -it -v ~/.mitmproxy:/home/mitmproxy/.mitmproxy -p 9876:8080 mitmproxy/mitmproxy mitmdump)
+
+trap 'docker stop '"$CONTAINER_ID"' 1> /dev/null || true; exit 1' SIGINT
+
+echo "Add the root certificate created in ~/.mitmproxy to your certificate chain for HTTP"
+echo "on macOS:"
+echo "sudo security add-trusted-cert -d -p ssl -p basic -k /Library/Keychains/System.keychain ~/.mitmproxy/mitmproxy-ca-cert.pem"
+echo "Press enter to continue"
+read
+
+http_proxy=http://localhost:9876 cargo run
+
+# Clean up detached proxy after running
+docker stop "$CONTAINER_ID" 2>/dev/null || true