Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions RadarSDK/RadarVerificationManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -701,4 +701,35 @@ - (NSString *)kDeviceId {
}
}

Copy link

Copilot AI Jan 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing documentation: This new method lacks a comment or documentation explaining what it does, what scenarios it detects (system proxy settings, VPN interfaces like utun/ipsec/ppp), and what the return value represents. Consider adding a brief comment above the method explaining its purpose and behavior.

Suggested change
/// Returns YES if the device appears to be using a network proxy or VPN.
/// Detection is based on:
/// - System proxy settings from CFNetwork (HTTP/HTTPS/SOCKS).
/// - Presence of network interfaces commonly used by VPNs (e.g., utun, ipsec, ppp).
/// Returns NO if no such proxy or VPN-related configuration is detected.

Copilot uses AI. Check for mistakes.
- (BOOL)isUsingProxy {
CFDictionaryRef proxyRef = CFNetworkCopySystemProxySettings();
Copy link

Copilot AI Jan 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing import: The CFNetworkCopySystemProxySettings function is being used but there is no explicit import for CFNetwork framework. While this may compile due to implicit inclusion, it's best practice to explicitly import CFNetwork at the top of the file with other framework imports.

Copilot uses AI. Check for mistakes.
if (proxyRef) {
NSDictionary *proxy = CFBridgingRelease(proxyRef);

NSNumber *httpOn = proxy[@"HTTPEnable"];
NSNumber *httpsOn = proxy[@"HTTPSEnable"];
NSNumber *socksOn = proxy[@"SOCKSEnable"];

if (httpOn.boolValue || httpsOn.boolValue || socksOn.boolValue) {
return YES;
}
}

struct ifaddrs *ifaddr = NULL;
if (getifaddrs(&ifaddr) == 0 && ifaddr) {
for (struct ifaddrs *cur = ifaddr; cur != NULL; cur = cur->ifa_next) {
if (!cur->ifa_name) continue;
NSString *name = [NSString stringWithUTF8String:cur->ifa_name];
if ([name hasPrefix:@"utun"] ||
[name hasPrefix:@"ipsec"] ||
[name hasPrefix:@"ppp"]) {
Copy link

Copilot AI Jan 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Memory leak: When a VPN/proxy interface is detected and the method returns YES here, the ifaddr structure allocated by getifaddrs on line 719 is not freed. This will leak memory each time a proxy is detected via network interfaces. The freeifaddrs call on line 729 will not be reached. Add a freeifaddrs(ifaddr) call before returning YES.

Suggested change
[name hasPrefix:@"ppp"]) {
[name hasPrefix:@"ppp"]) {
freeifaddrs(ifaddr);

Copilot uses AI. Check for mistakes.
return YES;
}
}
freeifaddrs(ifaddr);
}

return NO;
}

@end