Skip to content

fix(permissions): use standard macOS Local Network request flow (STA-3505) - #12833

Merged
brennanb2025 merged 9 commits into
mainfrom
brennanb2025/sta-3505-necp-local-network
Aug 6, 2026
Merged

brennanb2025 merged 9 commits into
mainfrom
brennanb2025/sta-3505-necp-local-network

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Aug 6, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Uses the supported macOS Local Network permission flow without claiming a permission state that macOS does not expose, and adds an explicit target-specific connection test.

  • Keeps the existing NSLocalNetworkUsageDescription and NSBonjourServices metadata.
  • Labels the permission Managed by macOS and retains Request Access plus Open System Settings.
  • Adds Test Connection for a service on another LAN device.
  • Runs the TCP probe in a bounded Electron-as-Node child process so it exercises the descendant-process path used by terminal tools.
  • Saves the last successful target and timestamp locally; failed tests preserve the prior success.
  • Only records success after the resolved peer is RFC1918, ULA, or link-local. Loopback aliases and public Internet targets cannot produce a false verification.
  • Reports connection outcomes without inferring that macOS denied permission.

STA-3505 reports a macOS 27 beta NECP defect that can silently deny the process tree. Orca cannot reliably introspect the OS permission toggle through a supported API, so the UI reports only a real target-specific connection result.

Screenshot

Electron QA exercised the real descendant-process test against a LAN TCP service and confirmed the saved result remains visible in a disclosure that is collapsed by default. Expanding it reveals the target form.

Collapsed Local Network connection test with saved status

Expanded Local Network connection test

Testing

  • Focused main-process and renderer Vitest suites: 23 tests passed on Node 24
  • Node and web TypeScript checks
  • Oxlint and oxfmt on changed files
  • Changed-code quality, type-aware, and React Doctor gates: 0 findings
  • Localization catalog, extraction, and coverage checks
  • Electron CDP validation on the exact worktree; real LAN test passed, persistence confirmed, and 0 renderer console errors
  • Independent senior subagent review clean after validating loopback and public-target false-positive defenses

Platform scope

The request and connection-test handlers are macOS-gated. There is no polling, terminal hot-path work, remote-wire change, or mutation of SSH, folder-workspace, Git, or cross-platform behavior.

…nostic and workaround (STA-3505)

On macOS 27 beta, NECP silently denies Orca's whole process tree Local
Network access: no prompt fires, the app never appears in System
Settings, and terminal child processes fail with EHOSTUNREACH. The
Settings trigger swallowed the probe's socket error and reported
'unknown' + a 'Permission request sent' toast, indistinguishable from
success.

Classify the mDNS probe outcome (EHOSTUNREACH/EHOSTDOWN -> denied,
clean send -> granted, else unknown), remember the verdict for the
status chip, and render an inline diagnostic with the documented
NECP re-evaluation workaround when denial is detected.
@coderabbitai

