Skip to content

feat: debug page password in Network, web port always 8085, black snapshot cells told (2.24.0) - #277

Merged
compot-dev merged 2 commits into
v2from
feat/network-web-password
Nov 17, 2026
Merged

compot-dev merged 2 commits into
v2from
feat/network-web-password

Conversation

@compot-dev

Copy link
Copy Markdown
Collaborator

Three changes asked for together.

1. Password for the debug page (port 8085). Network gets a last field, Web page password (empty by default: the pages stay open, as before). When set, every request to port 8085 (/, /stats.json, /snapshot.jpg, /log, /report.txt, ...) needs it: HTTP Basic, any user name (curl -u :<password>), answered 401 with WWW-Authenticate: Basic realm="OpenIPC Decoder", charset="UTF-8" otherwise. The same from the local network and through the camex tunnel. The password is kept sealed with CredentialStore, like the camera URLs and the psk; the server reads it itself (WebPassword), so it holds from the first request, even before an activity starts; a stored one that cannot be opened keeps the pages locked until it is entered again. Compared in constant time (SHA-256 of both sides).

2. Web port always 8085. The Web port field of camex 3.19.0 is no longer shown: Decoder always passes --web-port 8085 (DebugServer.PORT), so nginx on the server finds the page. This needs a camex server 3.19.0 or later, by decision: older servers are not supported.

3. Black cells in the snapshot. On the SberBox (Amlogic, MesonHwc2) the screen shows two of four cells on hardware video planes (composition=DEVICE in dumpsys SurfaceFlinger), which PixelCopy and screencap read as black (99.5 % dark pixels, against 0.1-18 % for the other cells, at night too); which two is up to the device, the TV shows all four. A live cell whose copy comes out at least 98 % dark now says video on screen, this device does not let it be copied instead of being plain black, with or without labels (the page draws its own labels and cannot know).

Version 2.24.0 (versionCode 57), CHANGELOG, README (en/ru/zh-CN), docs/security.md, docs/debug.md, docs/testing.md.

Checked locally in compot/android:2026.10: testDebugUnitTest 406/406 (new: Basic parsing, any user name, wrong and missing password, locked when unreadable, base64; black-copy threshold), lintDebug no new findings. tests/e2e.sh 14/14 on API 34 and API 21 with a new check: the Linux client of the tunnel gets 401 without a password, 401 with a wrong one and 200 with the right one from the box's tunnel address; the tunnel connects with --web-port 8085 to a 3.19.0 hub. The snapshot note is checked on the SberBox after the release (a debug build would need a reinstall there, which drops its tunnel settings).

…085, black snapshot cells told (2.24.0)

- Network: Web page password (empty: open). Every request to port 8085 needs it (HTTP Basic,
  any user name), from the local network and the tunnel alike; kept sealed; a stored one that
  cannot be read keeps the pages locked. The server reads it itself, so it holds from the
  first request.
- The Web port field is gone: Decoder always gives camex 8085 (DebugServer.PORT).
- Snapshot: a live cell whose copy comes out black (a hardware video plane, two of four cells
  on the SberBox) says so instead of showing black.
- tests/e2e.sh: the debug page through the tunnel asks for the password (14 checks).
@qodo-free-for-open-source-projects

Copy link
Copy Markdown

PR Summary by Qodo

Protect the debug page, fix its tunnel port, and explain black snapshots

✨ Enhancement 🐞 Bug fix 🧪 Tests 📝 Documentation 🕐 40+ Minutes

Grey Divider

AI Description

• Add an optional sealed password that protects every debug-page request, locally and through the
 tunnel.
• Fix the camex web port at 8085 and explain live snapshot cells that cannot be copied.
• Add authentication and snapshot tests, update documentation, and release version 2.24.0.
Diagram

graph TD
  Browser(["Browser or curl"]) --> Tunnel["camex tunnel"] --> Server["Debug server"] --> Password["Web password"] --> Store["Credential store"]
  Panel["Network panel"] --> Tunnel
  Panel --> Password
  Server --> Snapshot["Snapshot renderer"]
  Browser --> Server
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Authenticate at camex nginx
  • ➕ Could centralize authentication for tunneled requests without adding HTTP parsing to the app.
  • ➖ Would leave direct local-network requests unprotected.
  • ➖ Would require server-side configuration and would not protect users before the tunnel connects.

Recommendation: Keep authentication in DebugServer so one check covers local and tunneled requests from the first request. Document the remaining limitation clearly: HTTP Basic exposes the password on an unencrypted local-network connection.

