8000 Harden pre-release privacy controls by shroominic · Pull Request #30 · shroominic/OpenGlucose · GitHub
[go: up one dir, main page]

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,21 @@ expectations are defined in [docs/compatibility.md](docs/compatibility.md).

## [Unreleased]

Nothing yet.
### Changed

- Restricted glucose-history blobs now use deterministic SHA-256 filenames
that do not embed reversible sensor storage keys. Schema-two filenames are
migrated crash-safely at startup, interrupted migrations resume, and
conflicting copies fail closed without discarding either history.

### Security

- Startup removes identifier-bearing legacy
`openhealth_<sensor-id>_<timestamp>.csv` cache exports using an exact filename
and regular-file check, while preserving unrelated cache entries.
- Release startup sets `flutter_blue_plus` Dart/native logging to `none` before
storage initialization or any BLE operation and fails closed if the plugin
cannot confirm the setting.

## [0.1.0] - 2026-08-13

Expand Down
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ repository's [MIT License](LICENSE), and that you have the right to submit it.

- Search existing [issues](https://github.com/shroominic/OpenGlucose/issues) and
pull requests before proposing duplicate work.
- Follow [SECURITY.md](SECURITY.md) for a vulnerability. Private vulnerability
reporting is an external GitHub setting and is not yet verified; do not send
details until the private intake is visibly available.
- Follow [SECURITY.md](SECURITY.md) for a vulnerability. GitHub private
vulnerability reporting was reported enabled by the repository API on
2026-08-14; confirm the private form is still visible before sending details.
- Do not submit real glucose histories, sensor serials, Bluetooth identifiers,
provisioning material, credentials, or other personal data.
- Keep the product boundary clear: OpenGlucose is wellness/reference software,
Expand Down
10 changes: 5 additions & 5 deletions SECURITY.md
8000
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@ vulnerability details.

The intended channel is GitHub
[private vulnerability reporting](https://github.com/shroominic/OpenGlucose/security/advisories/new).
This depends on an external repository setting and has not been verified as
enabled. Before sending details, confirm that GitHub presents a private report
form for this repository.
The GitHub repository API reported the setting enabled on 2026-08-14. Because
that external setting can change, confirm that GitHub still presents a private
report form before sending details.

There is currently no second verified private reporting address. If the GitHub
form is unavailable, do not send vulnerability details through a public issue,
discussion, unsolicited direct message, or guessed address. Retain the details
privately until the repository publishes and verifies a secure fallback. The
repository owner must enable and verify private reporting before an external
release or production-readiness claim.
repository owner must keep private reporting enabled and reverify it before a
production-readiness claim.

Do not open a public issue for an undisclosed vulnerability. Do not attach:

Expand Down
14 changes: 14 additions & 0 deletions docs/compatibility.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,20 @@ last-verified release/date. A shared name, service UUID, or demo-driver result
alone is not compatibility evidence. Protocol changes should remain tolerant
of unknown data while failing safely on malformed or unauthenticated input.

Restricted health-state schema three changes history-blob filenames from a
reversible base64 storage key to `history-<sha256>.blob`. Schema-zero/one
embedded histories and schema-two filenames migrate automatically. The rename
is atomic within the restricted directory; a launch interrupted before the
metadata rewrite resumes from either old or new names. If both names exist with
different contents, startup preserves both and fails closed for manual recovery
instead of guessing which glucose history is authoritative.

Downgrading to a schema-two app after filename migration is unsupported: the
older app cannot locate schema-three blobs even though their bytes remain on
disk. Roll forward to a schema-three build and preserve the original app
container read-only for recovery; do not manually rename or edit live health
state. See [the recovery runbook](runbooks/data-recovery.md).

## Application releases

The OpenGlucose app remains pre-1.0. User-facing behavior can change between
Expand Down
8 changes: 4 additions & 4 deletions docs/engineering/standards.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,14 @@ unrecorded failed-check bypasses are not waivers. Expired waivers block release.
| Data classification | Health/device data | Documented; implementation verification incomplete | `docs/privacy/data-handling.md` | `@shroominic` | Before external release |
| Intended-use boundary | Health metrics/AI | Verified locally | `docs/product-safety.md` | `@shroominic` | — |
| Android backup exclusion | Restricted data | Enforced in repository | manifest and `res/xml/*backup*` | `@shroominic` | — |
| iOS backup exclusion | Restricted data | Implemented in repository; platform verification pending | Dedicated file, migration, native attribute code and local tests | `@shroominic` | Before external release |
| Lock-screen redaction | Restricted data | Implemented in repository; final verification pending | Android service, iOS controller, and local tests | `@shroominic` | Before external release |
| Sensitive-log controls | Restricted data | Policy documented; implementation verification pending | `docs/privacy/data-handling.md`; production/device audit absent | `@shroominic` | Before external release |
| iOS backup exclusion | Restricted data | Verified for current restricted state on physical iOS device | Dedicated file/migration tests plus build 17 app-container attribute inspection on `Shroominic` (2026-08-14) | `@shroominic` | — |
| Lock-screen redaction | Restricted data | Implemented; active-session visual verification pending | Android service, iOS controller, local tests; physical active-session evidence still required | `@shroominic` | Before external release |
| Sensitive-log controls | Restricted data | BLE plugin release logs disabled; broader verification pending | Startup-order and log-policy tests; production/device recheck still required | `@shroominic` | Before external release |
| Complete deletion/retention | Restricted data | Planned | Partial cache clear only | `@shroominic` | Before production-readiness claim |
| Physical-device end-to-end lane | Critical sensor journey | Approved time-bounded baseline exception | `make test-e2e` reports deferred; redacted manual device evidence required | `@shroominic` | 2026-11-30 |
| Release signing | Distributable app | Enforced locally, external unverified | Android fails without release env; release runbook | `@shroominic` | — |
| Dependency/secret scanning | Supply chain | Enforced in repository; external execution unverified | `.github/workflows/security.yml` and `.github/dependabot.yml` | `@shroominic` | — |
| Private vulnerability intake | Security reports | Unverified external | GitHub private-reporting URL documented; repository setting not verified | `@shroominic` | Before external release |
| Private vulnerability intake | Security reports | Enabled and verified | GitHub repository API reported the setting enabled 2026-08-14 | `@shroominic` | — |
| Accessibility verification | Mobile UI | Planned | No established semantics/device lane | `@shroominic` | Before production-readiness claim |
| Protected branch/required checks | Integration | Unverified external | Requires repository-admin evidence | `@shroominic` | Before merging the feature train |

Expand Down
36 changes: 24 additions & 12 deletions docs/privacy/data-handling.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,23 @@ Native persistence is implemented to keep sensor identity and glucose history
in versioned, dedicated application-support files. Dart writes use serialized,
transactional snapshots with interrupted-commit recovery. On first launch they
migrate restricted legacy preference keys and remove them only after the new
file is durable. iOS-native background sensor state and the redacted Live
Activity payload use a separate excluded directory/file instead of
file is durable. Schema-three history blobs use deterministic SHA-256 filenames
instead of reversible base64 storage keys. Startup atomically renames
schema-two blobs, resumes mixed pre/post-rename states, and preserves both
copies while failing closed if an unexpected conflict prevents safe migration.
iOS-native background sensor state and the redacted Live Activity payload use
a separate excluded directory/file instead of
`UserDefaults`. The upgrade purges an old raw Live Activity payload before
loading native state; it migrates the target transactionally, and purges the
target even on failure so a recoverable rescan is preferred to backup exposure.
Android configuration disables backup/device transfer and excludes app domains;
final device verification remains release evidence. On iOS, the implementation
requests `NSURLIsExcludedFromBackupKey`, reads the attribute back, and fails the
restricted-store startup if it is not confirmed. Local tests exercise the
storage behavior, but physical iOS backup/restore verification is still
outstanding. These are checked-in implementation claims, not proof of platform
or store enforcement.
storage behavior. Physical app-container inspection on `Shroominic` confirmed
the current restricted directory and files were backup-excluded in build 17 on
2026-08-14; a full backup/restore rehearsal remains separate evidence. These are
implementation and device-check claims, not proof of store enforcement.

The dedicated file is JSON and is not encrypted by OpenGlucose itself. It
relies on the application sandbox and operating-system at-rest protections;
Expand Down Expand Up @@ -90,10 +95,13 @@ Stable session IDs, storage keys, serials, device IDs, display names, model,
firmware, and driver IDs are omitted. The filename is neutral. Native exports
use one scoped temporary directory, delete their source file after the share
sheet completes, and remove stale OpenGlucose/share-plugin cache copies at the
next launch. Cleanup is best effort because platform share targets and operating
systems may retain copies under their own terms. Export never starts
automatically; the destination is user-controlled and its privacy and retention
terms apply.
next launch. Startup also removes the exact legacy
`openhealth_<sensor-id>_<timestamp>.csv` regular-file shape that older builds
wrote into the platform cache; near-matches, other extensions, directories,
and unrelated cache entries are left untouched. Cleanup is best effort because
platform share targets and operating systems may retain copies under their own
terms. Export never starts automatically; the destination is user-controlled
and its privacy and retention terms apply.

These files are user-readable data exports, not recovery/restore backups.
Recovery exports remain planned: they must be encrypted, versioned, integrity
Expand All @@ -102,9 +110,13 @@ checked, and restored only after an explicit preview.
## Logs, analytics, and incidents

Policy requires production logs to omit health values, sensor identity, BLE
payloads, notes, prompts/responses, API keys, and signing credentials. Current
console and in-app diagnostic paths still require a complete production/device
audit; do not treat them as redacted or safe to share. No hosted crash/analytics
payloads, notes, prompts/responses, API keys, and signing credentials. Release
startup makes its first BLE-plugin call a fail-closed request for
`flutter_blue_plus` log level `none`, before storage initialization or any BLE
operation. This suppresses the plugin's Dart and native runtime BLE logs; debug
and profile builds retain local diagnostics. Other console and in-app
diagnostic paths still require a complete production/device audit; do not treat
them as redacted or safe to share. No hosted crash/analytics
processor is approved by this baseline. Any such collection remains off until
its fields, processor, retention, consent, and deletion path receive privacy
review. Follow
Expand Down
1 change: 1 addition & 0 deletions openhealth/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import 'package:shared_preferences/shared_preferences.dart';

Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
await configurePlatformPrivacyDefaults();

FlutterError. {
if (kDebugMode) {
Expand Down
3 changes: 3 additions & 0 deletions openhealth/lib/src/driver_factory.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,7 @@ import 'driver_factory_stub.dart'
if (dart.library.io) 'driver_factory_io.dart'
as platform;

Future<void> configurePlatformPrivacyDefaults() =>
platform.configurePlatformPrivacyDefaults();

CgmDriver buildDefaultDriver() => platform.buildPlatformDriver();
9 changes: 9 additions & 0 deletions openhealth/lib/src/driver_factory_io.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,15 @@ const bool kOgDemo = bool.fromEnvironment('OG_DEMO', defaultValue: false);
/// also be switched at runtime from the Developer settings tab.
const String kOgScenario = String.fromEnvironment('OG_SCENARIO');

/// Suppresses the BLE plugin's native DEBUG default before any BLE operation.
/// Debug/profile development behavior remains available for local diagnosis;
/// distributable release builds fail closed if suppression cannot be applied.
Future<void> configurePlatformPrivacyDefaults() async {
if (kReleaseMode) {
await disableFlutterBluePlusLogs();
}
}

CgmDriver buildPlatformDriver() {
if (kOgDemo && kReleaseMode) {
throw UnsupportedError('OG_DEMO is disabled in release builds.');
Expand Down
2 changes: 2 additions & 0 deletions openhealth/lib/src/driver_factory_stub.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,7 @@ import 'mock_scenarios.dart';
/// [MockScenario.activeNormal].
const String kOgScenario = String.fromEnvironment('OG_SCENARIO');

Future<void> configurePlatformPrivacyDefaults() async {}

CgmDriver buildPlatformDriver() =>
DemoCgmDriver(initialScenario: MockScenario.fromId(kOgScenario));
Loading
0