-
Notifications
You must be signed in to change notification settings - Fork 509
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add security checks for managed properties and network interception
Add security checks for managed properties and network interception. * **CommunicationBridge/main.swift** - Add `checkForManagedProperties` function. - Call `checkForManagedProperties` at the start of the main function. * **CommunicationBridge/ServiceDelegate.swift** - Add `checkForManagedProperties` function. - Call `checkForManagedProperties` in `listener(_:shouldAcceptNewConnection:)` method. * **Copilot-for-Xcode-Info.plist** - Add security settings for managed properties and network interception. * **Core/Sources/Service/Service.swift** - Add `checkForNetworkInterception` function. - Call `checkForNetworkInterception` in the `start()` method. * **Core/Sources/Service/XPCService.swift** - Add `checkForNetworkInterception` function. - Call `checkForNetworkInterception` in `getXPCServiceVersion(withReply:)` method. * **Core/Tests/ServiceTests/NetworkInterceptionTests.swift** - Add unit tests to verify network interception checks. * **Core/Tests/ServiceTests/ManagedPropertiesTests.swift** - Add unit tests to verify managed properties checks. --- For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/github/CopilotForXcode?shareId=XXXX-XXXX-XXXX-XXXX).
- Loading branch information
Showing
7 changed files
with
85 additions
and
3 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
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
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,19 @@ | ||
import XCTest | ||
@testable import CommunicationBridge | ||
|
||
class ManagedPropertiesTests: XCTestCase { | ||
|
||
func testCheckForManagedProperties() { | ||
let result = checkForManagedProperties() | ||
XCTAssertFalse(result, "Managed properties should not be detected in this test environment.") | ||
} | ||
|
||
func testListenerShouldAcceptNewConnection() { | ||
let serviceDelegate = ServiceDelegate() | ||
let listener = NSXPCListener(machServiceName: "com.example.service") | ||
let connection = NSXPCConnection(machServiceName: "com.example.service", options: []) | ||
|
||
let shouldAccept = serviceDelegate.listener(listener, shouldAcceptNewConnection: connection) | ||
XCTAssertTrue(shouldAccept, "Connection should be accepted in this test environment.") | ||
} | ||
} |
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,17 @@ | ||
import XCTest | ||
@testable import Service | ||
|
||
class NetworkInterceptionTests: XCTestCase { | ||
|
||
func testNetworkInterceptionDetected() { | ||
let service = Service.shared | ||
let result = service.checkForNetworkInterception() | ||
XCTAssertTrue(result, "Network interception should be detected.") | ||
} | ||
|
||
func testNetworkInterceptionNotDetected() { | ||
let service = Service.shared | ||
let result = service.checkForNetworkInterception() | ||
XCTAssertFalse(result, "Network interception should not be detected.") | ||
} | ||
} |