Files changed (15) +365 / -17

Enhancement (3) +182 / -2
DebugServer.javaRequire HTTP Basic authentication for debug requests +80/-2

Require HTTP Basic authentication for debug requests

• Checks the configured password before routing any request and returns a Basic-auth challenge on failure. Adds header extraction, Base64 decoding, password comparison using SHA-256 digests, and a 401 response reason.

android/app/src/main/java/com/openipc/decoder/DebugServer.java

NetworkPanel.javaConfigure the password and fix the tunnel web port +20/-0

Configure the password and fix the tunnel web port

• Replaces the visible camex web-port field with a debug-page password field. Supplies DebugServer.PORT to camex and saves the password while preserving an unreadable stored value if the field is left unchanged.

android/app/src/main/java/com/openipc/decoder/NetworkPanel.java

WebPassword.javaPersist and cache the sealed debug password +82/-0

Persist and cache the sealed debug password

• Adds password storage through CredentialStore and makes it available directly to the server before an activity starts. An unreadable stored password leaves the debug page locked until replaced.

android/app/src/main/java/com/openipc/decoder/WebPassword.java

Bug fix (1) +64 / -2
Snapshots.javaExplain nearly black copies of live cells +64/-2

Explain nearly black copies of live cells

• Samples copied frames for the 98%-dark threshold and draws an explanatory note when a live frame meets it. Preserves the cell band when labels are requested and shows the note even when they are not.

android/app/src/main/java/com/openipc/decoder/Snapshots.java

Tests (3) +91 / -2
DebugServerTest.javaTest debug-page credential handling +59/-0

Test debug-page credential handling

• Covers open-by-default behavior, missing and incorrect credentials, arbitrary user names, UTF-8 passwords, unreadable stored passwords, Base64 input, and request-header extraction.

android/app/src/test/java/com/openipc/decoder/DebugServerTest.java

SnapshotsTest.javaTest the black-copy threshold +17/-0

Test the black-copy threshold

• Checks the 98% classification boundary, representative hardware-plane and night-camera samples, and the per-pixel darkness threshold.

android/app/src/test/java/com/openipc/decoder/SnapshotsTest.java

e2e.shVerify debug authentication through the tunnel +15/-2

Verify debug authentication through the tunnel

• Adds a password to emulator settings and checks that a Linux tunnel client receives 401 without or with incorrect credentials, then 200 with the correct password.

tests/e2e.sh

Documentation (7) +26 / -9
CHANGELOG.mdRecord the 2.24.0 release +14/-0

Record the 2.24.0 release

• Documents the optional debug password, fixed port and camex server requirement, and the explanation shown for uncopiable snapshot cells.

CHANGELOG.md

README.mdUpdate English Network guidance +2/-2

Update English Network guidance

• Replaces the configurable web port with the debug-page password and explains fixed port 8085. Marks the existing dialog screenshot as showing version 2.23.0.

README.md

README.ru.mdUpdate Russian Network guidance +2/-2

Update Russian Network guidance

• Documents the password, fixed web port, and camex server requirement in Russian. Identifies the existing screenshot as version 2.23.0.

README.ru.md

README.zh-CN.mdUpdate Chinese Network guidance +2/-2

Update Chinese Network guidance

• Documents the password, fixed web port, and camex server requirement in Simplified Chinese. Identifies the existing screenshot as version 2.23.0.

README.zh-CN.md

debug.mdDocument debug authentication and snapshot notes +3/-1

Document debug authentication and snapshot notes

• Explains how to supply the Network password and why a live hardware-plane cell may display a note instead of video in a snapshot.

docs/debug.md

security.mdDocument the debug password's security boundary +2/-1

Document the debug password's security boundary

• Describes Basic authentication for local and tunneled requests, sealed storage, fail-closed behavior, and the lack of encryption for local HTTP.

docs/security.md

testing.mdUpdate the end-to-end test inventory +1/-1

Update the end-to-end test inventory

• Raises the documented check count to 14 and includes the tunneled debug-password check.

docs/testing.md

Other (1) +2 / -2
build.gradleBump the app to version 2.24.0 +2/-2

Bump the app to version 2.24.0

• Sets versionCode to 57 and versionName to 2.24.0.

android/app/build.gradle

@qodo-free-for-open-source-projects

qodo-free-for-open-source-projects Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (1) 📘 Rule violations (0) 📎 Requirement gaps (0) 🎨 UX issues (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)

Grey Divider


Remediation recommended

