Skip to content

Security re-scan, macOS 27 CI, AppKit main window, SDK stamp, Advanced → Interfaces, local-link devices - #8

Draft
AA-EION wants to merge 19 commits into
mainfrom
claude/eloquent-cori-c2lh6q
Draft

AA-EION wants to merge 19 commits into
mainfrom
claude/eloquent-cori-c2lh6q

Conversation

@AA-EION

@AA-EION AA-EION commented Nov 7, 2026 •

Copy link
Copy Markdown
Owner

Summary

Security (docs/SECURITY-AUDIT.md, 2026-11-07 addendum)

  • All GitHub Actions are pinned to commit SHAs, Dependabot proposes updates, and actions/checkout sets persist-credentials: false.
  • The root daemon spawns ipconfig and route with POSIX_SPAWN_CLOEXEC_DEFAULT and stdin from /dev/null, so they no longer inherit its descriptors.
  • libusb: 1.0.30 is still the latest release; the pinned SHA-256 was re-verified against the release asset.

macOS 27 Golden Gate (docs/MACOS-27.md)

  • I reviewed the 27.0, 27.2 and 27.3 release notes: no documented change breaks us.
  • One item needs a check on hardware: launchd refusing quarantined plists.
  • CI now builds and tests on the xcode-27 runner: C++ build and tests, the root feth ABI gate, and a GUI build with a launch smoke test.
  • Found in CI: a libusb built with the macOS 27 SDK segfaults during USB enumeration on macOS 15 and 26.
    • Shipping builds now select Xcode 26 explicitly.
    • The libusb cache key now includes the SDK and OS version.
    • The macOS 15 DMG smoke test catches a regression.
    • The root cause is still open (AGENTS pitfall 33).

Backward compatibility

  • Every new API is at or below the deployment floors (macOS 14 app, 13.3 CLI); the API table is in docs/MACOS-27.md.
  • The shipped DMG is installed and launched on macos-15 (arm64) and macos-15-intel.
  • New capi.process tests cover the spawn change on every runner.
  • GitHub has no macOS 13 or 14 runners, so those still need a manual check.

Window chrome / AppKit window

  • build-gui.sh stamps the app with the SDK it was built with, using vtool; nothing is hard-coded and minos stays 14.0. The build fails if the stamp is below 26.
  • The main window is now an AppKit NSWindow, which removes the SwiftUI window-resurrection workaround.
  • Reopening from Finder works in menu-bar-only mode, ⌘W closes the window, and pages no longer resize it.

Advanced tools (opt-in, default off)

  • Settings ▸ Show advanced tools adds an Advanced sidebar section.
  • Its first page, Interfaces, shows every interface with live rates. It reads 64-bit NET_RT_IFLIST2 counters and is unprivileged.
  • docs/ADVANCED-TOOLS.md is the roadmap: per-interface speed test, combined throughput, LAN discovery, port checks.

Local-link devices (docs/LOCAL-DEVICES.md, README "Devices that aren't phones")

This covers drones and controllers, FPV goggles, gadget-mode boards and cameras. Nothing is vendor-specific.

  • Live LinkAssessment (unit-tested): waiting / internet / local link / no address.
    • It uses only facts the link reports: the lease, the router, and the device's own address.
    • It is recomputed every poll and never stored, and it never probes the internet.
    • A slow phone is therefore never remembered as "local", and a late lease flips the result to internet by itself.
  • Passive peer discovery: the bridge learns the device's IPv4 address from frames only it can send (ARP sender, link-scoped broadcast/multicast). It's exposed as tk_session_status_t.peer_ipv4 and an optional SessionStatus.peerAddress, so older daemons' JSON still decodes.
  • Route safety: if Route all traffic was requested but no router appears, our network service is moved back to the end of the service order. A device without internet never outranks Wi-Fi.
  • UI:
    • The status reads "Connected · local device".
    • An overview card shows both addresses, or suggests an address next to the device's own.
    • That address applies to this connection only and is never saved; "Try automatic again" re-applies the saved settings.
    • DHCP timeouts after Connect are no longer alerts.
    • Phones with internet see no change.

