[PR #5224] [MERGED] Fix Android APK bootstrap authentication #6679

Closed
opened 2026-10-23 04:12:40 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/5224
Author: @SpicyMarinara
Created: 8/18/2026
Status: ✅ Merged
Merged: 8/18/2026
Merged by: @SpicyMarinara

Base: staging ← Head: agent/5222-android-apk-install


📝 Commits (3)

  • 888142f Fix Android APK bootstrap authentication
  • 3513c5a Harden Android release artifact upload
  • 9113d2e Validate Android release version consistency

📊 Changes

15 files changed (+180 additions, -42 deletions)

View changed files

📝 .env.example (+2 -0)
📝 .github/workflows/build-apk.yml (+35 -9)
📝 CHANGELOG.md (+1 -0)
📝 CONTRIBUTING.md (+2 -2)
📝 README.md (+3 -3)
📝 android/README.md (+7 -5)
📝 android/app/src/main/java/com/marinara/engine/MainActivity.java (+4 -1)
📝 docs/CONFIGURATION.md (+4 -4)
📝 docs/FAQ.md (+3 -3)
📝 docs/INSTALLATION.md (+3 -2)
📝 docs/TROUBLESHOOTING.md (+7 -1)
📝 docs/UPGRADING.md (+1 -1)
📝 docs/installation/android-termux.md (+6 -6)
📝 packages/server/src/middleware/csrf-protection.ts (+12 -0)
📝 scripts/regressions/android-local-auth.regression.ts (+90 -5)

📄 Description

Linked issue

Closes #5222

Why this change

  • The released APK bootstrap auto-opened a separate browser login and exposed an installation-managed secret to the user. Android WebView could then submit the authenticated session as Origin: null, causing the general CSRF gate to reject the request before Android authentication verified its one-time proof.
  • Installers should download the APK, approve required Android and Termux system prompts, and return to the authenticated app without editing .env or supplying build/runtime secrets.

What changed

  • Keep APK-managed startup inside the Android app by disabling browser auto-open for the managed Termux launch.
  • Allow only the two device-local Android login endpoints to pass the general CSRF origin gate; they still require a one-time HMAC proof or the full 256-bit per-install secret.
  • Keep Origin: null rejected for every other unsafe API route and replace the impossible whitelist hint with actionable update guidance.
  • Publish marinara-engine-android.apk beside the versioned release asset for a stable one-click latest-download URL.
  • Align README, Android, install, FAQ, troubleshooting, configuration, upgrade, contributor, environment, and changelog documentation. Translation follow-up: #5223.

Validation

  • pnpm check passes locally
  • Container (Docker / Podman) built and ran without issue
  • Ran the app, clicked through the changes manually
  • Checked edge cases (light + dark mode, mobile viewport, empty states, error paths)
  • Above manual verification completed (describe below)
  • Read and followed CONTRIBUTING.md

Automated evidence already run during preparation:

  • pnpm check
  • pnpm regression:android-local-auth
  • request-host security regression
  • Professor Mari documentation regression
  • ./android/build-apk.sh (debug APK compiled successfully)
  • workflow YAML parsing, shell syntax checks, Prettier, and git diff --check

Manual verification notes

  • Manually verify a fresh APK-managed install on an Android device: install Termux through the APK, grant external-command permission, tap Install / Start Marinara, and confirm no browser-secret prompt or .env edit appears.
  • Manually verify the Android app reaches Marinara after Termux finishes.
  • Manually verify an intentionally opened separate localhost browser can still authenticate with the generated secret.
  • Manually verify the stable APK URL after the next tagged release uploads marinara-engine-android.apk.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed
  • Translated docs on the docs-i18n branch updated to match, or a [docs-i18n] follow-up issue opened (see CONTRIBUTING.md § Translated documentation)
  • Version/release files updated (only if this PR includes a version bump)

UI evidence (if applicable)

No UI layout change. The remaining proof is the on-device APK flow described above.

Summary by CodeRabbit

  • New Features

    • Android APK setup now automatically manages private authentication and signs users in without manual secrets or browser configuration.
    • Added stable latest-APK downloads alongside versioned release files.
    • APK launches now return users directly to the authenticated app.
  • Bug Fixes

    • Improved Android authentication and CSRF handling for opaque browser origins.
  • Documentation

    • Updated installation, upgrade, troubleshooting, FAQ, and release guidance for the streamlined Android APK experience.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/5224 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 8/18/2026 **Status:** ✅ Merged **Merged:** 8/18/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `agent/5222-android-apk-install` --- ### 📝 Commits (3) - [`888142f`](https://github.com/Pasta-Devs/Marinara-Engine/commit/888142fdac613ff64b7fb39a1f629674d05126af) Fix Android APK bootstrap authentication - [`3513c5a`](https://github.com/Pasta-Devs/Marinara-Engine/commit/3513c5a626dc537124d1199f3288947fc28e915a) Harden Android release artifact upload - [`9113d2e`](https://github.com/Pasta-Devs/Marinara-Engine/commit/9113d2ec6090e75083c47c2617909c0d9e1013d3) Validate Android release version consistency ### 📊 Changes **15 files changed** (+180 additions, -42 deletions) <details> <summary>View changed files</summary> 📝 `.env.example` (+2 -0) 📝 `.github/workflows/build-apk.yml` (+35 -9) 📝 `CHANGELOG.md` (+1 -0) 📝 `CONTRIBUTING.md` (+2 -2) 📝 `README.md` (+3 -3) 📝 `android/README.md` (+7 -5) 📝 `android/app/src/main/java/com/marinara/engine/MainActivity.java` (+4 -1) 📝 `docs/CONFIGURATION.md` (+4 -4) 📝 `docs/FAQ.md` (+3 -3) 📝 `docs/INSTALLATION.md` (+3 -2) 📝 `docs/TROUBLESHOOTING.md` (+7 -1) 📝 `docs/UPGRADING.md` (+1 -1) 📝 `docs/installation/android-termux.md` (+6 -6) 📝 `packages/server/src/middleware/csrf-protection.ts` (+12 -0) 📝 `scripts/regressions/android-local-auth.regression.ts` (+90 -5) </details> ### 📄 Description ## Linked issue Closes #5222 ## Why this change - The released APK bootstrap auto-opened a separate browser login and exposed an installation-managed secret to the user. Android WebView could then submit the authenticated session as `Origin: null`, causing the general CSRF gate to reject the request before Android authentication verified its one-time proof. - Installers should download the APK, approve required Android and Termux system prompts, and return to the authenticated app without editing `.env` or supplying build/runtime secrets. ## What changed - Keep APK-managed startup inside the Android app by disabling browser auto-open for the managed Termux launch. - Allow only the two device-local Android login endpoints to pass the general CSRF origin gate; they still require a one-time HMAC proof or the full 256-bit per-install secret. - Keep `Origin: null` rejected for every other unsafe API route and replace the impossible whitelist hint with actionable update guidance. - Publish `marinara-engine-android.apk` beside the versioned release asset for a stable one-click latest-download URL. - Align README, Android, install, FAQ, troubleshooting, configuration, upgrade, contributor, environment, and changelog documentation. Translation follow-up: #5223. ## Validation - [ ] `pnpm check` passes locally - [ ] Container (Docker / Podman) built and ran without issue - [ ] Ran the app, clicked through the changes manually - [ ] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [ ] Above manual verification completed (describe below) - [ ] Read and followed `CONTRIBUTING.md` Automated evidence already run during preparation: - `pnpm check` - `pnpm regression:android-local-auth` - request-host security regression - Professor Mari documentation regression - `./android/build-apk.sh` (debug APK compiled successfully) - workflow YAML parsing, shell syntax checks, Prettier, and `git diff --check` ### Manual verification notes - Manually verify a fresh APK-managed install on an Android device: install Termux through the APK, grant external-command permission, tap **Install / Start Marinara**, and confirm no browser-secret prompt or `.env` edit appears. - Manually verify the Android app reaches Marinara after Termux finishes. - Manually verify an intentionally opened separate localhost browser can still authenticate with the generated secret. - Manually verify the stable APK URL after the next tagged release uploads `marinara-engine-android.apk`. ## Docs and release impact - [ ] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed - [ ] Translated docs on the `docs-i18n` branch updated to match, or a `[docs-i18n]` follow-up issue opened (see CONTRIBUTING.md § Translated documentation) - [ ] Version/release files updated (only if this PR includes a version bump) ## UI evidence (if applicable) No UI layout change. The remaining proof is the on-device APK flow described above. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Android APK setup now automatically manages private authentication and signs users in without manual secrets or browser configuration. * Added stable latest-APK downloads alongside versioned release files. * APK launches now return users directly to the authenticated app. * **Bug Fixes** * Improved Android authentication and CSRF handling for opaque browser origins. * **Documentation** * Updated installation, upgrade, troubleshooting, FAQ, and release guidance for the streamlined Android APK experience. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-23 04:12:40 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#6679
No description provided.