Release 3.6.1: admin auth hardening, API 21 compat, release docs - #3
Open
SmokeSlate wants to merge 1 commit into
Open
Release 3.6.1: admin auth hardening, API 21 compat, release docs#3SmokeSlate wants to merge 1 commit into
SmokeSlate wants to merge 1 commit into
Conversation
Backend (Cloudflare Worker): - Remove the hardcoded ADMIN_HASH constant. Admin auth now requires the ADMIN_PASSWORD_HASH and ADMIN_SESSION_SECRET secrets and fails closed (503) when either is missing or malformed. - Replace the "cookie value equals password hash" scheme with expiring HMAC-SHA256 signed session tokens, scoped to Path=/admin and served no-store. Password comparison is constant-time. - Add node --test coverage for session issuance, tampered-session rejection, and fail-closed behaviour, plus an `npm run check` gate. - Pin wrangler to 4.118.0. Android app: - Add ProcessCompat helpers so process liveness, timed waits, and termination work on the declared minSdk 21 (Process.isAlive, waitFor(timeout), and destroyForcibly are all API 26+). - Guard ConnectivityManager.activeNetwork (API 23+) in AdbManager and DiagnosticsCollector with pre-M fallbacks. - Guard ACTION_MANAGE_UNKNOWN_APP_SOURCES (API 26+) in HomeActivity. - Replace deprecated Resources.getColor with ContextCompat.getColor. - Annotate the ADB-granted protected permissions in the manifest. Docs and hygiene: - Document the required Worker secrets in wrangler.toml and AGENTS.md, and correct the now-stale route table, admin-auth and AI-endpoint sections. - Ignore wrangler local state, dry-run output, and tooling scratch. Verified: assembleRelease + assembleDebug succeed, lintRelease reports 0 errors, and `npm run check` passes (3/3 tests, worker dry-run clean). Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Gets v3.6.1 (versionCode 44) ready to ship.
The Worker no longer contains a hardcoded admin password hash.
/adminreturns 503 until both secrets are set:OPENROUTER_API_KEYstays optional (only/diagnoseand/followupneed it). Set these before deploying, or admin access breaks.api/README.mdhas a PowerShell snippet that generates both safely.Note: the old hash constant remains in git history, so treat that password as burned and pick a new one.
Backend — admin auth hardening
ADMIN_HASH; config now comes from secrets and fails closed when missing or malformed.{expiresAt}.{uuid}.{sig}), scopedPath=/admin, servedno-store.Android — minSdk 21 correctness
build.gradledeclaresminSdk 21, but several APIs in use are newer. On a real API 21–25 device these would have thrownNoSuchMethodErrorat runtime:Process.isAlive/waitFor(timeout)/destroyForciblyare API 26+ — addedProcessCompat.ktwith polling equivalents.ConnectivityManager.activeNetworkis API 23+ — added pre-M fallbacks inAdbManagerandDiagnosticsCollector.ACTION_MANAGE_UNKNOWN_APP_SOURCESis API 26+ — now guarded, falling back to security settings.Resources.getColorforContextCompat.getColor.Docs
Documented the required secrets, and corrected AGENTS.md sections that had drifted from the code: the route table (routes are path-style now, plus
/diagnose,/followup,/admin/logout,/admin/bulk-delete), the admin-auth description, and the AI section (/aifixuses Pollinations;/diagnoseuses OpenRouter).Also ignored wrangler local state, dry-run output, and tooling scratch dirs that were sitting untracked.
Verification
assembleRelease+assembleDebuglintReleasenpm run check(syntax + tests + dry-run)New tests cover session issuance without leaking the hash, tampered-session rejection, and fail-closed-when-unconfigured.
Committed APK artifacts were rebuilt so they match the final source.
🤖 Generated with Claude Code