Test plan

  • Full CI green on 78895aa (16 jobs, including macOS 27 GUI build and launch, and DMG on macOS 15 arm64 and Intel)
  • core.peer_address runs locally (g++ 13, -Werror -Wconversion): 8 cases, 19 assertions
  • CI on the local-link commits
  • On a Mac: traffic lights, ⌘W, reopen from Finder, Interfaces page, phone connect unchanged
  • Gadget-mode Raspberry Pi with a static address and no DHCP: card shows the device address and the suggested address works
  • A drone or remote controller with its vendor software
  • macOS 27 hardware: Android RNDIS session; downloaded notarized DMG registers the background component

🤖 Generated with Claude Code

https://claude.ai/code/session_015mjUJdY1Lr5qCEHAzbbHPK

claude added 11 commits November 7, 2026 20:32
…ldren

Supply-chain re-scan (docs/SECURITY-AUDIT.md, 2026-11-07 addendum):

- Pin every GitHub Action to a full commit SHA (same majors, latest
  patch) instead of a mutable tag; the packaging jobs hold the Developer
  ID certificate and notary key. Dependabot proposes updates.
- actions/checkout: persist-credentials: false everywhere; no job pushes
  with git.
- process_runner: spawn ipconfig/route with POSIX_SPAWN_CLOEXEC_DEFAULT
  and /dev/null stdin, so they no longer inherit the daemon's BPF,
  socket and libusb descriptors.
- libusb: 1.0.30 is still the latest release; the pinned tarball hash
  was re-verified against the GitHub release asset.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015mjUJdY1Lr5qCEHAzbbHPK
GitHub's xcode-27 image runs macOS 27 Golden Gate. Add it to the native
C++ and root feth ABI matrices, plus a job that builds the app with
Xcode 27, runs the Swift tests and checks that the bundled app launches
and stays up.

docs/MACOS-27.md reviews the macOS 27, 27.2 and 27.3 release notes
against what TetherKitNext uses. Nothing documented breaks us; the
launchd quarantined-plist change needs a check with a downloaded,
notarized DMG on real hardware.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015mjUJdY1Lr5qCEHAzbbHPK
macOS 26+ picks a window's chrome from the sdk field of the binary's
LC_BUILD_VERSION, and a SwiftPM link can record the deployment target
there, which gives the whole app the legacy look. After linking, read
minos/sdk with otool; if sdk is older than `xcrun --show-sdk-version`,
rewrite only sdk with vtool (minos stays 14.0). The verify step fails
the build if the signed app is still stamped below 26.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015mjUJdY1Lr5qCEHAzbbHPK
…nced → Interfaces

Main window
- MainWindowController owns an NSWindow with an NSHostingController
  (toolbar/title bridging, sizingOptions = [.minSize]) instead of a
  SwiftUI Window scene. With a MenuBarExtra, SwiftUI resurrected a
  closed Window scene whenever the app was activated; the 3-second
  isWindowPresentationExpected() workaround is gone.
- The window opens from applicationDidFinishLaunching (bare `swift run`
  binaries too); applicationShouldHandleReopen now reaches us, so a
  Finder double-click reopens it in menu-bar-only mode.
- Explicit File ▸ Close (⌘W); without a window scene SwiftUI adds none.
  It also closes a minimized main window.
- Sidebar selection moves from @SceneStorage to @AppStorage (there is
  no scene to store into).

TetherKitNextUIModel (new library target + tests)
- Pane: sidebar sections, opt-in advanced pages, stale-selection
  fallback. Unit-tested.
- InterfaceSampler / InterfaceRateTracker: getifaddrs plus 64-bit
  NET_RT_IFLIST2 counters (getifaddrs' if_data counters are 32-bit and
  wrap at 4 GiB); handles interfaces recreated with fresh counters.

Advanced tools
- Settings ▸ General ▸ "Show advanced tools" (off by default) adds an
  Advanced sidebar section. Its first page, Interfaces, lists every
  interface with MAC, addresses and live rates. Read-only, unprivileged,
  no daemon or network traffic.
