Skip to content

Commit

Permalink
Check mitm from the host
Browse files Browse the repository at this point in the history
  • Loading branch information
kegsay committed Dec 1, 2023
1 parent b0dfb4c commit 6b85d78
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ jobs:
export LD_LIBRARY_PATH="$(pwd)/rust-sdk/target/debug"
env
set -o pipefail &&
go test -v -json -timeout 5m ./tests | gotestfmt
go test -v -json -timeout 5m -run '^TestClientRetriesSendToDevice$' ./tests | gotestfmt
shell: bash # required for pipefail to be A Thing. pipefail is required to stop gotestfmt swallowing non-zero exit codes
name: Run Complement Crypto Tests
env:
Expand Down
2 changes: 2 additions & 0 deletions internal/deploy/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ type SlidingSyncDeployment struct {
reverseProxy testcontainers.Container
slidingSyncURL string
mitmClient *http.Client
ControllerURL string
proxyURLToHS map[string]string
mu sync.RWMutex
tcpdump *exec.Cmd
Expand Down Expand Up @@ -280,6 +281,7 @@ func RunNewDeployment(t *testing.T, shouldTCPDump bool) *SlidingSyncDeployment {
reverseProxy: mitmproxyContainer,
slidingSyncURL: ssURL,
tcpdump: cmd,
ControllerURL: controllerURL,
mitmClient: &http.Client{
Timeout: 5 * time.Second,
Transport: &http.Transport{
Expand Down
7 changes: 7 additions & 0 deletions tests/client_connectivity_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package tests

import (
"fmt"
"net/http"
"os/exec"
"testing"
"time"

Expand All @@ -12,6 +14,11 @@ import (
func TestClientRetriesSendToDevice(t *testing.T) {
ClientTypeMatrix(t, func(t *testing.T, clientTypeA, clientTypeB api.ClientType) {
tc := CreateTestContext(t, clientTypeA, clientTypeB)
t.Logf("checking mitm")
cmd := exec.Command("curl", "-v", "-X", "POST", "-d", "{}", "-x", tc.Deployment.ControllerURL, "http://mitm.code/options/unlock")
output, cerr := cmd.CombinedOutput()
fmt.Println(cerr)
fmt.Println(string(output))
roomID := tc.CreateNewEncryptedRoom(t, tc.Alice, "public_chat", nil)
tc.Bob.MustJoinRoom(t, roomID, []string{clientTypeA.HS})
alice := tc.MustLoginClient(t, tc.Alice, clientTypeA)
Expand Down

0 comments on commit 6b85d78

Please sign in to comment.