Security¶
This page summarizes how 9-Pin Scorer handles data storage and transport, and what to consider for a production deployment.
Data At Rest (On Device)¶
- The app persists its operational state to local app storage (SQLite-backed).
- Since 1.19, every saved record (bowlers, teams, leagues, matches, settings)
and every paired-device secret is encrypted with AES-256-GCM. The 256-bit key
is created on first launch and kept in the platform keychain (Android
Keystore-backed encrypted preferences, iOS/macOS Keychain, Windows Credential
Manager); it never leaves the device and is not in backups. Each value is
bound to its row, so a value copied into another row fails to open. Data
saved by older versions is encrypted on the first launch of 1.19. Code:
lib/src/data/security/record_cipher.dart. - If the keychain is wiped or replaced (rare: some device restores do it),
the saved data can no longer be opened. The app moves it to an
app_entity_unreadabletable (kept, not deleted), starts at Welcome with a notice, and the center restores its latest backup. A keychain read error is not treated as a lost key: the app starts without saving, so nothing is overwritten. - Backups exported from the app are plain JSON and may contain personal data (names, phone numbers, and email addresses) depending on what you entered.
Device security matters: use OS-level passcodes/MDM where appropriate and treat exports/backups as sensitive.
Data In Transit (Over The Network)¶
- LAN sync (when enabled) communicates on your local network.
- Firebase transport (when enabled) communicates with Firebase endpoints over TLS (HTTPS) as provided by the Firebase SDKs.
- License activation/validation uses a server URL you configure; for production use it should be HTTPS. Only admin devices contact the license server; scorer devices follow the center license published by the admin device.
Scorekeeper Pairing (LAN)¶
- Each scorekeeper device is paired to the host via a one-time provisioning QR
(or the 6-digit code shown with it) that carries a unique random shared
secret. The QR and the code are both one-time: the first device to fetch
the package consumes it, the pairing server closes after 5 minutes, and it
stops accepting codes after 5 wrong attempts. The host records the pairing in
a local
paired_devicesallowlist; the scorekeeper persists the secret to OS-level secure storage (Keychain on iOS, Keystore-backed encrypted shared preferences on Android, DPAPI on Windows). - Every scorekeeper-to-host LAN connection signs its
hellowith HMAC-SHA256 overclubId | deviceId | timestamp | nonce. The host rejects the connection if the device is not in its allowlist, the MAC fails to verify, or the client timestamp is more than 60 seconds out of skew. - Wiping the host (
Settings > Data & Recovery > Reset to empty) clears the allowlist. Every previously-paired scorekeeper must re-scan a fresh QR before it can reconnect. - A connected scorekeeper's republish (sent when it starts or reconnects) is trusted only for that device's own device record and the matches it owns. The host never deletes matches or devices, or replaces the session, because a scorekeeper's copy is missing them.
- Every other message from a scorekeeper is checked against what a scorer tablet may change. It may update its own device record, score and take over matches, and claim the session. The host ignores anything else from it: league, team, bowler, club, license and settings changes, removing devices, and deleting a match another device owns.
- Until its
hellovalidates, a connection may send at most 16 KB; more drops it. - Each club gets a random id the first time it is set up, so two clubs (or a demo laptop) on the same network never answer for each other. Clubs set up before 1.17 keep their original id so their paired tablets keep working.
Sync Now/Syncsend club setup (club, settings including the admin PIN, leagues, teams, bowlers) only to authenticated, paired scorekeepers.- On a scorekeeper, the admin PIN opens only that tablet's own settings, not club setup.
- Five wrong PINs in a row lock every PIN prompt on that device for one minute.
Backups And Licensing¶
- Restoring a backup restores club data only. The device keeps its own license and device id, so a backup (or an edited one) can't re-activate a license or clone another device's identity. Matches and the session the backup's device owned are handed to the restoring device.
- A backup made by a newer app version is refused with a prompt to update.
- A license expiry date that can't be read counts as expired.
Firebase Realtime Database¶
database.rules.jsondenies all reads and writes. The Firebase transport has no sign-in yet, so it must not run against an open database. Add Firebase Auth and club-scoped rules before enabling it.- The host proves itself too. After a scorekeeper's hello validates, the
host answers with a
hello_acksigned with that scorekeeper's secret over both sides' fresh nonces, the encryption the scorekeeper offered and what the host chose. A scorekeeper that has once seen its host do this ignores any host that can't (a rogue machine answering for the club), and a forged ack drops the connection. Tablets paired to an older host keep working until that host is updated; from then on the check is enforced. - LAN traffic is encrypted when both sides run 1.17 or later: AES-256-GCM, one key per direction derived from the pairing secret and both nonces, and a message counter as the nonce, so a replayed, reordered, altered or injected line fails and the link is dropped. An older device on either end falls back to plaintext. Stripping the encryption offer in transit is caught by the signed ack.
- The setup QR code carries a one-time key, and a 1.17 tablet fetches the setup package (which holds its pairing secret) encrypted with it. An older tablet gets it in plaintext, and so does the typed 6-digit code (a 6-digit code is too short to protect a key), so prefer scanning the QR code on a shared network.
- Discovery broadcasts (UDP and mDNS) and the TV display pages are not encrypted; they carry no secrets.
Operational Guidance¶
- Use
Archive Modefor closed clubs that need view-only access. - Use
Settings > Data & Recoveryto reset devices before handing them to a different club. - Avoid sharing exported backups outside your club staff.
Reporting¶
Security issues: support@bluetrace.net