- New strings in all six languages.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015mjUJdY1Lr5qCEHAzbbHPK
- docs/ADVANCED-TOOLS.md: ground rules (opt-in, unprivileged first,
  Local Network privacy) and a ranked roadmap: per-interface speed test
  via networkQuality -I, combined throughput and an honest take on
  interface bonding, LAN discovery, port checks, diagnostics, pcap.
- GUI-ARCHITECTURE.md / AGENTS.md: AppKit-owned window rules, SDK
  stamp, 64-bit interface counters, spawn fd hygiene, SHA-pinned actions.
- README: the optional Advanced section.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015mjUJdY1Lr5qCEHAzbbHPK
- capi.process: children inherit no extra descriptor and read EOF on
  stdin (POSIX_SPAWN_CLOEXEC_DEFAULT + /dev/null). Runs on macOS 15
  arm64/Intel, 26 and 27.
- The DMG smoke job becomes a matrix: the shipped universal app is
  installed and launched on macos-15 (arm64) as well as macos-15-intel.
- docs/MACOS-27.md: availability table for every new API (all <= the
  macOS 14 app / 13.3 CLI floors) and what still needs a manual check
  (macOS 14 GUI, macOS 13.3 CLI: no GitHub runners).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015mjUJdY1Lr5qCEHAzbbHPK
The xcode-27 job and the macos-15/26 jobs share runner.os/arch, so they
shared one cached libusb. The copy built on macOS 27 with the 27 SDK was
restored on macOS 15 and 26, where USB enumeration (capi.basics,
tk_list_devices) segfaulted. Each runner now builds or reuses only a
libusb from its own toolchain.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015mjUJdY1Lr5qCEHAzbbHPK
The cache mix-up showed that a libusb built on macOS 27 with the 27 SDK
segfaults during enumeration on macOS 15 and 26, while fresh Xcode 26
builds pass everywhere (all C++ / feth jobs green after keying the cache
by SDK). Selecting the newest Xcode would silently switch releases to
27 once runner images add it, so package and release jobs now pick the
newest Xcode_26*. Documented as AGENTS.md pitfall 33 and in
docs/MACOS-27.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015mjUJdY1Lr5qCEHAzbbHPK
The Xcode 26 pin for shipping builds was applied to every matching step,
including gui-macos-27, whose runner has only Xcode 27. That job exists
to build with Xcode 27, so it selects the newest Xcode again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015mjUJdY1Lr5qCEHAzbbHPK
…ault route

Not every RNDIS device is a phone. Drones and remote controllers, FPV
goggles, gadget-mode boards and cameras are local links, often with a
fixed address, no DHCP server and no router.

- peer_address.h: the bridge reads the device's own IPv4 from frames only
  it can have sent (ARP sender; IPv4 to 255.255.255.255 or 224.0.0.0/24).
  Ordinary unicast is ignored, because phones forward internet traffic.
  It costs a few byte loads per RX frame and one relaxed atomic store on
  change. Exposed as tk_session_status_t.peer_ipv4 (appended field).
- ApplyDhcp: when "route all traffic" was requested but no stable router
  appears, move our SCNetworkService back to the end of the service order
  (DemoteManagedNetworkService), so a device without internet never
  outranks Wi-Fi/Ethernet.
- Tests: core.peer_address (frame rules, observer), capi.basics
  (peer_ipv4 empty when idle).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015mjUJdY1Lr5qCEHAzbbHPK
…them

- LinkAssessment (TetherKitNextUIModel, unit-tested): waiting / internet /
  local link / no address, judged from live facts only (lease, router,
  the device's address) and recomputed every poll. It is never stored per
  device and never probes the internet, so a slow phone is not
  remembered as "local", and a late lease flips back to internet by itself.
- Overview LinkKindCard (hidden for normal phones): explains local devices,
  shows both addresses, suggests an address next to the device when it has
  no DHCP, applied for this connection only (never saved), plus "Try
  automatic again". Status reads "Connected · local device".
- DHCP problems after Connect are no longer alerts.
- Strings in all six languages; README section "Devices that aren't
  phones"; docs/LOCAL-DEVICES.md (design and the alternatives to
  persisting the device kind); AGENTS pitfalls 34-36.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015mjUJdY1Lr5qCEHAzbbHPK
