Skip to content

chore: full review hardening — bind-IP validation, TLS e2e test, doc fixes (v2.6.2)#22

Merged
haliskilic merged 1 commit into
mainfrom
chore-full-review
Jun 11, 2026
Merged

chore: full review hardening — bind-IP validation, TLS e2e test, doc fixes (v2.6.2)#22
haliskilic merged 1 commit into
mainfrom
chore-full-review

Conversation

@haliskilic

Copy link
Copy Markdown
Owner

A full multi-dimension review of the project (engine correctness, web/security, config/runtime/packaging, design/docs/tests), then the concrete fixes it surfaced.

Review conclusion: healthy, no critical bugs

Four focused passes. The headline "critical" candidates did not hold up on verification:

  • Engine _clients iteration "races" — false. _pick_victim / _refresh_clients use synchronous comprehensions (no await mid-iteration), so in single-threaded asyncio they're atomic. No RuntimeError, no snapshot needed.
  • writer.close() without wait_closed() "leak" — not a leak; close() schedules the transport close. (Production shutdown already aborts + bounds wait_closed.)
  • "Data loss on web edit" — already prevented by _preserve_unmanaged_fields (match / RS-485 / open-close strings), and already covered by test_preserve_unmanaged_fields_on_edit.
  • control-peer "missing CSRF" — it's not in the CSRF-exempt set, so the middleware already enforces the X-CSRF-Token header on it.

Auth / RBAC / session / CSRF / SSRF-allowlist / scrypt / LDAP+OIDC escaping / CSP all reviewed as sound. Config round-trips losslessly (incl. cluster.peers, instance_id); atomic write + validation-before-save confirmed.

Fixes applied

  • config: validate admin_ui.bind_ip in AppConfig.validate() — the one genuine gap. A hand-edited bad value now fails with a clear ConfigError instead of crashing uvicorn at bind time.
  • tests: add test_tls_bridge.py — per-mapping TLS data-bridge e2e (brings up a TLS server mapping with a self-signed cert, asserts the channel is encrypted and a plaintext client is rejected). This was the top coverage gap. Plus an admin bind-IP validation case. Suite now 33 green.
  • docs: RS-485 is settable via JSON import / REST today (web-UI control is planned) — the README's "full serial config" line was slightly overstated; global all.log/audit.log are size-rotated (distinct from the per-mapping 100 MB / 15-day trim).
  • ROADMAP: records the review outcome and a refreshed backlog (cluster hardening, RS-485 UI, Modbus write/Sparkplug, and the Node-24 GitHub-Actions bump — noted as non-breaking: GitHub force-runs the current actions on Node 24 from 2026-06-16, so it's cosmetic).

Verification

ser2net --version → 2.6.2 · ruff clean · 33/33 tests pass (Linux+Windows × py3.10–3.13 in CI).

…fixes (v2.6.2)

Multi-dimension review (engine correctness, web/security, config/packaging,
design/docs/tests). Conclusion: no critical bugs — the engine's _clients reads are
race-free (synchronous comprehensions, no await mid-iteration), the auth/RBAC/CSRF/
SSRF model is sound, config round-trips losslessly, and edit-preservation already
guards match/RS-485/open-close strings. Concrete fixes:

- config: validate admin_ui.bind_ip in AppConfig.validate() (a hand-edited bad value
  now fails with a clear ConfigError instead of crashing uvicorn at bind time).
- tests: add test_tls_bridge.py — per-mapping TLS data bridge e2e (asserts the channel
  is encrypted and a plaintext client is rejected); this was the top coverage gap. Add
  an admin bind-IP validation case to test_config_validation.py. Suite is now 33 green.
- docs: clarify that RS-485 is set via JSON import / REST (no web UI yet) and that the
  global logs are size-rotated (distinct from per-mapping 100 MB/15-day trim).
- ROADMAP: record the review outcome + refreshed backlog (cluster hardening, RS-485 UI,
  Modbus write, Node-24 CI bump as a non-breaking maintenance item).
@haliskilic
haliskilic merged commit 08e2e09 into main Jun 11, 2026
18 checks passed
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