mirror of
https://github.com/stablyai/orca.git
synced 2026-09-22 08:02:28 +00:00
## Summary - stop the macOS helper from unlinking caller-supplied socket and token paths - keep parent-owned token cleanup tied to the helper startup that created it - fail closed for non-socket socket-path collisions and cover helper cleanup races with regression tests ## Verification - swift test --package-path native/computer-use-macos - pnpm exec vitest run --config config/vitest.config.ts src/main/computer/macos-native-provider-client.test.ts - pnpm run typecheck:node - pnpm lint - pnpm run build:computer-macos - Electron/helper startup smoke validation
40 lines
1.4 KiB
Swift
40 lines
1.4 KiB
Swift
import Darwin
|
|
import XCTest
|
|
@testable import OrcaComputerUseMacOSCore
|
|
|
|
final class UnixSocketPathSafetyTests: XCTestCase {
|
|
func testOnlyUnixSocketModesAreAccepted() {
|
|
XCTAssertTrue(UnixSocketPathSafety.isSocketMode(mode_t(S_IFSOCK | 0o600)))
|
|
XCTAssertFalse(UnixSocketPathSafety.isSocketMode(mode_t(S_IFREG | 0o600)))
|
|
XCTAssertFalse(UnixSocketPathSafety.isSocketMode(mode_t(S_IFDIR | 0o700)))
|
|
XCTAssertFalse(UnixSocketPathSafety.isSocketMode(mode_t(S_IFLNK | 0o777)))
|
|
}
|
|
|
|
func testRejectsOnlyNonSocketPathsAfterAddressInUseBindFailure() {
|
|
XCTAssertTrue(
|
|
UnixSocketPathSafety.shouldRejectExistingPathAfterBindFailure(
|
|
bindErrno: EADDRINUSE,
|
|
existingMode: mode_t(S_IFREG | 0o600)
|
|
)
|
|
)
|
|
XCTAssertFalse(
|
|
UnixSocketPathSafety.shouldRejectExistingPathAfterBindFailure(
|
|
bindErrno: EADDRINUSE,
|
|
existingMode: mode_t(S_IFSOCK | 0o600)
|
|
)
|
|
)
|
|
XCTAssertFalse(
|
|
UnixSocketPathSafety.shouldRejectExistingPathAfterBindFailure(
|
|
bindErrno: EACCES,
|
|
existingMode: mode_t(S_IFREG | 0o600)
|
|
)
|
|
)
|
|
XCTAssertFalse(
|
|
UnixSocketPathSafety.shouldRejectExistingPathAfterBindFailure(
|
|
bindErrno: EADDRINUSE,
|
|
existingMode: nil
|
|
)
|
|
)
|
|
}
|
|
}
|