@AA-EION AA-EION changed the title Security re-scan, macOS 27 CI, AppKit main window, SDK stamp, opt-in Advanced → Interfaces Security re-scan, macOS 27 CI, AppKit main window, SDK stamp, Advanced → Interfaces, local-link devices Nov 7, 2026
…o English

Translation tables (LocalizedStrings.swift, messages.def) and the
bilingual DMG artwork are unchanged. Kept on purpose: multibyte test
data (UTF-8 truncation, argv pass-through), the two i18n tests that
verify the zh table itself, ParseLanguage's "中文" alias, and the zh
full-width separator.

- tests/: all TEST_CASE/SUBCASE names, messages and literals.
- Tests that pinned Chinese only to match their needles now pin English
  (stats line, CONDIS error, keep-alive fatal, MalformedReason name).
- Fix a vacuous check: "repeated enumeration does not reinitialize
  libusb" searched the logs for Chinese text while running in English,
  so it could never fail. It now pins English and matches
  "libusb initialized".
- The root-test skip notice and the CI gate that greps for it changed
  together; with a stale needle, skipped feth cases would pass silently.
- CMake options/messages and configure summary, benchmark report text
  (docs/BENCHMARKS.md generator), static_assert messages, Swift test
  assertion messages.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015mjUJdY1Lr5qCEHAzbbHPK
Driver core
- TX: the send thread pushed unused slots back into tx_free_slots_, a
  single-producer ring the libusb completion callback also pushes to. A
  lost slot drains the 4-slot pool and stalls TX for good. Unused slots
  are now held in held_tx_slot_ (send thread only) and reused first.
- Bridge::Start: when StartReceiving failed partway, in-flight bulk IN
  transfers outlived rx_ring_/counters_ (use-after-free). Shut the
  channel down on that path.
- RNDIS: completions are matched by RequestId as well as type, so a late
  reply to a timed-out QUERY is discarded instead of answering the next
  one (e.g. link speed parsed as media state).
- RX drops seen by the injector thread get their own counters: two
  writers on one single-writer DirectionCounters lost increments.
- Runtime: started_/stopped_ are atomic; Start() after Stop() is refused
  (it would spawn a thread the destructor never joins). The initial
  link-down state now pauses the bridge, and a device reset restores the
  link's pause state instead of forcing "running".

C ABI / CLI
- Orphan registry: rewritten atomically (temp + O_EXCL|O_NOFOLLOW +
  rename); re-creating a known interface name takes the new owner PID, so
  the next startup cleanup cannot destroy a live interface.
- ApplyDhcp: demote the managed service when routing fails after the
  lease too, not only when there is no router.
- tk_net_apply NUL-terminates the caller's fixed-size strings before use.
- KiB sizes saturate instead of wrapping (C ABI); the CLI rejects
  --vid/--pid above 0xFFFF and oversized KiB values.

CI
- The root feth ABI step runs under bash with pipefail, so a failing
  ctest is no longer masked by `| tee`.
- Xcode 26 selection matches release bundles only (no betas) and reaches
  the explicit error when none exists.

Cleanup: unused IsCompletion/IsFailure/ElapsedSeconds/RxCounters/
Speed(), unused kCapiWhatUpdateScopedRoute, a corrected BPF batch-limit
comment, "drain" wording in the C ABI docs.

Verified locally on Linux with Darwin shims: RNDIS, codec, error, i18n,
byte order, peer address, bridge, rings and stats suites
(170 cases, 10,257 assertions).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015mjUJdY1Lr5qCEHAzbbHPK
- XPC: requests time out after HelperConstants.requestTimeout (defined
  but unused until now), so a daemon that never replies cannot wedge
  isBusy and polling. A stale invalidation/interruption handler no
  longer discards the newer cached connection.
- The UI language is pushed to every daemon that appears (install,
  approval, restart, update), not only on a language change.
- Errors raised while the window is closed (menu bar Connect) bring the
  window up instead of staying invisible.
- Launched as a login item: start in the menu bar without opening the
  window.
