Skip to content

Untrusted HTTPS mirror and AP port scan (FR-038, FR-039) - #42

Merged
SensorsIot merged 2 commits into
mainfrom
issue-41-https-portscan
Oct 9, 2026
Merged

SensorsIot merged 2 commits into
mainfrom
issue-41-https-portscan

Conversation

@SensorsIot

Copy link
Copy Markdown
Owner

Closes #41.

What

Two security test fixtures, requested by gplug-mini-test, whose requirements could not be verified on the bench:

  • FR-038 — Untrusted HTTPS mirror. POST /api/tls-mirror/start|stop, GET /api/tls-mirror/status. Serves FIRMWARE_DIR at https://<pi>:8443/firmware/<project>/<file> with a self-signed certificate (generated once by openssl, reused; sha256 fingerprint in the reply). A correct DUT TLS client refuses it. Bench reset stops it.
  • FR-039 — AP network port scan. POST /api/net/portscan {"host", "ports"?, "timeout_s"?} → {"ok", "host", "open", "scanned", "complete", "elapsed_s"}. TCP connect only, 128 in flight, 1 s per connect, total budget 1–600 s. The target must be one address in 192.168.4.0/24 and not the Pi; anything else is a 400 before any connection.

How

  • Requirements and contracts first in docs/Harness-FSD.md (§5, Appendix D, FR-036 table, changelog).
  • New L1 modules pi/tls_mirror_controller.py, pi/netscan_controller.py; portal.py only routes and wires bench reset.
  • pytest/testbench_driver.py methods, mcp/testbench_mcp.py SPECS (bundle rebuilt), pi/install.sh (modules, openssl, /var/lib/rfc2217/tls), user manual §3 and §10.1.

Verified

  • ruff check . (0.16.1): clean. pytest pytest/host: 71 passed (new test_security_fixtures.py).
  • Local smoke test (not on a Pi): mirror serves bytes over HTTPS; a verifying client is refused; fingerprint equals the served certificate; certificate reused across restart; stop idempotent; scan on loopback reports exactly the listening port.

Not done

  • Not deployed to a bench, so the bench-tier rows of the FR-038/FR-039 contracts have not run.

🤖 Generated with Claude Code

SensorsIot and others added 2 commits October 9, 2026 09:35
Requirements and verification contracts first (issue #41): a TLS peer a DUT
must refuse, and a TCP connect check of one AP-network host. Bench reset
stops the mirror. Appendix D lists the endpoints.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Two new L1 modules, routed by portal.py:
- tls_mirror_controller: FIRMWARE_DIR served on 8443 with a self-signed
  certificate generated once by openssl and reused; start/stop/status.
- netscan_controller: TCP connect check, 128 in flight, 1 s per connect,
  bounded by a total budget. The target must be one address in the AP
  subnet and not the Pi; validation runs before any connection.

Pure cores host-tested (pytest/host/test_security_fixtures.py). Driver
methods, MCP tools (bundle rebuilt), install.sh (modules, openssl, tls dir)
and the user manual updated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@SensorsIot
SensorsIot merged commit db6a093 into main Oct 9, 2026
1 check 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.

Testbench capability request: TCP port scan and untrusted-HTTPS server on the AP network

1 participant