Show HN: Auto Dismiss Mac OS "Allow <app> to find devices on local networks?"

Hacker News by 5 min read 44x views
Show HN: Auto Dismiss Mac OS "Allow <app> to find devices on local networks?"

Share Post

Auto-dismisses the macOS prompt:

Allow "Google Chrome" to discover devices on local networks? This volition authorize the app to discover, nexus to, and collect data from devices on your networks.

It presses Don't Allow for you, inside a fraction of a second, all time. Zero CPU during idle. Survives reboots. One Swift file, no dependencies.

macOS (Sequoia and later) shows this immediate the archetypal period an app touches the local network. The decision is expected to be remembered. For many apps it isn't, so the immediate comes rear on all launch, frequently for apps you aren't equal using:

  • Chromium browsers (Chrome, Brave, Edge, Island, Arc) copy their own app bundle into a random temp directory at initiate so the code signature survives in-place updates. macOS keys the Local Network decision to that random path, so the next initiate looks akin a brand-new app. Your Privacy settings inhabit up alongside copy "Google Chrome.app" rows that no longer item at anything.
  • Apps alongside versioned instal paths (anything that installs into .../versions/1.2.3/) get a new row per update.
  • Misattributed prompts. macOS pins the dialog on whichever app it decides is "responsible", so you'll see prompts for apps that aren't running.
  • Nothing on a representative Mac needs this approval apart from a printer or scanner utility, a media server, or a LAN-discovery tool, and those you answer formerly and they're done.

There is no supported way to prune the list, no MDM payload to pre-deny the permission, and tccutil reset doesn't shield it. So: a small delegate that answers "no" for you.

brew instal johncassil/tap/dontallow # or: create && create install dontallow install

dontallow instal writes a per-user launchd agent, starts it, opens System Settings > Privacy & Security > Accessibility, and prints the exact way to add if macOS doesn't immediate you. Accessibility is the approval that lets it media the button. It waits for the aid and confirms whenever the delegate is active. dontallow position repeats the instructions any period the aid is missing.

Command What it does
dontallow status Agent state, intermission state, allowlist, latest dismissals
dontallow intermission [1h] Leave prompts solitary for a during (30m, 2h, 1d, forever)
dontallow resume Dismiss again
dontallow rules Decode the system's Local Network regulation shop and display what all Privacy row really is, including orphans
dontallow uninstall Stop and eliminate the agent
dontallow run --dry-run Foreground, log what it would do, media nothing

Each dismissal posts a notification naming the app and the intermission command, so you never have to recall how to rotate it off. Mute the notification in System Settings if you'd fairly not see it.

When an app really does need local network access

Three options, choice whichever fits:

  • dontallow intermission 10m, afterward initiate the app and click Allow yourself.
  • Add the app's name to ~/.config/dontallow/allowlist (one per line, case-insensitive substring). Prompts for it are never touched.
  • Flip the toggle in System Settings > Privacy & Security > Local Network. A dismissed immediate records a deny, which you can reverse there.

Set ~/.config/dontallow/grace to a figure of seconds if you desire a opening to click Allow before the delegate does (default 0.25).

The immediate is a opening owned by the scheme procedure UserNotificationCenter. dontallow registers an Accessibility observer for opening innovation on that procedure and sleeps until one fires. It says the dialog text, confirms it's a local network immediate and not item else, checks intermission and allowlist, and performs the Accessibility media act on the Don't Allow button. If the media is refused it falls rear to a synthetic click at the button's location.

It never modifies scheme files, never disables protections, and never chooses Allow.

Local Network cannot be pre-set by MDM, but Accessibility can. For a fleet: build once, sign alongside a Developer ID, container the binary affirmative a PPPC (Privacy Preferences Policy Control) overview granting Accessibility to its code requirement, and run dontallow instal per user. No manual Settings step.

macOS keys the Accessibility aid to the binary's code signature, and all build (including beer upgrade) produces a new one. After an upgrade run dontallow status. If it says the aid is missing, eliminate the dontallow row in Accessibility settings and add it rear from the way it prints. The delegate re-attaches on its own inside ten seconds. A forthcoming publish signed alongside a Developer ID volition eliminate this step.

Unit tests shield the clean logic (dialog content parsing, duration and intermission parsing, allowlist matching, launchd plist generation, and the Local Network regulation decoder against a fixture archive). They build alongside plain swiftc and need no Xcode or SwiftPM. The end-to-end way (a genuine prompt, a genuine press) can lone be checked on a Mac alongside Accessibility granted; the manual formula is in Tests/INTEGRATION.md.

  • Builds alongside Apple's Command Line Tools alone. Xcode is not required.
  • Apple Silicon and Intel: Homebrew compiles natively on each.
  • macOS 13 or afterward to build; the immediate itself lone exists on macOS 15 Sequoia and later.
  • Tested so far: Intel, macOS 26.6. Reports from another versions welcome.
  • English-localized macOS lone for now. The matcher keys on the dialog content and the "Don't Allow" clasp title; localized strings are planned.

MIT

Other Article Hacker News
↑
Close Right Ads
Close Left Ads