native-update 3.1.2 → 3.1.4
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/AI-INTEGRATION-GUIDE.md +15 -10
- package/Readme.md +35 -35
- package/android/src/main/java/com/aoneahsan/nativeupdate/LiveUpdatePlugin.kt +88 -12
- package/android/src/main/java/com/aoneahsan/nativeupdate/NativeUpdatePlugin.kt +45 -18
- package/cli/AGENTS.md +1 -1
- package/cli/CLAUDE.md +1 -1
- package/cli/commands/bundle-create.js +2 -2
- package/cli/index.js +11 -0
- package/dist/esm/definitions.d.ts +8 -0
- package/dist/esm/plugin.js +16 -2
- package/dist/plugin.cjs.js +1 -1
- package/dist/plugin.esm.js +1 -1
- package/dist/plugin.js +2 -2
- package/docs/CHANGELOG.md +90 -0
- package/docs/KNOWN_LIMITATIONS.md +2 -2
- package/docs/MIGRATION.md +1 -1
- package/ios/Plugin/LiveUpdate/LiveUpdatePlugin.swift +64 -8
- package/ios/Plugin/NativeUpdatePlugin.swift +39 -13
- package/package.json +8 -3
- package/docs/AGENTS.md +0 -47
- package/docs/APP_REVIEW_GUIDE.md +0 -768
- package/docs/BUNDLE_SIGNING.md +0 -277
- package/docs/CLAUDE.md +0 -110
- package/docs/COMPREHENSIVE_AUDIT_REPORT.md +0 -526
- package/docs/DEPLOY_NOTES.md +0 -116
- package/docs/EXAMPLE_APPS_SIMPLIFICATION_PLAN.md +0 -384
- package/docs/EXAMPLE_APPS_SIMPLIFICATION_TRACKER.md +0 -390
- package/docs/LIVE_UPDATES_GUIDE.md +0 -675
- package/docs/MANUAL-TASKS.md +0 -30
- package/docs/MARKETING_WEBSITE_TRACKER.md +0 -677
- package/docs/NATIVE_UPDATES_GUIDE.md +0 -695
- package/docs/PACKAGES.md +0 -167
- package/docs/PERFORMANCE.md +0 -110
- package/docs/PROJECT_COMPLETION_TRACKER.md +0 -411
- package/docs/QUICK_START.md +0 -595
- package/docs/README.md +0 -130
- package/docs/REMAINING_FEATURES.md +0 -192
- package/docs/ROADMAP.md +0 -295
- package/docs/SECURITY-IF-REPO-PUBLIC.md +0 -232
- package/docs/SECURITY.md +0 -356
- package/docs/TESTING_REQUIREMENTS.md +0 -201
- package/docs/ai-knowledge-base/00-project-profile.md +0 -38
- package/docs/ai-knowledge-base/01-features.md +0 -46
- package/docs/ai-knowledge-base/02-routes.md +0 -72
- package/docs/ai-knowledge-base/03-tech-stack.md +0 -57
- package/docs/ai-knowledge-base/README.md +0 -23
- package/docs/analytics-tracking.md +0 -37
- package/docs/api/API.md +0 -558
- package/docs/api/FEATURES.md +0 -414
- package/docs/api/app-review-api.md +0 -239
- package/docs/api/app-update-api.md +0 -154
- package/docs/api/background-update-api.md +0 -170
- package/docs/api/events-api.md +0 -323
- package/docs/api/live-update-api.md +0 -258
- package/docs/archive/MARKETING_WEBSITE_PLAN.md +0 -659
- package/docs/background-updates.md +0 -392
- package/docs/capacitor-official-plugins.md +0 -46
- package/docs/capawesome-plugins.md +0 -29
- package/docs/cli-reference.md +0 -321
- package/docs/deployment/HOSTINGER_DEPLOY.md +0 -370
- package/docs/deployment/PRODUCTION-DEPLOY-CHECKLIST.md +0 -184
- package/docs/docs-site/plan.md +0 -201
- package/docs/docs-site/scope.md +0 -127
- package/docs/docs-site/tracker.json +0 -235
- package/docs/error-handling-tracking.md +0 -37
- package/docs/examples/advanced-scenarios.md +0 -394
- package/docs/examples/android-manifest-example.xml +0 -77
- package/docs/examples/basic-usage.md +0 -206
- package/docs/examples/node-express-backend-example.md +0 -28
- package/docs/examples/react-capacitor-example.md +0 -29
- package/docs/features/app-reviews.md +0 -975
- package/docs/features/app-updates.md +0 -785
- package/docs/features/e2e-full-verification/00-overview.md +0 -99
- package/docs/features/e2e-full-verification/00-tracker.json +0 -284
- package/docs/features/e2e-full-verification/phase01-backend-schema-fixes.md +0 -183
- package/docs/features/e2e-full-verification/phase02-test-auth.md +0 -176
- package/docs/features/e2e-full-verification/phase03-api-test-coverage.md +0 -63
- package/docs/features/e2e-full-verification/phase04-frontend-package-contract-audit.md +0 -73
- package/docs/features/e2e-full-verification/phase05-browser-e2e-matrix.md +0 -69
- package/docs/features/e2e-full-verification/phase06-deploy-prod-smoke.md +0 -51
- package/docs/features/e2e-full-verification/results/phase01-drift-report.md +0 -50
- package/docs/features/e2e-full-verification/results/phase03-coverage-matrix.md +0 -215
- package/docs/features/e2e-full-verification/results/phase04-frontend-contract.md +0 -139
- package/docs/features/e2e-full-verification/results/phase05-e2e-results.md +0 -99
- package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-01-dashboard.png +0 -0
- package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-02-signup.png +0 -0
- package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-03-settings-persisted.png +0 -0
- package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-04a-app-created.png +0 -0
- package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-04b-duplicate-bundle-422.png +0 -0
- package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-05-plan-limit-403.png +0 -0
- package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-08a-upload-graceful-fail.png +0 -0
- package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-08b-builds-list.png +0 -0
- package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-10-rollout-25pct.png +0 -0
- package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-11-analytics.png +0 -0
- package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-12-drive-disconnected.png +0 -0
- package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-13-pricing.png +0 -0
- package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-14-isolation-403.png +0 -0
- package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-15a-admin-overview.png +0 -0
- package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-15b-regular-user-admin-redirect.png +0 -0
- package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-16a-delete-dialog.png +0 -0
- package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-17-mobile-375.png +0 -0
- package/docs/features/e2e-full-verification/results/route-list.json +0 -1
- package/docs/features/laravel-nova-backend/ASSESSMENT-SUMMARY.md +0 -96
- package/docs/features/laravel-nova-backend/IMPLEMENTATION-PLAN.md +0 -504
- package/docs/features/laravel-nova-backend/progress-tracker.json +0 -184
- package/docs/features/live-updates.md +0 -642
- package/docs/features/queues-and-emails/00-overview.md +0 -41
- package/docs/features/queues-and-emails/00-tracker.json +0 -99
- package/docs/features/queues-and-emails/phase01-foundation.md +0 -15
- package/docs/features/queues-and-emails/phase02-queued-jobs.md +0 -19
- package/docs/features/queues-and-emails/phase03-transactional-emails.md +0 -16
- package/docs/features/queues-and-emails/phase04-quota-ops.md +0 -17
- package/docs/features/queues-and-emails/phase05-async-build-processing-DECISION.md +0 -16
- package/docs/features/queues-and-emails/phase06-verify-deploy.md +0 -17
- package/docs/getting-started/configuration.md +0 -469
- package/docs/getting-started/installation.md +0 -300
- package/docs/getting-started/quick-start.md +0 -430
- package/docs/guides/BACKEND_TEMPLATES_GUIDE.md +0 -183
- package/docs/guides/admin-panel.md +0 -268
- package/docs/guides/channel-management.md +0 -343
- package/docs/guides/dashboard-guide.md +0 -365
- package/docs/guides/deployment-guide.md +0 -335
- package/docs/guides/end-to-end-workflow.md +0 -491
- package/docs/guides/key-management.md +0 -284
- package/docs/guides/migration-from-codepush.md +0 -145
- package/docs/guides/security-best-practices.md +0 -1057
- package/docs/guides/testing-guide.md +0 -346
- package/docs/guides/troubleshooting.md +0 -482
- package/docs/package-audit.md +0 -41
- package/docs/plans/PLANNING_COMPLETE_SUMMARY.md +0 -361
- package/docs/plans/TASK_1_ANDROID_EXAMPLE_APP.md +0 -401
- package/docs/plans/TASK_2_API_ENDPOINTS.md +0 -856
- package/docs/plans/TASK_2_DASHBOARD_UI_UX.md +0 -820
- package/docs/plans/TASK_2_DATABASE_SCHEMA.md +0 -704
- package/docs/plans/TASK_2_GOOGLE_DRIVE_INTEGRATION.md +0 -646
- package/docs/plans/TASK_2_SAAS_ARCHITECTURE.md +0 -587
- package/docs/plans/TASK_2_USER_AUTHENTICATION.md +0 -600
- package/docs/play-store/ASO-METADATA.md +0 -5
- package/docs/play-store/DATA-SAFETY.md +0 -5
- package/docs/play-store/DECLARATIONS.md +0 -5
- package/docs/play-store/README.md +0 -27
- package/docs/play-store/RELEASE-NOTES.md +0 -99
- package/docs/play-store/RELEASE-STEPS.md +0 -6
- package/docs/play-store/STORE-LISTING.md +0 -7
- package/docs/play-store/SUBMISSION-CHECKLIST.md +0 -5
- package/docs/production-readiness.md +0 -475
- package/docs/project-audit/2026-05-16/00-FINALIZATION-PLAN.md +0 -123
- package/docs/project-audit/2026-05-16/01-BATCH-PLAN.md +0 -227
- package/docs/project-audit/2026-05-16/02-AUDIT-FINDINGS.md +0 -144
- package/docs/project-audit/2026-05-16/sessions/batch-01.md +0 -42
- package/docs/project-audit/2026-05-16/sessions/batch-02.md +0 -74
- package/docs/project-audit/2026-05-16/sessions/batch-03.md +0 -71
- package/docs/project-audit/2026-05-16/sessions/batch-04.md +0 -88
- package/docs/project-audit/2026-05-16/sessions/batch-05.md +0 -63
- package/docs/project-audit/2026-05-16/sessions/batch-06.md +0 -103
- package/docs/project-audit/2026-05-16/sessions/batch-07.md +0 -61
- package/docs/project-audit/2026-05-16/sessions/batch-08.md +0 -101
- package/docs/project-audit/2026-05-16/sessions/batch-09.md +0 -105
- package/docs/project-audit/2026-05-16/sessions/batch-10.md +0 -102
- package/docs/project-audit/AUDIT-HISTORY.md +0 -74
- package/docs/project-audit/BATCH-PLAN.md +0 -168
- package/docs/project-audit/MARKETING-WEBSITE-FINDINGS-2026-05-11.md +0 -73
- package/docs/project-audit/PRODUCTION-READINESS-AUDIT-2026-05-08.md +0 -275
- package/docs/project-finalization/00-tracker.json +0 -60
- package/docs/project-knowledge-base/01-system-overview.md +0 -227
- package/docs/project-knowledge-base/02-routes-pages-forms-users.md +0 -352
- package/docs/project-knowledge-base/03-tech-stack-modules-services.md +0 -379
- package/docs/project-knowledge-base/04-data-models-integrations.md +0 -244
- package/docs/project-knowledge-base/05-docs-corpus-inventory.md +0 -256
- package/docs/project-knowledge-base/06-operations-testing-legal-content.md +0 -208
- package/docs/project-knowledge-base/README.md +0 -103
- package/docs/project-profiles/native-update-capacitor-update-platform-project-profile-last-updated-2026-05-19.md +0 -81
- package/docs/reports/AUDIT_SUMMARY_2025-12-26.md +0 -203
- package/docs/reports/CLAUDE-CODE-COMPLETION-PROMPT.md +0 -403
- package/docs/reports/CLAUDE_CODE_PROMPT.md +0 -29
- package/docs/reports/CODEBASE_STATUS_REPORT.md +0 -272
- package/docs/reports/COMPLETE_VERIFICATION.md +0 -106
- package/docs/reports/COMPREHENSIVE-PROJECT-AUDIT-2026-02-24.md +0 -747
- package/docs/reports/EVENT_FLOW_VERIFICATION.md +0 -80
- package/docs/reports/EXAMPLE_APPS_SIMPLIFICATION_COMPLETE.md +0 -369
- package/docs/reports/FINAL_STATUS.md +0 -122
- package/docs/reports/FINAL_VERIFICATION_CHECKLIST.md +0 -425
- package/docs/reports/MARKETING_WEBSITE_COMPLETE.md +0 -466
- package/docs/reports/PACKAGE_COMPLETENESS_REPORT.md +0 -130
- package/docs/reports/PRODUCTION_STATUS.md +0 -115
- package/docs/reports/PROJECT_RESTRUCTURE_2025-12-27.md +0 -287
- package/docs/reports/PROJECT_RESTRUCTURE_FINAL_SUMMARY.md +0 -464
- package/docs/reports/PUBLISHING_VERIFICATION.md +0 -144
- package/docs/reports/RELEASE_READY_SUMMARY.md +0 -99
- package/docs/reports/claude-completion.json +0 -241
- package/docs/rules-tracker.md +0 -102
- package/docs/security/PRE-LAUNCH-PENTEST-CHECKLIST.md +0 -116
- package/docs/security/certificate-pinning.md +0 -122
- package/docs/seo-aeo-rules.json +0 -3043
- package/docs/social-media-marketing/README.md +0 -81
- package/docs/social-media-marketing/posts-batch-01.md +0 -613
- package/docs/social-media-marketing/posts-batch-02.md +0 -528
- package/docs/social-media-marketing/whatsapp-messages-batch-01.md +0 -458
- package/docs/social-media-marketing/whatsapp-status-batch-01.md +0 -355
- package/docs/tracking/IMPLEMENTATION_TRACKER.md +0 -303
- package/docs/tracking/capacitor-rollout-note-2026-03-01.md +0 -21
- package/docs/tracking/completion-tracker-2026-02-24.json +0 -174
- package/docs/tracking/finalization-2026-05-16-tracker.json +0 -346
- package/docs/tracking/full-audit-tracker.json +0 -121
- package/docs/tracking/production-readiness-audit-tracker.json +0 -429
- package/docs/tracking/seo-checklist-tracker.json +0 -333
|
@@ -1,232 +0,0 @@
|
|
|
1
|
-
# If This Repo Ever Becomes Public — Security Runbook
|
|
2
|
-
|
|
3
|
-
**Status:** Preventive. As of 2026-05-08 the repository is **PRIVATE** by intent.
|
|
4
|
-
The root `.gitignore` explicitly opts to keep `.env` files in git so the team can
|
|
5
|
-
share secrets. If that policy ever changes — open-sourcing the SaaS, splitting
|
|
6
|
-
the dashboard into a separate public repo, accidental leak via a public mirror,
|
|
7
|
-
contractor audit, etc. — work through this runbook in order. Do **not** rely on
|
|
8
|
-
"I'll just delete the file" — git history keeps it forever unless you scrub.
|
|
9
|
-
|
|
10
|
-
> **Trigger phrases that mean "run this runbook":** "make this repo public",
|
|
11
|
-
> "open-source this", "we're forking the dashboard public", "the repo got
|
|
12
|
-
> mirrored", "GitHub flagged a leaked secret", "we leaked X".
|
|
13
|
-
|
|
14
|
-
---
|
|
15
|
-
|
|
16
|
-
## Step 0 — Stop and assess (before pushing anything)
|
|
17
|
-
|
|
18
|
-
1. Is the repo currently public on GitHub or anywhere else? Check
|
|
19
|
-
`gh repo view aoneahsan/native-update --json visibility` and search GitHub
|
|
20
|
-
+ GitLab + public mirrors for `aoneahsan/native-update`.
|
|
21
|
-
2. What is the diff between "what's checked in today" and "what should be
|
|
22
|
-
public"? Run `git ls-files | xargs grep -lE 'AIza|sk_live_|AKIA|-----BEGIN'`
|
|
23
|
-
to list files containing literal secret patterns.
|
|
24
|
-
3. List every `.env*` file currently tracked:
|
|
25
|
-
```bash
|
|
26
|
-
git ls-files | grep -E '\.env(\..+)?$|\.pem$|keystores/|keystore\.properties$|\.jks$|\.keystore$'
|
|
27
|
-
```
|
|
28
|
-
4. **Decide:** rotate-all-then-publish (safe) or scrub-history-then-publish (faster
|
|
29
|
-
but irreversible). Default: rotate-all. Pick the second only if rotation is
|
|
30
|
-
blocked (live PayPal subscriptions in flight, Google OAuth client in use by
|
|
31
|
-
real users, etc.) — and even then, rotate within the next 30 days.
|
|
32
|
-
|
|
33
|
-
---
|
|
34
|
-
|
|
35
|
-
## Step 1 — Rotate every committed secret
|
|
36
|
-
|
|
37
|
-
Treat every secret that has EVER touched git as compromised. Rotate, don't
|
|
38
|
-
re-use. Order: highest-blast-radius first.
|
|
39
|
-
|
|
40
|
-
| Secret | Where it lives | How to rotate |
|
|
41
|
-
|---|---|---|
|
|
42
|
-
| Google OAuth Client Secret | `backend/.env` `GOOGLE_CLIENT_SECRET` | Google Cloud Console → APIs & Services → Credentials → reset client secret. Update on server. Existing Sanctum bearer tokens issued by previous sign-ins keep working until they expire (`SANCTUM_TOKEN_EXPIRATION` minutes); to revoke them all now run `php artisan tinker` then `\App\Models\PersonalAccessToken::truncate()`. |
|
|
43
|
-
| Sanctum personal access tokens | `personal_access_tokens` table | Tokens themselves aren't a config secret, but if you suspect they leaked, mass-revoke: `php artisan tinker` then `\Laravel\Sanctum\PersonalAccessToken::truncate()`. Every user has to sign in again. |
|
|
44
|
-
| Laravel `APP_KEY` | `backend/.env` | `php artisan key:generate --show` → paste into the server's real `.env`. **Important:** changing APP_KEY invalidates all encrypted-cookie sessions and all `encrypted:array` columns (Google Drive OAuth tokens stored on User rows). After rotation, every connected user must reconnect Google Drive. Do this in a maintenance window. |
|
|
45
|
-
| PayPal Live Client Secret | `backend/.env` `PAYPAL_LIVE_CLIENT_SECRET` | developer.paypal.com → My Apps & Credentials → Live → app → Show/regenerate secret. Existing subscriptions keep running on the new credentials. |
|
|
46
|
-
| PayPal Webhook ID | `backend/.env` `PAYPAL_WEBHOOK_ID` | developer.paypal.com → Webhooks → delete the old endpoint, create a new one pointing at the same URL, paste the new `WH-...` id. |
|
|
47
|
-
| FilesHub API key | `backend/.env` `FILESHUB_API_KEY` | fileshub.zaions.com → Account → API keys → revoke + regenerate. Old uploads are still accessible (public URLs) but new uploads will fail until you update the server. |
|
|
48
|
-
| Database password | `backend/.env` `DB_PASSWORD` | Hostinger hPanel (or your DB host) → reset password → update on server. |
|
|
49
|
-
| Mail credentials | `backend/.env` `MAIL_*` | If real credentials are committed, rotate at the mail provider. |
|
|
50
|
-
| Android keystore + key passwords | `keystores/` or `website/android/keystore.properties` | If a keystore is committed, **the app signing identity is compromised**. You cannot rotate this without uploading a new app via Google Play's "Reset upload key" flow, which requires Play Console approval. Avoid committing keystores at all costs — `website/android/keystore.properties` is gitignored by the Batch 8 changes. |
|
|
51
|
-
| Sentry DSN, Amplitude key, Clarity ID, Google Client ID | `website/.env` | These are public-by-design (intended to ship in client JS). No rotation needed. |
|
|
52
|
-
|
|
53
|
-
**Verification after rotation:** every server still works against the new
|
|
54
|
-
secrets BEFORE you scrub history. Don't break prod chasing a clean history.
|
|
55
|
-
|
|
56
|
-
---
|
|
57
|
-
|
|
58
|
-
## Step 2 — Add patterns to `.gitignore` (BEFORE step 3)
|
|
59
|
-
|
|
60
|
-
If you scrub history without updating `.gitignore`, the next dev's `.env` will
|
|
61
|
-
get re-committed. Update `.gitignore` first:
|
|
62
|
-
|
|
63
|
-
```gitignore
|
|
64
|
-
# --- Secrets (added when repo went public on YYYY-MM-DD) -------------------
|
|
65
|
-
.env
|
|
66
|
-
.env.*
|
|
67
|
-
!.env.example
|
|
68
|
-
!.env.test.example
|
|
69
|
-
|
|
70
|
-
backend/.env
|
|
71
|
-
backend/.env.*
|
|
72
|
-
!backend/.env.example
|
|
73
|
-
|
|
74
|
-
website/.env
|
|
75
|
-
website/.env.*
|
|
76
|
-
!website/.env.example
|
|
77
|
-
|
|
78
|
-
backend/storage/oauth-private-key.pem
|
|
79
|
-
backend/storage/app.key
|
|
80
|
-
|
|
81
|
-
# Android signing material
|
|
82
|
-
android/key.properties
|
|
83
|
-
android/app/keystore/
|
|
84
|
-
keystores/
|
|
85
|
-
*.jks
|
|
86
|
-
*.keystore
|
|
87
|
-
|
|
88
|
-
# iOS signing material
|
|
89
|
-
ios/Plugin/PrivateKey.p8
|
|
90
|
-
*.p12
|
|
91
|
-
|
|
92
|
-
# RSA / ECDSA private keys for plugin bundle signing
|
|
93
|
-
*-private.pem
|
|
94
|
-
*.p8
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
Then **remove the explicit "we keep .env in git" note** from the top of
|
|
98
|
-
`.gitignore`.
|
|
99
|
-
|
|
100
|
-
Commit this change in a single, isolated commit so the history shows the policy
|
|
101
|
-
shift cleanly:
|
|
102
|
-
```bash
|
|
103
|
-
git add .gitignore
|
|
104
|
-
git commit -m "chore(security): exclude .env files in preparation for public repo"
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
---
|
|
108
|
-
|
|
109
|
-
## Step 3 — Scrub git history
|
|
110
|
-
|
|
111
|
-
Pick **one** tool. Do this on a fresh local clone, push to a new repo or
|
|
112
|
-
force-push to the same one once verified.
|
|
113
|
-
|
|
114
|
-
### Option A — `git filter-repo` (recommended)
|
|
115
|
-
|
|
116
|
-
```bash
|
|
117
|
-
# Install: https://github.com/newren/git-filter-repo
|
|
118
|
-
pip install git-filter-repo
|
|
119
|
-
|
|
120
|
-
# Fresh clone — destructive, do not work on your daily clone
|
|
121
|
-
git clone --mirror git@github.com:aoneahsan/native-update.git native-update-scrub.git
|
|
122
|
-
cd native-update-scrub.git
|
|
123
|
-
|
|
124
|
-
# Remove tracked secret files from all history
|
|
125
|
-
git filter-repo \
|
|
126
|
-
--invert-paths \
|
|
127
|
-
--path .env \
|
|
128
|
-
--path backend/.env \
|
|
129
|
-
--path website/.env \
|
|
130
|
-
--path website/android/keystore.properties
|
|
131
|
-
|
|
132
|
-
# If specific strings (a leaked AKIA key, a hardcoded Sanctum token, an
|
|
133
|
-
# OAuth client secret literal) need to be redacted:
|
|
134
|
-
echo 'sk_live_0123456789012345678901==>REDACTED' > /tmp/replace.txt
|
|
135
|
-
git filter-repo --replace-text /tmp/replace.txt
|
|
136
|
-
|
|
137
|
-
# Verify locally before pushing
|
|
138
|
-
git log --all --full-history -- .env
|
|
139
|
-
|
|
140
|
-
# Force-push the rewritten history
|
|
141
|
-
git push --force --all
|
|
142
|
-
git push --force --tags
|
|
143
|
-
```
|
|
144
|
-
|
|
145
|
-
### Option B — `bfg-repo-cleaner`
|
|
146
|
-
|
|
147
|
-
```bash
|
|
148
|
-
brew install bfg
|
|
149
|
-
git clone --mirror git@github.com:aoneahsan/native-update.git native-update-scrub.git
|
|
150
|
-
cd native-update-scrub.git
|
|
151
|
-
bfg --delete-files '.env'
|
|
152
|
-
bfg --delete-files 'keystore.properties'
|
|
153
|
-
bfg --replace-text /tmp/replace.txt
|
|
154
|
-
git reflog expire --expire=now --all && git gc --prune=now --aggressive
|
|
155
|
-
git push --force
|
|
156
|
-
```
|
|
157
|
-
|
|
158
|
-
**After force-push:**
|
|
159
|
-
- Tell every collaborator to re-clone. Their old local clones still contain the
|
|
160
|
-
secrets.
|
|
161
|
-
- GitHub caches forks + refs for ~30 days. Open a support ticket asking for a
|
|
162
|
-
cache purge if the leaked secret has not been rotated yet (it shouldn't —
|
|
163
|
-
step 1 ran first).
|
|
164
|
-
|
|
165
|
-
---
|
|
166
|
-
|
|
167
|
-
## Step 4 — Verify the public-facing tree
|
|
168
|
-
|
|
169
|
-
Before flipping repo visibility (`gh repo edit --visibility public --accept-visibility-change-consequences`):
|
|
170
|
-
|
|
171
|
-
- [ ] `git ls-files | grep -iE '\.env(\..+)?$' | grep -v example` returns
|
|
172
|
-
**empty**.
|
|
173
|
-
- [ ] `git log --all --diff-filter=A --pretty=format: --name-only | sort -u | grep -iE '\.env(\..+)?$|keystore\.properties$|\.jks$|\.keystore$|\.pem$' | grep -v example`
|
|
174
|
-
returns **empty** (after history scrub).
|
|
175
|
-
- [ ] `git ls-files | xargs grep -lE 'AIza[0-9A-Za-z_-]{35}|AKIA[0-9A-Z]{16}|sk_live_[0-9a-zA-Z]{20,}|-----BEGIN ((RSA |EC )?PRIVATE KEY|OPENSSH PRIVATE KEY)-----'`
|
|
176
|
-
returns **empty or only fake/demo strings**.
|
|
177
|
-
- [ ] `gh secret-scanning alerts list` (after pushing) shows no critical alerts.
|
|
178
|
-
- [ ] All `[REQUIRED]` secrets in `.env.example` are blank in the example file.
|
|
179
|
-
- [ ] `LICENSE` exists and matches the project license everyone expects.
|
|
180
|
-
- [ ] `SECURITY.md` exists with a security-contact email and a vulnerability
|
|
181
|
-
disclosure policy. Add one if missing.
|
|
182
|
-
- [ ] Backend `config/cors.php` `allowed_origins` is locked to production
|
|
183
|
-
domains; CORS fallback in dev does not expose anything sensitive.
|
|
184
|
-
- [ ] Backend route gates are correct: every `/api/dashboard/*` route has
|
|
185
|
-
`auth:sanctum` middleware AND a `can:<permission>` gate (see
|
|
186
|
-
`backend/routes/api.php`). `/api/admin/*` additionally has the
|
|
187
|
-
`RequireAdmin` middleware. `/api/v1/*` (device endpoints) uses
|
|
188
|
-
`ValidateApiKey`, not Sanctum.
|
|
189
|
-
- [ ] Sample data in seeders / fixtures contains no real user PII.
|
|
190
|
-
- [ ] Internal-only docs (work-history with personal context, vendor-private
|
|
191
|
-
notes) moved to a private folder NOT shipped with the public repo, OR
|
|
192
|
-
sanitized.
|
|
193
|
-
|
|
194
|
-
---
|
|
195
|
-
|
|
196
|
-
## Step 5 — Flip visibility + monitor
|
|
197
|
-
|
|
198
|
-
```bash
|
|
199
|
-
gh repo edit aoneahsan/native-update --visibility public --accept-visibility-change-consequences
|
|
200
|
-
```
|
|
201
|
-
|
|
202
|
-
Then:
|
|
203
|
-
|
|
204
|
-
- Enable **Push protection** for secrets: GitHub repo → Settings → Code
|
|
205
|
-
security → Secret scanning → Push protection → Enable.
|
|
206
|
-
- Enable **Dependency review** in PRs.
|
|
207
|
-
- Enable **Dependabot** alerts + security updates.
|
|
208
|
-
- Subscribe a security inbox to the `gh secret-scanning alerts` webhook.
|
|
209
|
-
- Watch for the next 30 days: search GitHub for the names of the rotated
|
|
210
|
-
secrets to confirm no copy is sitting in someone's fork or gist.
|
|
211
|
-
|
|
212
|
-
---
|
|
213
|
-
|
|
214
|
-
## What this runbook does NOT cover
|
|
215
|
-
|
|
216
|
-
- **License changes.** Going public may require relicensing (especially for
|
|
217
|
-
any vendored code that was MIT-OK in private but needs explicit attribution
|
|
218
|
-
in public). Run `npx license-checker --production` and audit before
|
|
219
|
-
publishing.
|
|
220
|
-
- **Trademark + branding.** "Native Update", logos, and visual assets — confirm
|
|
221
|
-
you can publish them under MIT.
|
|
222
|
-
- **GDPR / contractual obligations.** If user emails or any analytics data sit
|
|
223
|
-
in fixtures or test snapshots, scrub or anonymize before publishing.
|
|
224
|
-
- **PR access policy.** Decide upfront: do you accept public PRs? CONTRIBUTING.md
|
|
225
|
-
needs a review-ladder section.
|
|
226
|
-
|
|
227
|
-
---
|
|
228
|
-
|
|
229
|
-
**Last updated:** 2026-05-08
|
|
230
|
-
**Owner:** Ahsan Mahmood (`aoneahsan@gmail.com`)
|
|
231
|
-
**Companion:** root `.gitignore`, `backend/.env.example`, `website/.env.example`,
|
|
232
|
-
`docs/deployment/PRODUCTION-DEPLOY-CHECKLIST.md`.
|
package/docs/SECURITY.md
DELETED
|
@@ -1,356 +0,0 @@
|
|
|
1
|
-
# Security Guidelines for Capacitor Native Update Plugin
|
|
2
|
-
|
|
3
|
-
This document outlines the security measures and best practices implemented in the Capacitor Native Update plugin, following the official [Capacitor Security Guidelines](https://capacitorjs.com/docs/guides/security).
|
|
4
|
-
|
|
5
|
-
## Table of Contents
|
|
6
|
-
|
|
7
|
-
- [Security Principles](#security-principles)
|
|
8
|
-
- [Secure Update Process](#secure-update-process)
|
|
9
|
-
- [Platform-Specific Security](#platform-specific-security)
|
|
10
|
-
- [Data Protection](#data-protection)
|
|
11
|
-
- [Network Security](#network-security)
|
|
12
|
-
- [Input Validation](#input-validation)
|
|
13
|
-
- [Permission Management](#permission-management)
|
|
14
|
-
- [Security Configuration](#security-configuration)
|
|
15
|
-
- [Security Checklist](#security-checklist)
|
|
16
|
-
|
|
17
|
-
## Security Principles
|
|
18
|
-
|
|
19
|
-
### 1. No Embedded Secrets
|
|
20
|
-
|
|
21
|
-
- **Never** embed API keys, encryption keys, or certificates in the plugin code
|
|
22
|
-
- All sensitive configuration must be provided at runtime by the host application
|
|
23
|
-
- Use environment-specific configuration files that are not committed to version control
|
|
24
|
-
|
|
25
|
-
### 2. Defense in Depth
|
|
26
|
-
|
|
27
|
-
- Multiple layers of security validation
|
|
28
|
-
- Fail securely - deny by default
|
|
29
|
-
- Comprehensive error handling without exposing sensitive information
|
|
30
|
-
|
|
31
|
-
### 3. Principle of Least Privilege
|
|
32
|
-
|
|
33
|
-
- Request only necessary permissions
|
|
34
|
-
- Minimize access to system resources
|
|
35
|
-
- Isolate update processes from main application
|
|
36
|
-
|
|
37
|
-
## Secure Update Process
|
|
38
|
-
|
|
39
|
-
### Bundle Verification
|
|
40
|
-
|
|
41
|
-
```typescript
|
|
42
|
-
// Example of secure update verification
|
|
43
|
-
const verifyUpdate = async (bundle: UpdateBundle): Promise<boolean> => {
|
|
44
|
-
// 1. Verify HTTPS URL
|
|
45
|
-
if (!bundle.url.startsWith('https://')) {
|
|
46
|
-
throw new SecurityError('INSECURE_URL', 'Updates must use HTTPS');
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
// 2. Verify checksum
|
|
50
|
-
const calculatedChecksum = await calculateSHA256(bundle.data);
|
|
51
|
-
if (calculatedChecksum !== bundle.expectedChecksum) {
|
|
52
|
-
throw new SecurityError(
|
|
53
|
-
'INVALID_CHECKSUM',
|
|
54
|
-
'Bundle integrity check failed'
|
|
55
|
-
);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
// 3. Verify signature (if configured)
|
|
59
|
-
if (config.requireSignature) {
|
|
60
|
-
const isValidSignature = await verifySignature(
|
|
61
|
-
bundle.data,
|
|
62
|
-
bundle.signature,
|
|
63
|
-
publicKey
|
|
64
|
-
);
|
|
65
|
-
if (!isValidSignature) {
|
|
66
|
-
throw new SecurityError(
|
|
67
|
-
'INVALID_SIGNATURE',
|
|
68
|
-
'Bundle signature verification failed'
|
|
69
|
-
);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
return true;
|
|
74
|
-
};
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
### Version Validation
|
|
78
|
-
|
|
79
|
-
- Prevent downgrade attacks by default
|
|
80
|
-
- Semantic version comparison
|
|
81
|
-
- Minimum native version requirements
|
|
82
|
-
|
|
83
|
-
## Platform-Specific Security
|
|
84
|
-
|
|
85
|
-
### iOS Security
|
|
86
|
-
|
|
87
|
-
#### Keychain Usage
|
|
88
|
-
|
|
89
|
-
```swift
|
|
90
|
-
// Store sensitive data in Keychain, not UserDefaults
|
|
91
|
-
let keychain = KeychainWrapper()
|
|
92
|
-
keychain.set(updateKey, forKey: "UpdateEncryptionKey")
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
#### File System Security
|
|
96
|
-
|
|
97
|
-
```swift
|
|
98
|
-
// Validate file operations stay within app sandbox
|
|
99
|
-
guard let documentsPath = FileManager.default.urls(for: .documentDirectory,
|
|
100
|
-
in: .userDomainMask).first else {
|
|
101
|
-
throw UpdateError.invalidPath
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
let updatePath = documentsPath.appendingPathComponent("updates")
|
|
105
|
-
// Ensure path doesn't escape sandbox
|
|
106
|
-
guard updatePath.path.hasPrefix(documentsPath.path) else {
|
|
107
|
-
throw UpdateError.pathTraversal
|
|
108
|
-
}
|
|
109
|
-
```
|
|
110
|
-
|
|
111
|
-
### Android Security
|
|
112
|
-
|
|
113
|
-
#### Android Keystore
|
|
114
|
-
|
|
115
|
-
```kotlin
|
|
116
|
-
// Use Android Keystore for sensitive data
|
|
117
|
-
val keyAlias = "UpdateKeyAlias"
|
|
118
|
-
val keyStore = KeyStore.getInstance("AndroidKeyStore")
|
|
119
|
-
keyStore.load(null)
|
|
120
|
-
|
|
121
|
-
// Generate or retrieve key
|
|
122
|
-
if (!keyStore.containsAlias(keyAlias)) {
|
|
123
|
-
val keyGenerator = KeyGenerator.getInstance(KeyProperties.KEY_ALGORITHM_AES, "AndroidKeyStore")
|
|
124
|
-
val keyGenParameterSpec = KeyGenParameterSpec.Builder(
|
|
125
|
-
keyAlias,
|
|
126
|
-
KeyProperties.PURPOSE_ENCRYPT or KeyProperties.PURPOSE_DECRYPT
|
|
127
|
-
).build()
|
|
128
|
-
keyGenerator.init(keyGenParameterSpec)
|
|
129
|
-
keyGenerator.generateKey()
|
|
130
|
-
}
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
#### Permission Handling
|
|
134
|
-
|
|
135
|
-
```java
|
|
136
|
-
@Permission(strings = {
|
|
137
|
-
Manifest.permission.INTERNET,
|
|
138
|
-
Manifest.permission.ACCESS_NETWORK_STATE
|
|
139
|
-
}, alias = "network")
|
|
140
|
-
@Permission(strings = {
|
|
141
|
-
Manifest.permission.WRITE_EXTERNAL_STORAGE
|
|
142
|
-
}, alias = "storage")
|
|
143
|
-
public class NativeUpdatePlugin extends Plugin {
|
|
144
|
-
@PluginMethod
|
|
145
|
-
public void downloadUpdate(PluginCall call) {
|
|
146
|
-
if (!hasPermission("network")) {
|
|
147
|
-
requestPermissionForAlias("network", call, "handleNetworkPermission");
|
|
148
|
-
return;
|
|
149
|
-
}
|
|
150
|
-
// Proceed with download
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
```
|
|
154
|
-
|
|
155
|
-
## Data Protection
|
|
156
|
-
|
|
157
|
-
### Secure Storage
|
|
158
|
-
|
|
159
|
-
1. **Sensitive Data**: Store in platform-specific secure storage (Keychain/Keystore)
|
|
160
|
-
2. **Update Metadata**: Store in app-specific directories with restricted permissions
|
|
161
|
-
3. **Temporary Files**: Use system temp directories and clean up immediately
|
|
162
|
-
|
|
163
|
-
### Encryption
|
|
164
|
-
|
|
165
|
-
```typescript
|
|
166
|
-
// Example encryption configuration
|
|
167
|
-
export interface EncryptionConfig {
|
|
168
|
-
algorithm: 'AES-256-GCM';
|
|
169
|
-
keyDerivation: 'PBKDF2';
|
|
170
|
-
iterations: 100000;
|
|
171
|
-
saltLength: 32;
|
|
172
|
-
}
|
|
173
|
-
```
|
|
174
|
-
|
|
175
|
-
## Network Security
|
|
176
|
-
|
|
177
|
-
### HTTPS Enforcement
|
|
178
|
-
|
|
179
|
-
```typescript
|
|
180
|
-
// Validate URLs before making requests
|
|
181
|
-
const validateUpdateUrl = (url: string): void => {
|
|
182
|
-
const parsedUrl = new URL(url);
|
|
183
|
-
|
|
184
|
-
if (parsedUrl.protocol !== 'https:') {
|
|
185
|
-
throw new SecurityError('INSECURE_PROTOCOL', 'Only HTTPS URLs are allowed');
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
// Optional: Validate against whitelist
|
|
189
|
-
if (config.allowedHosts && !config.allowedHosts.includes(parsedUrl.host)) {
|
|
190
|
-
throw new SecurityError(
|
|
191
|
-
'UNAUTHORIZED_HOST',
|
|
192
|
-
'Update host not in whitelist'
|
|
193
|
-
);
|
|
194
|
-
}
|
|
195
|
-
};
|
|
196
|
-
```
|
|
197
|
-
|
|
198
|
-
### Certificate Pinning
|
|
199
|
-
|
|
200
|
-
```typescript
|
|
201
|
-
// Certificate pinning configuration
|
|
202
|
-
export interface CertificatePinning {
|
|
203
|
-
enabled: boolean;
|
|
204
|
-
certificates: string[]; // Base64 encoded certificates
|
|
205
|
-
includeSubdomains: boolean;
|
|
206
|
-
maxAge: number; // Seconds
|
|
207
|
-
}
|
|
208
|
-
```
|
|
209
|
-
|
|
210
|
-
## Input Validation
|
|
211
|
-
|
|
212
|
-
### JavaScript to Native Bridge
|
|
213
|
-
|
|
214
|
-
```typescript
|
|
215
|
-
// Validate all inputs from JavaScript
|
|
216
|
-
const validateUpdateOptions = (options: any): UpdateOptions => {
|
|
217
|
-
// Type validation
|
|
218
|
-
if (typeof options !== 'object' || options === null) {
|
|
219
|
-
throw new ValidationError('Invalid options object');
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
// URL validation
|
|
223
|
-
if (typeof options.url !== 'string' || !options.url) {
|
|
224
|
-
throw new ValidationError('URL must be a non-empty string');
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
// Version validation
|
|
228
|
-
if (options.version && !isValidSemver(options.version)) {
|
|
229
|
-
throw new ValidationError('Invalid version format');
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
// File size validation
|
|
233
|
-
if (
|
|
234
|
-
options.maxSize &&
|
|
235
|
-
(typeof options.maxSize !== 'number' || options.maxSize <= 0)
|
|
236
|
-
) {
|
|
237
|
-
throw new ValidationError('maxSize must be a positive number');
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
return options as UpdateOptions;
|
|
241
|
-
};
|
|
242
|
-
```
|
|
243
|
-
|
|
244
|
-
### Path Validation
|
|
245
|
-
|
|
246
|
-
```typescript
|
|
247
|
-
// Prevent directory traversal attacks
|
|
248
|
-
const sanitizePath = (path: string): string => {
|
|
249
|
-
// Remove any path traversal attempts
|
|
250
|
-
const cleaned = path.replace(/\.\./g, '').replace(/\/\//g, '/');
|
|
251
|
-
|
|
252
|
-
// Ensure path is within allowed directory
|
|
253
|
-
if (!cleaned.startsWith(ALLOWED_UPDATE_PATH)) {
|
|
254
|
-
throw new SecurityError('PATH_TRAVERSAL', 'Invalid update path');
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
return cleaned;
|
|
258
|
-
};
|
|
259
|
-
```
|
|
260
|
-
|
|
261
|
-
## Permission Management
|
|
262
|
-
|
|
263
|
-
### Android Permissions
|
|
264
|
-
|
|
265
|
-
```xml
|
|
266
|
-
<!-- AndroidManifest.xml -->
|
|
267
|
-
<uses-permission android:name="android.permission.INTERNET" />
|
|
268
|
-
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
|
269
|
-
<!-- Request at runtime for Android 6.0+ -->
|
|
270
|
-
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
|
|
271
|
-
android:maxSdkVersion="28" />
|
|
272
|
-
```
|
|
273
|
-
|
|
274
|
-
### iOS Permissions
|
|
275
|
-
|
|
276
|
-
```xml
|
|
277
|
-
<!-- Info.plist -->
|
|
278
|
-
<key>NSAppTransportSecurity</key>
|
|
279
|
-
<dict>
|
|
280
|
-
<!-- Only allow HTTPS connections -->
|
|
281
|
-
<key>NSAllowsArbitraryLoads</key>
|
|
282
|
-
<false/>
|
|
283
|
-
</dict>
|
|
284
|
-
```
|
|
285
|
-
|
|
286
|
-
## Security Configuration
|
|
287
|
-
|
|
288
|
-
### Recommended Configuration
|
|
289
|
-
|
|
290
|
-
```typescript
|
|
291
|
-
const secureConfig: UpdateSecurityConfig = {
|
|
292
|
-
// Network Security
|
|
293
|
-
enforceHttps: true,
|
|
294
|
-
certificatePinning: {
|
|
295
|
-
enabled: true,
|
|
296
|
-
certificates: ['sha256/...'],
|
|
297
|
-
maxAge: 60 * 60 * 24 * 30, // 30 days
|
|
298
|
-
},
|
|
299
|
-
|
|
300
|
-
// Update Security
|
|
301
|
-
requireSignature: true,
|
|
302
|
-
allowDowngrade: false,
|
|
303
|
-
checksumAlgorithm: 'SHA-256',
|
|
304
|
-
|
|
305
|
-
// Storage Security
|
|
306
|
-
encryptStorage: true,
|
|
307
|
-
secureStorageKeys: ['updateKey', 'serverConfig'],
|
|
308
|
-
|
|
309
|
-
// Validation
|
|
310
|
-
maxBundleSize: 50 * 1024 * 1024, // 50MB
|
|
311
|
-
allowedHosts: ['updates.yourdomain.com'],
|
|
312
|
-
|
|
313
|
-
// Error Handling
|
|
314
|
-
exposeDetailedErrors: false,
|
|
315
|
-
logSecurityEvents: true,
|
|
316
|
-
};
|
|
317
|
-
```
|
|
318
|
-
|
|
319
|
-
## Security Checklist
|
|
320
|
-
|
|
321
|
-
### Development Phase
|
|
322
|
-
|
|
323
|
-
- [ ] No hardcoded secrets or keys in code
|
|
324
|
-
- [ ] All network requests use HTTPS
|
|
325
|
-
- [ ] Input validation on all public methods
|
|
326
|
-
- [ ] Proper error handling without exposing internals
|
|
327
|
-
- [ ] Secure storage for sensitive data
|
|
328
|
-
- [ ] Permission requests are minimal and justified
|
|
329
|
-
|
|
330
|
-
### Before Release
|
|
331
|
-
|
|
332
|
-
- [ ] Security audit of all native code
|
|
333
|
-
- [ ] Penetration testing of update mechanism
|
|
334
|
-
- [ ] Certificate pinning configured for production
|
|
335
|
-
- [ ] All debug logs removed from production builds
|
|
336
|
-
- [ ] Documentation of security features complete
|
|
337
|
-
- [ ] Security configuration examples provided
|
|
338
|
-
|
|
339
|
-
### Ongoing Maintenance
|
|
340
|
-
|
|
341
|
-
- [ ] Regular dependency updates
|
|
342
|
-
- [ ] Security patch monitoring
|
|
343
|
-
- [ ] Incident response plan
|
|
344
|
-
- [ ] Regular security audits
|
|
345
|
-
- [ ] User security guidance updates
|
|
346
|
-
|
|
347
|
-
## Reporting Security Issues
|
|
348
|
-
|
|
349
|
-
If you discover a security vulnerability, please email aoneahsan@gmail.com with:
|
|
350
|
-
|
|
351
|
-
- Description of the vulnerability
|
|
352
|
-
- Steps to reproduce
|
|
353
|
-
- Potential impact
|
|
354
|
-
- Suggested fix (if any)
|
|
355
|
-
|
|
356
|
-
Please do **not** file public issues for security vulnerabilities.
|