coderabbitai Bot commented Aug 6, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The change adds macOS Local Network connection testing with typed results, input validation, LAN target checks, timeout handling, and categorized failures. The main, preload, and web APIs expose the test operation. The renderer adds permission actions, localized notices, connection controls, status displays, and persistence for successful tests. Tests cover IPC behavior, connection outcomes, permission requests, settings actions, and restored connection history.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 18.18% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ⚠️ Warning The description covers the summary, screenshots, testing, and platform scope, but it omits the required AI Review Report and Security Audit sections. Add the AI Review Report, Security Audit, and Notes sections, including cross-platform compatibility checks, reviewed risks, findings, and follow-up work.
✅ Passed checks (3 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly identifies the main change: adopting the standard macOS Local Network permission request flow.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@brennanb2025

brennanb2025 commented Aug 6, 2026 •

Copy link
Copy Markdown
Contributor Author

Updated to the standard macOS flow

The earlier denial heuristic and private-daemon workaround were removed. The final implementation keeps Local Network at Check manually, triggers the supported user-initiated request, and provides the standard Local Network Settings fallback without claiming Granted or Denied.

Standard macOS Local Network request flow

@brennanb2025 brennanb2025 changed the title fix(permissions): surface macOS silent Local Network denial with diagnostic and workaround (STA-3505) fix(permissions): use standard macOS Local Network request flow (STA-3505) Aug 6, 2026
…-necp-local-network

# Conflicts:
#	src/renderer/src/components/settings/DeveloperPermissionsPane.tsx
@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 18429a4a-d694-4ac3-abc8-fdd1cc4c5da0

📥 Commits

Reviewing files that changed from the base of the PR and between a2d438d and 7b703aa.

📒 Files selected for processing (8)
  • src/main/ipc/developer-permissions.test.ts
  • src/main/ipc/developer-permissions.ts
  • src/renderer/src/components/settings/DeveloperPermissionActions.tsx
  • src/renderer/src/components/settings/DeveloperPermissionsPane.test.tsx
  • src/renderer/src/components/settings/DeveloperPermissionsPane.tsx
  • src/renderer/src/components/settings/developer-permission-request-notice.ts
  • src/renderer/src/components/settings/developer-permission-status.ts
  • src/renderer/src/i18n/locales/en.json
🚧 Files skipped from review as they are similar to previous changes (4)
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/components/settings/developer-permission-request-notice.ts
  • src/main/ipc/developer-permissions.test.ts
  • src/renderer/src/components/settings/DeveloperPermissionsPane.test.tsx

Comment on lines +52 to +59
{id === 'local-network' && (
<Button variant="outline" size="sm" onClick={() => void openSettings()}>
{translate(
'auto.components.settings.DeveloperPermissionsPane.localNetworkOpenSystemSettings',
'Open System Settings'
)}
</Button>
)}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Disable the Local Network settings action when unsupported.

The request action disables for status === 'unsupported', but the settings action remains enabled. On a non-macOS platform, it can invoke the macOS-only settings URL. Disable or omit this button when pending || status === 'unsupported'.

As per coding guidelines, “Keep platform-dependent behavior behind runtime checks for macOS, Linux, and Windows.”

Source: Coding guidelines

Comment on lines +297 to +299
showDeveloperPermissionRequestNotice(result, () => {
void window.api.developerPermissions.openSettings({ id: 'local-network' })
})

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

Handle settings-open failures from the notice action.

This callback discards a rejected openSettings promise. The user receives no error notice, unlike DeveloperPermissionActions at lines 25-35. Catch the rejection here or pass a shared error-reporting settings opener.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: a93302e1-8f85-403e-a351-c82038c1cf26

📥 Commits

Reviewing files that changed from the base of the PR and between 7b703aa and 403818f.

📒 Files selected for processing (12)
  • src/main/ipc/developer-permissions.ts
  • src/main/ipc/local-network-connection-test.test.ts
  • src/main/ipc/local-network-connection-test.ts
  • src/preload/api-types.ts
  • src/preload/index.ts
  • src/renderer/src/components/settings/DeveloperPermissionsPane.tsx
  • src/renderer/src/components/settings/LocalNetworkConnectionTest.test.tsx
  • src/renderer/src/components/settings/LocalNetworkConnectionTest.tsx
  • src/renderer/src/components/settings/local-network-connection-history.ts
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/web/web-preload-api.ts
  • src/shared/developer-permissions-types.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/renderer/src/components/settings/DeveloperPermissionsPane.tsx

Comment on lines +77 to +83
const addressWithoutZone = host.split('%', 1)[0] ?? host
const kind = classifyRemotePairingHostname(addressWithoutZone)
if (isIP(addressWithoutZone) === 0) {
return kind === 'loopback' ? null : host
}
const isLinkLocalIpv4 = addressWithoutZone.startsWith('169.254.')
return kind === 'lan' || isLinkLocalIpv4 ? host : null

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Reject public hostnames before starting the connection test.

Line 79 accepts every non-IP hostname except loopback. A hostname such as example.com starts an outbound TCP connection before the child checks socket.remoteAddress. This violates the LAN-only target contract and exposes an external connection primitive through IPC.

Resolve the hostname first. Reject public addresses before opening a socket. Pin the accepted private or link-local address for the connection. Add a regression test that verifies a public hostname does not call runChild.

🧰 Tools
🪛 ast-grep (0.45.0)

[warning] Importing child_process exposes a command-execution surface; ensure any command/argument built from input is validated, and prefer execFile/spawn with an argument array over exec.
Context: import { execFile, type ExecFileException, type ExecFileOptions } from 'node:child_process'
Note: [CWE-78] Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection').

(detect-child-process-typescript)

Comment on lines +116 to +120
{translate(
'auto.components.settings.DeveloperPermissionsPane.connectionTestLastVerified',
'Last verified'
)}{' '}
{new Date(lastSuccess.testedAt).toLocaleString()} · {formatTarget(lastSuccess)}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Format the timestamp with the application locale.

toLocaleString() uses the system locale. Use getIntlLocale() so the saved verification time follows the selected application language.

Based on learnings: use getIntlLocale() for Intl APIs.

Source: Learnings

@brennanb2025
brennanb2025 merged commit b9e9811 into main Aug 6, 2026
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
…3505) (stablyai#12833)

* fix(permissions): surface macOS silent Local Network denial with diagnostic and workaround (STA-3505)

On macOS 27 beta, NECP silently denies Orca's whole process tree Local
Network access: no prompt fires, the app never appears in System
Settings, and terminal child processes fail with EHOSTUNREACH. The
Settings trigger swallowed the probe's socket error and reported
'unknown' + a 'Permission request sent' toast, indistinguishable from
success.

Classify the mDNS probe outcome (EHOSTUNREACH/EHOSTDOWN -> denied,
clean send -> granted, else unknown), remember the verdict for the
status chip, and render an inline diagnostic with the documented
NECP re-evaluation workaround when denial is detected.

* fix(permissions): avoid false Local Network grants

* fix(permissions): use standard Local Network request flow

* feat(permissions): add local network connection test

* fix(permissions): nest local network connection test

* fix(permissions): collapse connection test by default

* fix(permissions): emphasize connection test action

* fix(permissions): restore outlined connection action
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.

1 participant