docs: update privacy mode and testing guidelines for clearnet calls

This commit is contained in:
Ivan 2026-08-14 12:12:48 -05:00
parent 359fc9021b
commit 93949be768
No known key found for this signature in database
3 changed files with 12 additions and 1 deletions

View file

@ -22,6 +22,10 @@ description: Privacy mode blocks backend outbound HTTP/HTTPS and tightens CSP. I
Call `ensure_outbound_http_allowed` at the start of every backend path that would open a clearnet socket. Map `OutboundHttpBlockedError` to HTTP 403 or a structured `{ok: false}` the UI already handles. Do not swallow it and retry.
New `httpx` / `urllib` / `aiohttp.ClientSession` code under `meshchatx/src/backend/` must call `ensure_outbound_http_allowed` or `http_url_guard` (or `MeshChat._require_outbound_http`). Do not rewrite existing translator, map tile, firmware, community-directory, or repository fetches into one mega-guard. The RNS `HTTPInterface` is mesh transport, not app clearnet.
`tests/backend/test_outbound_http_allowlist.py` fails if a new backend file opens a clearnet client without being listed in `KNOWN_CLEARNET_FETCH_FILES`. Add the file to that set only after the privacy-mode or URL guard is wired.
Config key: `privacy_mode_enabled` in `config_manager.py`. Settings copy lives under `app.privacy_mode_*` locale keys.
## What privacy mode is not
@ -35,4 +39,8 @@ Optional clearnet helpers (docs fetch, community interface lists) stay behind th
## Tests
When you add a clearnet call, add a test that enables privacy mode and asserts the call is blocked (`OutboundHttpBlockedError` or the HTTP status the route already uses). Search existing tests for `privacy_mode` and match that pattern.
When you add a clearnet call, add a test that enables privacy mode and asserts the call is blocked (`OutboundHttpBlockedError` or the HTTP status the route already uses). Search existing tests for `privacy_mode` and match that pattern. Also run:
```bash
uv run pytest tests/backend/test_outbound_http_allowlist.py -q --tb=short
```

View file

@ -51,11 +51,14 @@ Do not ship tests that only do:
- Room keys: `tests/backend/test_rrc_room_keys.py`
- EECT shared asserts: `tests/backend/eect/asserts.py`
- URL origin allowlists: `tests/electron/mainHelpers.test.js`, `android/app/src/test/java/com/meshchatx/RemoteBackendUrlTest.java`
- XSS sanitizers: `tests/frontend/sanitizerXssOracle.test.js` (shared payload list against Markdown, Nomad, Micron, KML)
- Mesh size caps: `tests/backend/test_announce_manager_extended.py`, `tests/backend/test_nomadnet_downloader.py`, `tests/backend/test_map_geo_validator.py`, `tests/backend/test_rrc_security.py`
## Commands
```bash
uv run pytest tests/backend/test_rrc_oracle_bugs.py tests/backend/test_rrc_protocol_fuzz.py -q --tb=short
pnpm exec vitest run tests/frontend/sanitizerXssOracle.test.js
task test:eect
```

Binary file not shown.