Skip to content

Nightbell 3.0.5: answering the security review

Choose a tag to compare

@riveerxd riveerxd released this 11 Aug 13:59
· 192 commits to master since this release

No behaviour changes. This answers a security review of 3.0.4 posted on the F-Droid merge request by Ubaid ur Rehman, whose verdict was pass with recommendations. Nothing here was a defect. Three of the four recommendations were worth doing, and the fourth was worth writing down rather than changing.

Cleartext policy, out of the manifest

android:usesCleartextTraffic="true" was a single boolean meaning "anything goes". It is replaced by res/xml/network_security_config.xml, which supersedes the attribute and can say different things about different hosts.

It still permits cleartext, and it has to. A large share of what people point this app at has no certificate and never will: a NAS admin page on a LAN address, a service on a homelab box over Tailscale, a container on http://192.168.1.20:8080, a printer. Refusing cleartext would not make any of those safer. It would make them unmonitorable, and you would go back to not knowing when they break.

The review asked for cleartext to be scoped to user-configured domains. That is the right instinct and it cannot be done. The file is compiled into the APK at build time; the domains are typed months later on your phone, and Android has no runtime API to add one. The file says so at length so the next person reading it does not have to work it out.

What did change: www.gstatic.com is pinned to HTTPS. That host is the 204 connectivity probe, which is the one endpoint the app contacts on its own behalf rather than yours, and it can no longer be downgraded even though the base config is permissive.

The element picker's WebView

It renders a URL you typed, with script enabled, with a bridge attached. Settings it never used are now off:

allowFileAccess off. The one that mattered, because it defaults to true below Android 11 and this app supports Android 8, so a loaded page could reach file://
allowContentAccess off, same reasoning for content://
mixedContentMode never allow, stated rather than inherited
geolocation off. The app holds no location permission anyway

javaScriptEnabled stays on. It is how the picker works: it injects script so a tap can resolve to a selector.

The bridge is also documented now. It is three methods, each taking a String and returning nothing, with no Context, File or ClassLoader on the object to reach through. What it can still do, said plainly rather than glossed: a page can put a string of its choosing on screen through onError. That is a label, not a privilege boundary, and the page already controls everything else on that screen.

Logs

R8 drops Log.d and Log.v from release builds now. Verified: zero Log.d strings left in the dex.

Log.i, Log.w and Log.e stay, deliberately. When somebody reports that a monitor stopped firing after a reboot, the answer is usually a warning from the scheduler, and a build with no log cannot be diagnosed from a bug report.

BootReceiver, deliberately unchanged

The review asked to confirm it validates its intent, and to consider directBootAware=true.

It already returns unless the action is BOOT_COMPLETED or MY_PACKAGE_REPLACED, so the first half was already true.

directBootAware stays false, and that is an answer rather than an omission. The receiver reads the monitor store to rebuild schedules, that store is credential-encrypted, and a direct-boot receiver runs before credential-encrypted storage is available. Setting the flag would produce a receiver that fires early and then cannot read what it needs.

Updating

Same signing key, so 3.0.4 updates in place. Coming from 3.0.0 still needs an uninstall first. Coming from Pulse 2.x still needs export and import.

Verified

359 JVM tests green. Release build reproducible on openjdk 21.0.12, signing block carries the signature and padding only.

Nightbell-3.0.5-release.apk 2152728 bytes
sha256 fe7c96643497bdad977b20d4752abd6a17c97e4e92c590e2df21eccd6a68aac8