diff --git a/docs/initiatives/standalone/1190-log-upload/PLAN.md b/docs/initiatives/standalone/1190-log-upload/PLAN.md index a90bd1c1..fccad1f0 100644 --- a/docs/initiatives/standalone/1190-log-upload/PLAN.md +++ b/docs/initiatives/standalone/1190-log-upload/PLAN.md @@ -14,7 +14,7 @@ - **Why now:** users must export a log and then email or attach it. Most don't, so most bugs arrive without one. - **How:** six Epics. - A: a Cloudflare intake service. - - B: the log package and a secret redactor. + - B: the log package and a password and PIN redactor. - C: the encrypted upload and its screen. - D: an offer to send after a crash, ANR or unexpected exit. - E: your one-command pull tool. @@ -26,8 +26,8 @@ | # | Finding | Evidence | Effect | |---|---|---|---| | 1 | Logs leave the app only by Share (mobile), Save As (desktop) or download (web). | `lib/utils/log_export.dart` | The user has to email the file or attach it somewhere. That's the step that loses the log. | -| 2 | Every frame in and out is written to the log file as raw hex, with no redaction. | `BleDebugLogService.logFrame` writes `frame.map(...toRadixString(16))` for every frame; the owner's Windows log shows `TX CMD_REMOVE_CONTACT 0f 73 60 ...` | Raw frames are what diagnosis runs on (the #1028 reply race was found from them). They also carry secrets, and today's Share sends those too. | -| 3 | Frames that carry secrets exist in the protocol. | `meshcore_protocol.dart`: `cmdSendLogin` 26 (password), `cmdSetChannel` 32 and `respCodeChannelInfo` 18 (channel key), `cmdExportPrivateKey` 23, `respCodePrivateKey` 14, `cmdImportPrivateKey` 24, `cmdSetDevicePin` 37, `cmdSetFloodScopeKey` 54; Wi-Fi config sub-codes (#837); CLI text such as `password ...` | Blanking only these fields keeps the log fully useful and removes what must never leave the device. B1 confirms the full list. | +| 2 | Every frame in and out is written to the log file as raw hex, with no redaction. | `BleDebugLogService.logFrame` writes `frame.map(...toRadixString(16))` for every frame; the owner's Windows log shows `TX CMD_REMOVE_CONTACT 0f 73 60 ...` | Raw frames are what diagnosis runs on (the #1028 reply race was found from them). They also carry passwords and PINs, and today's Share sends those too. | +| 3 | Some frames carry passwords and PINs. | `meshcore_protocol.dart`: `cmdSendLogin` 26 (repeater and room password), `cmdSetDevicePin` 37; Wi-Fi config sub-codes (#837); CLI text such as `password ...`. Channel keys (`cmdSetChannel` 32, `respCodeChannelInfo` 18) also appear, and stay: they're needed for diagnosis (#1128), and the file is encrypted to the owner. The radio's private key appears in `cmdExportPrivateKey` 23, `respCodePrivateKey` 14 and `cmdImportPrivateKey` 24 (choice 4). | Blanking only passwords and PINs keeps the log fully useful. B1 confirms the full list. | | 4 | Android exit records (crash and ANR) are already captured and exported. | `AppExitInfoService.traceFiles()` used by `log_export.dart` (#906) | D can offer to send them on the next launch. | | 5 | The radio notify relay is public at `https://notify.offband.org/notify`, behind Cloudflare, with a bearer token. | `scripts/notify.py` (`DEFAULT_URL`, `Authorization: Bearer`); live since standards#476 | The intake can ping your radio with no tailnet change and nothing new on offband-prod. | | 6 | offband.app is a Cloudflare zone, and I hold a Cloudflare API token. | Pages deploys (`deploy-web.yml`); `CLOUDFLARE_API_TOKEN` | The Worker, its route and the R2 bucket can be set up through the API. Workers and R2 permissions on that token are not yet confirmed. | @@ -38,7 +38,7 @@ - A Cloudflare Worker on `logs.offband.app` and a private R2 bucket. A new private repo, `OffbandMesh/log-intake`, holds the Worker, its tests and the intake issues. - A radio ping for each upload, rate-limited so a burst becomes one ping with a count. - Retention: an upload is deleted 30 days after you have seen it (pulled it, or closed its issue), and never while unseen. Unseen uploads are re-pinged weekly. -- A redactor that blanks secret fields and keeps every frame's code, length and other bytes. It also applies to the existing Share/Save. +- A redactor that blanks passwords and PINs and keeps every frame's code, length and other bytes, channel keys included. It also applies to the existing Share/Save. - Encryption on the device with Offband's public key. HTTPS in transit on top. - The Send to Offband screen on every platform (Android, iOS, Windows, macOS, Linux, web), with a consent text, the reference code and Copy. - After a crash, an ANR, an unhandled error or an exit while in the foreground: on the next launch, the app offers Send, Not now or Don't ask again. A setting, **off by default**, sends without asking. @@ -64,12 +64,12 @@ Tasks are 3 to 4 points. Each Epic ends with a verification task and gets one PR | **A4 · Retention job:** a daily scheduled run. It deletes an upload 30 days after it was seen, and keeps it if it can't tell. Unseen uploads older than 7 days are re-pinged weekly. Tests use an injected clock. | 3 | | **A5 · Epic verification:** a live upload from curl returns a code, opens an issue and pings the radio. Oversized and junk bodies are refused. | 1 | -### Epic B: log package and secret redactor ([#1192](https://github.com/OffbandMesh/meshcore-client/issues/1192)) +### Epic B: log package and password and PIN redactor ([#1192](https://github.com/OffbandMesh/meshcore-client/issues/1192)) | Task | Pts | |---|---| -| **B1 · Secret inventory:** classify every command, response and push code in `meshcore_protocol.dart`, and every Offband sub-code, as secret-bearing (with the byte ranges) or not. A test fails when any code is unclassified, so a new command can't ship unreviewed. | 3 | -| **B2 · Redactor:** blank the secret bytes in logged frames and in CLI text (`password`, `set pin`, Wi-Fi). Everything else is kept byte for byte. Tests cover every secret code, plus unchanged frames for the rest. | 4 | +| **B1 · Inventory:** classify every command, response and push code in `meshcore_protocol.dart`, and every Offband sub-code, as carrying a password or PIN (with the byte ranges) or not. A test fails when any code is unclassified, so a new command can't ship unreviewed. | 3 | +| **B2 · Redactor:** blank password and PIN bytes in logged frames and in CLI text (`password`, `set pin`, Wi-Fi), plus the private key if choice 4 says so. Everything else, channel keys included, is kept byte for byte. Tests cover every redacted code, plus unchanged frames for the rest. | 4 | | **B3 · Package builder:** all log files, the Android exit traces and a manifest (app version, commit, platform, OS, radio firmware and caps), redacted and zipped. The existing Share/Save goes through it too. | 3 | | **B4 · Epic verification** | 1 | @@ -77,9 +77,9 @@ Tasks are 3 to 4 points. Each Epic ends with a verification task and gets one PR | Task | Pts | |---|---| -| **C1 · Encryption:** ephemeral X25519, HKDF-SHA256 and AES-256-GCM, with a format header carrying a key id, so the key can be rotated. Uses the vetted Dart `cryptography` package, not hand-built primitives. Test vectors are shared with E, so Dart output decrypts in Python. | 4 | +| **C1 · Encryption:** ephemeral X25519, HKDF-SHA256 and AES-256-GCM, with a format header carrying a key id, so the key can be rotated. The app holds only Offband's public key. Each upload makes a one-time key pair and puts its public half in the header; the owner's private key plus that half rebuilds the key, so the owner never needs anything from the user. Uses the vetted Dart `cryptography` package, not hand-built primitives. Test vectors are shared with E, so Dart output decrypts in Python. | 4 | | **C2 · Upload client:** HTTPS POST and the code it returns. Every failure (no network, refused, too big, rate-limited) stays on screen with its reason, and the package is kept for Retry. | 3 | -| **C3 · Send to Offband screen:** next to Share on both log screens. The consent text says what's included, including message text and frames with secrets removed, that only Offband can read it, and how long it's kept. There's an optional note. The result is the code with Copy. New strings are English-only, and `untranslated.json` is committed. | 4 | +| **C3 · Send to Offband screen:** next to Share on both log screens. The consent text says what's included, including message text and radio frames, with passwords and PINs removed, that only Offband can read it, and how long it's kept. There's an optional note. The result is the code with Copy. New strings are English-only, and `untranslated.json` is committed. | 4 | | **C4 · Web:** upload the in-memory log; the Worker allows CORS from offband.app and dev.offband.app only. | 2 | | **C5 · Epic verification:** a test build on Android and Windows sends, and the code matches the issue. | 1 | @@ -166,7 +166,7 @@ No branch proceeds without confirming its condition, so no fail-open grant is ne - Send to Offband on Android, iOS, Windows, macOS, Linux and web returns a code. - Each upload opens one intake issue and pings your radio. Bursts are batched. -- `offband_logs.py pull ` leaves a decrypted, unpacked log in `debug_logs/`, with every secret field blank and every other frame intact. +- `offband_logs.py pull ` leaves a decrypted, unpacked log in `debug_logs/`, with passwords and PINs blank and every other byte intact. - After a forced crash or ANR, the next launch offers to send. - An upload is gone 30 days after you've seen it, and stays while unseen. - The privacy policy, Data Safety and App Store labels say so. @@ -176,14 +176,17 @@ No branch proceeds without confirming its condition, so no fail-open grant is ne | # | Question | Option A | Option B | Rec. | Your choice | |---|---|---|---|---|---| | 1 | Where do intake issues go? | A private `OffbandMesh/log-intake` repo: user notes and device details stay private, and spam never reaches the public tracker. | The public meshcore-client repo, on board #2. | ⭐ A. You move an intake issue into meshcore-client when it becomes a bug. | | -| 2 | A frame code this build doesn't know, from newer firmware? | Blank its payload, keep code and length. Safe, loses that frame's detail. | Keep it raw. Full detail, but it might carry a secret we haven't classified. | ⭐ A. The next release classifies it. | | +| 2 | A frame code this build doesn't know, from newer firmware? | Blank its payload, keep code and length. Safe, loses that frame's detail. | Keep it raw. Full detail, but it might carry a password we haven't classified. | ⭐ A. The next release classifies it. | | | 3 | Relay token for the Worker? | A dedicated token, revocable on its own. Needs a small, governed offband-infra change on the relay. | Reuse the existing `NOTIFY_TOKEN`. Nothing changes on offband-prod, but revoking it also cuts off session pings. | ⭐ A | | +| 4 | The radio's private key, in an export or import frame? | Blank those 64 bytes and keep the rest of the frame. The key lets anyone impersonate that user's node and read their DMs, and its bytes tell a diagnosis nothing. | Keep it. The file is encrypted to you, so only you or someone with your private key could read it. | ⭐ A | | + +Owner decision 2026-11-25: channel keys are **not** redacted. Only passwords and PINs are, plus the private key if choice 4 is A. ## 10. Carried-in work | Item | Goes to | |---|---| -| Today's Share/Save sends secrets in raw frames (finding 2) | Fixed by B3: Share goes through the redactor | +| Today's Share/Save sends passwords and PINs in raw frames (findings 2 and 3) | Fixed by B3: Share goes through the redactor | | #1186 lifecycle logging (ChartreuseGate) | D1 coordinates on `lib/main.dart` | When this plan merges, each Task gets a GitHub issue under its Epic and a Citadel task, per canon.