-
Notifications
You must be signed in to change notification settings - Fork 357
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
936ab8f
commit 7559def
Showing
16 changed files
with
743 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
22 changes: 0 additions & 22 deletions
22
ios/MullvadVPN.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
// | ||
// LeakTests.swift | ||
// MullvadVPNUITests | ||
// | ||
// Created by Niklas Berglund on 2024-05-31. | ||
// Copyright © 2024 Mullvad VPN AB. All rights reserved. | ||
// | ||
|
||
import XCTest | ||
|
||
class LeakTests: LoggedInWithTimeUITestCase { | ||
override func tearDown() { | ||
FirewallClient().removeRules() | ||
super.tearDown() | ||
} | ||
|
||
/// Send UDP traffic to a host, connect to relay and make sure while connected to relay no traffic leaked went directly to the host | ||
func testNoLeak() throws { | ||
let targetIPAddress = Networking.getAlwaysReachableIPAddress() | ||
startPacketCapture() | ||
let trafficGenerator = TrafficGenerator(destinationHost: targetIPAddress, port: 80) | ||
trafficGenerator.startGeneratingUDPTraffic(interval: 30.0) | ||
|
||
TunnelControlPage(app) | ||
.tapSecureConnectionButton() | ||
|
||
allowAddVPNConfigurationsIfAsked() | ||
|
||
TunnelControlPage(app) | ||
.waitForSecureConnectionLabel() | ||
|
||
// Keep the tunnel connection for a while | ||
Thread.sleep(forTimeInterval: 30.0) | ||
|
||
TunnelControlPage(app) | ||
.tapDisconnectButton() | ||
|
||
trafficGenerator.stopGeneratingUDPTraffic() | ||
|
||
var capturedStreams = stopPacketCapture() | ||
// For now cut the beginning and and end of the stream to trim out the part where the tunnel connection was not up | ||
capturedStreams = PacketCaptureClient.trimPackets(streams: capturedStreams, secondsStart: 8, secondsEnd: 3) | ||
LeakCheck.assertNoLeaks(streams: capturedStreams, rules: [NoTrafficToHostLeakRule(host: targetIPAddress)]) | ||
} | ||
|
||
/// Send UDP traffic to a host, connect to relay and then disconnect to intentionally leak traffic and make sure that the test catches the leak | ||
func testShouldLeak() throws { | ||
let targetIPAddress = Networking.getAlwaysReachableIPAddress() | ||
startPacketCapture() | ||
let trafficGenerator = TrafficGenerator(destinationHost: targetIPAddress, port: 80) | ||
trafficGenerator.startGeneratingUDPTraffic(interval: 1.0) | ||
|
||
TunnelControlPage(app) | ||
.tapSecureConnectionButton() | ||
|
||
allowAddVPNConfigurationsIfAsked() | ||
|
||
TunnelControlPage(app) | ||
.waitForSecureConnectionLabel() | ||
|
||
Thread.sleep(forTimeInterval: 2.0) | ||
|
||
TunnelControlPage(app) | ||
.tapDisconnectButton() | ||
|
||
// Give it some time to generate traffic outside of tunnel | ||
Thread.sleep(forTimeInterval: 5.0) | ||
|
||
TunnelControlPage(app) | ||
.tapSecureConnectionButton() | ||
|
||
// Keep the tunnel connection for a while | ||
Thread.sleep(forTimeInterval: 5.0) | ||
|
||
app.launch() | ||
TunnelControlPage(app) | ||
.tapDisconnectButton() | ||
|
||
// Keep the capture open for a while | ||
Thread.sleep(forTimeInterval: 15.0) | ||
trafficGenerator.stopGeneratingUDPTraffic() | ||
|
||
var capturedStreams = stopPacketCapture() | ||
// For now cut the beginning and and end of the stream to trim out the part where the tunnel connection was not up | ||
capturedStreams = PacketCaptureClient.trimPackets(streams: capturedStreams, secondsStart: 8, secondsEnd: 3) | ||
LeakCheck.assertLeaks(streams: capturedStreams, rules: [NoTrafficToHostLeakRule(host: targetIPAddress)]) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.