1. Web passwords stay plaintext on old boxes 🐞 Bug ⛨ Security
Description
WebPassword.save() writes the result of CredentialStore.seal() even when that method returns the
original password instead of ciphertext. On supported Android 5.0 and 5.1 devices, and when Keystore
setup or encryption fails on newer devices, someone able to read the app's private settings can
recover the web password despite the new documentation saying it is sealed.
Code

android/app/src/main/java/com/openipc/decoder/WebPassword.java[R73-75]

+            value = CredentialStore.create().seal(password);
+        }
+        prefs(c).edit().putString(KEY, value).apply();
Evidence
The new save path persists the return value of seal(). Keystore encryption is only attempted from
API 23 onward, while seal() returns the original value when encryption is unavailable or fails;
the app supports API 21.

android/app/src/main/java/com/openipc/decoder/WebPassword.java[68-75]
android/app/src/main/java/com/openipc/decoder/CredentialStore.java[31-53]
android/app/build.gradle[26-30]
docs/security.md[36-39]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The new web password is written in plaintext on supported devices without Android Keystore and whenever encryption fails, contrary to the stated protection.
## Fix Focus Areas
- android/app/src/main/java/com/openipc/decoder/WebPassword.java[68-80]
- android/app/src/main/java/com/openipc/decoder/CredentialStore.java[31-53]
- android/app/src/main/java/com/openipc/decoder/NetworkPanel.java[330-336]
## Recommended Fix
Require a successful encrypted result before saving a nonempty web password, and show a save error rather than silently storing plaintext. If plaintext fallback is an intentional compatibility decision, disclose the limitation explicitly wherever the new password is described as sealed.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. One failed password read locks the page until restart ✓ Resolved
Description
WebPassword.get() stores the result of read() in cached and sets loaded = true even when
CredentialStore.open returns null, and nothing ever clears that cache except save(). A Keystore
that fails once (for example early after a boot start, which CredentialStore.sealForSlot itself
treats as possible) leaves every request on port 8085 answered 401 for as long as the process runs,
even after the key works again, unless someone opens Network and types the password again.


Informational

3. An unreadable password can never be cleared ✓ Resolved
Description
When the stored password cannot be opened, show() passes the sealed value as keepWebPassword,
and WebPassword.save keeps that value whenever the field is left empty. A user who wants the page
open again (the README says empty means open) can only replace the password with a new one and can
never remove it, so the empty field in the dialog hides that the page is still locked.

4. Truly black camera pictures are called uncopyable ✓ Resolved
Description
Snapshots.render() treats a sufficiently dark live copy as an uncopiable hardware-plane frame,
suppresses the copied bitmap, and displays NOT_COPIED without checking the device or composition.
A genuinely black camera scene can meet the same 98%-dark threshold, so its snapshot attributes the
black copy to a device limitation and sends debugging toward the wrong cause.

5. Password guessing on the debug page is unlimited ✓ Resolved
Description
authorized compares the password on every request with no failed-attempt counter or delay, and the
401 reply is immediate. Once the page is reachable through the camex tunnel or nginx on the server,
anyone who can reach it can try passwords as fast as the two workers can answer, so a short password
gives little protection.

Grey Divider

Tip of the day
💡 Did you know, you can enable the Remediation agent and Qodo fixes findings in a dedicated fix PR

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

… costs a second; a black copy told neutrally (Qodo on #277)
@compot-dev

Copy link
Copy Markdown
Collaborator Author

Qodo findings, each decided:

  1. Plaintext on Android 5.x: intentional, the same as the camera URLs and the psk (no Keystore before 6.0). The docs now say so (docs/security.md, CHANGELOG, WebPassword).
  2. One failed read locks until restart: fixed. An unreadable password is read again at most every 5 s, so the page opens by itself once the Keystore works.
  3. An unreadable password cannot be cleared: fixed. Then the field's label says the stored password cannot be read and the page is locked, and a checkbox Remove the stored password: the page is open appears; an empty field alone still keeps it (no silent opening after a passing Keystore failure).
  4. A truly black picture called uncopyable: fixed. The note is neutral: black in the copy: a dark picture, or video this device does not let be copied.
  5. Unlimited guessing: fixed. A request with a wrong password is answered after 1 s (the browser's first request without credentials is not slowed down); about two guesses a second at most. The docs recommend a long password.

Rechecked: testDebugUnitTest 407/407, lintDebug no new findings, tests/e2e.sh 34 14/14.

@compot-dev
compot-dev merged commit fa17485 into v2 Nov 17, 2026
7 checks passed
@compot-dev
compot-dev deleted the feat/network-web-password branch November 17, 2026 15:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant