Files
2026-07-13 13:05:33 +08:00

22 lines
906 B
Swift

import XCTest
final class AgentEntrypointSourceSafetyTests: XCTestCase {
func testAgentEntrypointDoesNotUnlinkCallerSuppliedPaths() throws {
let testFile = URL(fileURLWithPath: #filePath)
let packageRoot = testFile
.deletingLastPathComponent()
.deletingLastPathComponent()
.deletingLastPathComponent()
let mainPath = packageRoot
.appendingPathComponent("Sources")
.appendingPathComponent("OrcaComputerUseMacOS")
.appendingPathComponent("main.swift")
let source = try String(contentsOf: mainPath, encoding: .utf8)
// Why: --agent accepts caller-supplied paths; deleting them in the
// helper can remove user files if argument validation is bypassed.
XCTAssertFalse(source.contains("unlink(tokenPath)"))
XCTAssertFalse(source.contains("unlink(socketPath)"))
}
}