-
Notifications
You must be signed in to change notification settings - Fork 354
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add negative leak test for iOS #6449
base: main
Are you sure you want to change the base?
Conversation
45b5c0e
to
dc55447
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 0 of 13 files reviewed, 1 unresolved discussion (waiting on @pinkisemils)
ios/MullvadVPNUITests/Networking/StreamCollection.swift
line 160 at r1 (raw file):
} return DateInterval(start: startDate!, end: endDate!)
Left some illegal force unwrapping in this function which should probably be fixed 👮
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 0 of 13 files reviewed, 2 unresolved discussions (waiting on @pinkisemils)
ios/MullvadVPNUITests/Base/BaseUITestCase.swift
line 110 at r1 (raw file):
let springboard = XCUIApplication(bundleIdentifier: "com.apple.springboard") if springboard.buttons["Allowi"].waitForExistence(timeout: Self.shortTimeout) {
Typo "Allowi"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 0 of 13 files reviewed, 3 unresolved discussions (waiting on @pinkisemils)
ios/MullvadVPN.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
line 0 at r1 (raw file):
Restore 😄
e91216d
to
811e8f4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 3 of 13 files at r1, 7 of 11 files at r2, 3 of 5 files at r3, all commit messages.
Reviewable status: 11 of 15 files reviewed, 5 unresolved discussions (waiting on @niklasberglund)
ios/MullvadVPNUITests/LeakTests.swift
line 87 at r3 (raw file):
let capturedStreams = stopPacketCapture() LeakCheck.assertNoLeaks(streams: capturedStreams, rules: [NoTrafficToHostLeakRule(host: targetIPAddress)])
assertNoLeaks
implies that it shouldn't leak, no? Or am I reading this wrong? :)
ios/MullvadVPNUITests/Base/BaseUITestCase.swift
line 225 at r3 (raw file):
// If there's a an active session due to cancelled/failed test run make sure to end it if packetCaptureSessionIsActive {
S
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 13 files at r1, 1 of 5 files at r3.
Reviewable status: 13 of 15 files reviewed, 5 unresolved discussions (waiting on @niklasberglund)
ios/MullvadVPNUITests/Networking/Networking.swift
line 32 at r3 (raw file):
class Networking { static func getIPAddress() throws -> String { var ipAddress: String
We actually have an API now to get the correct IP address here, there are devices in the office where en0
is not the WiFi interface. A simple GET on /own-ip
will return the IP of the device.
9b49b22
to
5cdb5b8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 7 of 18 files reviewed, 3 unresolved discussions (waiting on @pinkisemils)
ios/MullvadVPNUITests/LeakTests.swift
line 87 at r3 (raw file):
Previously, pinkisemils (Emīls Piņķis) wrote…
assertNoLeaks
implies that it shouldn't leak, no? Or am I reading this wrong? :)
Haha yes you're right. Fixed
ios/MullvadVPNUITests/Base/BaseUITestCase.swift
line 225 at r3 (raw file):
Previously, pinkisemils (Emīls Piņķis) wrote…
S
Did you mean to write something more? 😊
ios/MullvadVPNUITests/Networking/Networking.swift
line 32 at r3 (raw file):
Previously, pinkisemils (Emīls Piņķis) wrote…
We actually have an API now to get the correct IP address here, there are devices in the office where
en0
is not the WiFi interface. A simple GET on/own-ip
will return the IP of the device.
Nice, using it instead now. There was a function to get IP address using the API in FirewallClient
but I created a super class TestRouterAPIClient
which all other "clients" inherit from. Moved the get IP address function to there because it's not firewall specific.
bd454de
to
bb8614c
Compare
bb8614c
to
e086b8e
Compare
Adds basic leak tests which makes sure that traffic to a specific host goes through tunnel. There's a lot of room for improvement in how the window for packet capture is determined. Since local APIs cannot be accessed once connected to a relay the packet capture is started before connecting to relay, and stopped after disconnecting. Then a few seconds is trimmed from the beginning and end of the packet capture in order to not get any packet capture from when the tunnel connection was not up.
The changes in this PR can be tested by running the end to end tests
testNoLeak
andtestShouldLeak
.Note: there's a known issue with the traffic generation. After setting up a tunnel connection all the connections for dummy traffic are blocked.
This change is