- Launch at login: no unregister() after a failed register() overwriting
  the first error.
- Throughput: no ~10^19 bit/s spike when a new session follows a failed
  one (counters reset).
- windowDidAppear refreshes only when the window was hidden, so focus
  changes no longer interleave a second refresh with the poll loop.
- Session-only address / auto-configure note are cleared only after a
  successful apply or clear; a typed address is cleared between sessions.
- Interfaces page: no sampling while the window is hidden; IPv6
  link-local addresses print correctly (embedded scope moved to
  sin6_scope_id); the 64-bit counter read retries on ENOMEM.
- Netmask 0.0.0.0 is rejected. DNS rows use bounds-checked bindings.
- Hiding advanced tools forgets an advanced page selection.
- Dead code: stopPolling, glassGroup, isUnreachable, isPermissionDenied,
  stopLogCapture, withReference, the unused helperComponentVersion key.
  Stale AEWP and machine-translated comments rewritten.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015mjUJdY1Lr5qCEHAzbbHPK
… error in a bridge test

- HelperClient: NSXPCConnection is not Sendable, so the invalidation handler
  can't capture it (not even weakly). Identify the connection by
  ObjectIdentifier and take it out of the cache under the lock instead.
- test_core_bridge: "a failed link write..." read io_errors right after
  injecting; on the slow Intel runner the failing second write had not
  happened yet. Wait for it with WaitFor instead of sampling once.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015mjUJdY1Lr5qCEHAzbbHPK
…2-#25)

Reimplemented for this codebase rather than cherry-picked:

- #19 (default route after teardown): manual-mode "route all traffic"
  changes the kernel default route behind configd's back; clearing the
  config or destroying the interface left the Mac without a default
  route. Instead of caching the previous gateway (stale after a network
  change or helper restart, as upstream does), ReconcileSystemDefaultRoute
  reads configd's primary router from State:/Network/Global/IPv4 and
  restores it, only when the kernel route is missing or still goes
  through our interface (never over a VPN's route).
- #22: re-enumerate right before connecting (Android re-enumerates when
  tethering is toggled) and pass VID/PID along with the bus address, so a
  stale address can't select another device; manual refresh drops a
  stale selection.
- #6 (macOS 27: launchd refuses quarantined plists): strip
  com.apple.quarantine from the bundled LaunchDaemon plist before each
  SMAppService registration.
- #24: bulk OUT timeouts are logged at debug level (still counted).
  The TX pool size is unchanged: 4 -> 16 trades latency for burst
  capacity and needs hardware benchmarks first.
- #23: idle --stats lines print once, then as a 1-in-12 heartbeat. Its RX
  backoff is not needed: the injector already parks on a futex.
- #25: no implicit animation on the throughput chart.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015mjUJdY1Lr5qCEHAzbbHPK
…s a namespace

Formats only lines changed relative to main (git clang-format with
clang-format 18), so the new Lint workflow passes on this branch without
reformatting untouched code. NamespaceMacros: [TEST_SUITE] keeps doctest
suites unindented, as the tests are written. No behavior change: the local
test build (170 cases, 10,271 assertions) passes unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015mjUJdY1Lr5qCEHAzbbHPK
- codeql.yml: CodeQL for c-cpp, swift and actions (security-extended) on
  PRs, pushes to main and weekly; macOS 26 / Xcode 26 because CodeQL
  can't trace macOS 27 / Xcode 27 builds or analyze Swift 6.4 yet.
  libusb and the C++ library for the Swift job are built before init so
  only our own code is analyzed.
- lint.yml: clang-format 18 on changed lines (blocking) with a repo-wide
  backlog summary, and clang-tidy on changed sources (advisory
  annotations).
- release.yml: stable releases also upload TetherKitNext.dmg, a
  fixed-name copy, so releases/latest/download/TetherKitNext.dmg always
  resolves to the newest version.
- README: a large "Download for macOS" button plus latest-version badge
  at the top, and the same direct link in Install step 1.
- AGENTS.md: pitfalls 45-46, CI status.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015mjUJdY1Lr5qCEHAzbbHPK
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants