@solutionforest/android-health-connect 0.0.0-stage → 0.3.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AndroidHealthConnect.podspec +20 -0
- package/CHANGELOG.md +211 -0
- package/LICENSE +20 -0
- package/README.md +849 -2
- package/SECURITY.md +99 -0
- package/android/build.gradle +104 -0
- package/android/src/main/AndroidManifest.xml +4 -0
- package/android/src/main/java/com/androidhealthconnect/AggregateMapper.kt +521 -0
- package/android/src/main/java/com/androidhealthconnect/AndroidHealthConnectModule.kt +637 -0
- package/android/src/main/java/com/androidhealthconnect/AndroidHealthConnectPackage.kt +31 -0
- package/android/src/main/java/com/androidhealthconnect/AvailabilitySupport.kt +149 -0
- package/android/src/main/java/com/androidhealthconnect/ChangesMapper.kt +105 -0
- package/android/src/main/java/com/androidhealthconnect/ExtendedRecordMapper.kt +665 -0
- package/android/src/main/java/com/androidhealthconnect/FeatureSupport.kt +88 -0
- package/android/src/main/java/com/androidhealthconnect/PhrMapper.kt +187 -0
- package/android/src/main/java/com/androidhealthconnect/PlannedExerciseMapper.kt +242 -0
- package/android/src/main/java/com/androidhealthconnect/RecordMapper.kt +1222 -0
- package/app.plugin.js +1 -0
- package/docs/assets/logo.jpg +0 -0
- package/ios/AndroidHealthConnect.h +5 -0
- package/ios/AndroidHealthConnect.mm +21 -0
- package/lib/module/NativeAndroidHealthConnect.js +5 -0
- package/lib/module/NativeAndroidHealthConnect.js.map +1 -0
- package/lib/module/foreground.js +117 -0
- package/lib/module/foreground.js.map +1 -0
- package/lib/module/helpers.js +280 -0
- package/lib/module/helpers.js.map +1 -0
- package/lib/module/index.js +354 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/types.js +392 -0
- package/lib/module/types.js.map +1 -0
- package/lib/module/upgrade.js +101 -0
- package/lib/module/upgrade.js.map +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/plugin/src/index.d.ts +14 -0
- package/lib/typescript/plugin/src/index.d.ts.map +1 -0
- package/lib/typescript/src/NativeAndroidHealthConnect.d.ts +95 -0
- package/lib/typescript/src/NativeAndroidHealthConnect.d.ts.map +1 -0
- package/lib/typescript/src/foreground.d.ts +43 -0
- package/lib/typescript/src/foreground.d.ts.map +1 -0
- package/lib/typescript/src/helpers.d.ts +108 -0
- package/lib/typescript/src/helpers.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +208 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/types.d.ts +1209 -0
- package/lib/typescript/src/types.d.ts.map +1 -0
- package/lib/typescript/src/upgrade.d.ts +26 -0
- package/lib/typescript/src/upgrade.d.ts.map +1 -0
- package/package.json +255 -4
- package/plugin/build/index.d.ts +13 -0
- package/plugin/build/index.js +57 -0
- package/plugin/src/index.ts +105 -0
- package/src/NativeAndroidHealthConnect.ts +133 -0
- package/src/foreground.ts +167 -0
- package/src/helpers.ts +373 -0
- package/src/index.tsx +623 -0
- package/src/types.ts +1525 -0
- package/src/upgrade.ts +155 -0
package/SECURITY.md
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# Security Policy
|
|
2
|
+
|
|
3
|
+
## Supported Versions
|
|
4
|
+
|
|
5
|
+
Security fixes are provided for the latest released line of this library.
|
|
6
|
+
|
|
7
|
+
| Version | Supported |
|
|
8
|
+
| ------- | --------- |
|
|
9
|
+
| 0.3.x | ✅ Yes |
|
|
10
|
+
| 0.2.x | ❌ No — please upgrade to 0.3.x |
|
|
11
|
+
| < 0.2 | ❌ No |
|
|
12
|
+
|
|
13
|
+
Use `checkLibraryUpdate()` or watch [GitHub Releases](https://github.com/solutionforest/AndroidHealthConnect/releases) for newer versions.
|
|
14
|
+
|
|
15
|
+
## Reporting a Vulnerability
|
|
16
|
+
|
|
17
|
+
Please **do not** open a public GitHub issue for security vulnerabilities.
|
|
18
|
+
|
|
19
|
+
### Preferred: GitHub Security Advisory
|
|
20
|
+
|
|
21
|
+
1. Go to the repository **Security** tab → **Advisories** → **Report a vulnerability**
|
|
22
|
+
or open: https://github.com/solutionforest/AndroidHealthConnect/security/advisories/new
|
|
23
|
+
2. Include:
|
|
24
|
+
- Affected package / version(s)
|
|
25
|
+
- Description of the issue and impact
|
|
26
|
+
- Steps to reproduce (PoC if available)
|
|
27
|
+
- Any suggested fix
|
|
28
|
+
|
|
29
|
+
### Alternative: Email
|
|
30
|
+
|
|
31
|
+
If you cannot use private advisories, email **jayden.chan@solutionforest.net** with the subject:
|
|
32
|
+
|
|
33
|
+
`[SECURITY] android-health-connect`
|
|
34
|
+
|
|
35
|
+
Do not attach secrets or production credentials. Redact sensitive patient/health data from any logs.
|
|
36
|
+
|
|
37
|
+
## What to Expect
|
|
38
|
+
|
|
39
|
+
| Step | Target |
|
|
40
|
+
| ---- | ------ |
|
|
41
|
+
| Initial acknowledgement | Within **3 business days** |
|
|
42
|
+
| Status update | Within **7 business days** of acknowledgement |
|
|
43
|
+
| Fix / advisory (if confirmed) | As soon as practical; timing depends on severity and complexity |
|
|
44
|
+
|
|
45
|
+
If we accept the report, we will coordinate a fix and, when appropriate, publish a GitHub Security Advisory and release notes.
|
|
46
|
+
If we decline the report, we will explain why (e.g. not reproducible, out of scope, or accepted risk).
|
|
47
|
+
|
|
48
|
+
## Scope
|
|
49
|
+
|
|
50
|
+
This project is a **React Native / Android Health Connect client library**. In scope:
|
|
51
|
+
|
|
52
|
+
- Vulnerabilities in this repository’s TypeScript, Kotlin, Expo config plugin, or CI scripts that could lead to unauthorized access, privilege escalation, or unexpected exposure of health data **through misuse of this library’s APIs**
|
|
53
|
+
- Supply-chain issues in **direct** dependencies that we can reasonably patch or pin
|
|
54
|
+
|
|
55
|
+
Out of scope (report upstream where applicable):
|
|
56
|
+
|
|
57
|
+
- Bugs in Android OS, Health Connect, React Native, Expo, or Google Play services themselves
|
|
58
|
+
- Issues that require a compromised device, rooted phone, or malicious host app with already-granted Health Connect permissions (unless the library mishandles permissions beyond the host app’s intent)
|
|
59
|
+
- Denial-of-service against third-party services
|
|
60
|
+
- Social engineering, physical attacks, or speculative reports without a concrete impact
|
|
61
|
+
|
|
62
|
+
## Security model (what this library does / does not do)
|
|
63
|
+
|
|
64
|
+
Health data access is gated by **Android Health Connect** and the **host app**:
|
|
65
|
+
|
|
66
|
+
| Layer | Responsibility |
|
|
67
|
+
| ----- | -------------- |
|
|
68
|
+
| OS / Health Connect | User consent UI, per-type permissions, on-device store, provider signature checks |
|
|
69
|
+
| This library | Thin TurboModule bridge; requests only the permissions the host app asks for; no network upload of health records |
|
|
70
|
+
| Host app | Least-privilege permission lists, UI copy, retention, any server sync / encryption beyond HC |
|
|
71
|
+
|
|
72
|
+
**Special read permissions** (declare + request only when needed):
|
|
73
|
+
|
|
74
|
+
| Permission | Purpose |
|
|
75
|
+
| ---------- | ------- |
|
|
76
|
+
| `READ_HEALTH_DATA_HISTORY` | Read older than ~30 days before first grant (check `readHealthDataHistory`) |
|
|
77
|
+
| `READ_HEALTH_DATA_IN_BACKGROUND` | Read after the app is backgrounded (check `readHealthDataInBackground`) |
|
|
78
|
+
|
|
79
|
+
This package does **not** provide root detection, certificate pinning, or anti-tamper. Those belong in the host app if required.
|
|
80
|
+
|
|
81
|
+
Use `getHealthConnectAvailability()` before enabling HC UI — devices without Google Play services (common on mainland China / some HMS phones) cannot use Health Connect.
|
|
82
|
+
|
|
83
|
+
## Security Practices
|
|
84
|
+
|
|
85
|
+
- Dependency updates via Dependabot (npm, Gradle, GitHub Actions)
|
|
86
|
+
- CI security audit job (`yarn npm audit`) on GitHub-hosted runners
|
|
87
|
+
- Scheduled CodeQL analysis on `main` and weekly
|
|
88
|
+
- Coverage / lint / typecheck / Kotlin unit-test gates on every PR
|
|
89
|
+
- Weekly version-check workflow that opens upgrade-reminder issues for maintainers
|
|
90
|
+
- Release `.tgz` ships with an SPDX SBOM and GitHub Sigstore attestations
|
|
91
|
+
(`gh attestation verify <tarball> --repo solutionforest/AndroidHealthConnect`)
|
|
92
|
+
|
|
93
|
+
## Safe Harbor
|
|
94
|
+
|
|
95
|
+
We appreciate good-faith security research. We will not pursue legal action against researchers who:
|
|
96
|
+
|
|
97
|
+
- Make a good-faith effort to avoid privacy violations, service disruption, and data destruction
|
|
98
|
+
- Report vulnerabilities promptly through the channels above
|
|
99
|
+
- Do not exploit the issue beyond what is needed to demonstrate it
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
buildscript {
|
|
2
|
+
ext.AndroidHealthConnect = [
|
|
3
|
+
kotlinVersion: "2.2.10",
|
|
4
|
+
minSdkVersion: 29,
|
|
5
|
+
compileSdkVersion: 37,
|
|
6
|
+
targetSdkVersion: 36
|
|
7
|
+
]
|
|
8
|
+
|
|
9
|
+
ext.getExtOrDefault = { prop ->
|
|
10
|
+
if (rootProject.ext.has(prop)) {
|
|
11
|
+
return rootProject.ext.get(prop)
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
return AndroidHealthConnect[prop]
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
repositories {
|
|
18
|
+
google()
|
|
19
|
+
mavenCentral()
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
dependencies {
|
|
23
|
+
classpath "com.android.tools.build:gradle:9.1.1"
|
|
24
|
+
// noinspection DifferentKotlinGradleVersion
|
|
25
|
+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${getExtOrDefault('kotlinVersion')}"
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
apply plugin: "com.android.library"
|
|
31
|
+
// AGP 9+ enables built-in Kotlin by default and registers the `kotlin` extension
|
|
32
|
+
// when `com.android.library` is applied. Applying `kotlin-android` on top fails with:
|
|
33
|
+
// Cannot add extension with name 'kotlin', as there is an extension already registered
|
|
34
|
+
// The 'org.jetbrains.kotlin.android' plugin is no longer required for Kotlin support since AGP 9.0
|
|
35
|
+
// Docs: https://developer.android.com/build/migrate-to-built-in-kotlin
|
|
36
|
+
// Only apply the legacy plugin when the host project has not registered that extension yet
|
|
37
|
+
// (AGP 8 / android.builtInKotlin=false consumers).
|
|
38
|
+
if (project.extensions.findByName("kotlin") == null) {
|
|
39
|
+
apply plugin: "kotlin-android"
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
apply plugin: "com.facebook.react"
|
|
43
|
+
|
|
44
|
+
android {
|
|
45
|
+
namespace "com.androidhealthconnect"
|
|
46
|
+
|
|
47
|
+
compileSdkVersion getExtOrDefault("compileSdkVersion")
|
|
48
|
+
|
|
49
|
+
defaultConfig {
|
|
50
|
+
minSdkVersion getExtOrDefault("minSdkVersion")
|
|
51
|
+
targetSdkVersion getExtOrDefault("targetSdkVersion")
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
buildFeatures {
|
|
55
|
+
buildConfig true
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
buildTypes {
|
|
59
|
+
release {
|
|
60
|
+
minifyEnabled false
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
lint {
|
|
65
|
+
disable "GradleCompatible"
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
compileOptions {
|
|
69
|
+
sourceCompatibility JavaVersion.VERSION_1_8
|
|
70
|
+
targetCompatibility JavaVersion.VERSION_1_8
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
testOptions {
|
|
74
|
+
unitTests {
|
|
75
|
+
includeAndroidResources = true
|
|
76
|
+
all {
|
|
77
|
+
// Explicit Maven Central for Robolectric's own android-all fetcher
|
|
78
|
+
// (separate from Gradle resolution; flaky HTTP → classMethod AssertionError).
|
|
79
|
+
systemProperty 'robolectric.dependency.repo.url', 'https://repo1.maven.org/maven2'
|
|
80
|
+
systemProperty 'robolectric.dependency.repo.id', 'central'
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// AGP 9 built-in Kotlin / kotlin-android: treat warnings as errors.
|
|
87
|
+
kotlin {
|
|
88
|
+
compilerOptions {
|
|
89
|
+
allWarningsAsErrors.set(true)
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
dependencies {
|
|
94
|
+
implementation "com.facebook.react:react-android"
|
|
95
|
+
|
|
96
|
+
// Health Connect Jetpack library
|
|
97
|
+
implementation "androidx.health.connect:connect-client:1.2.0-alpha06"
|
|
98
|
+
|
|
99
|
+
// Coroutines for async Health Connect API calls
|
|
100
|
+
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.11.0"
|
|
101
|
+
|
|
102
|
+
testImplementation "junit:junit:4.13.2"
|
|
103
|
+
testImplementation "org.robolectric:robolectric:4.16"
|
|
104
|
+
}
|