Skip to content

Harden peer metadata validation - #45

Open
vikranthreddimasu wants to merge 4 commits into
masterfrom
harden-hw-profile-validation
Open

vikranthreddimasu wants to merge 4 commits into
masterfrom
harden-hw-profile-validation

Conversation

@vikranthreddimasu

Copy link
Copy Markdown
Owner

Summary of improvements

  • Validates signed hardware-profile handshake JSON before constructing HardwareExchange.
  • Bounds and sanitizes mDNS network topology advertisements.
  • Rejects invalid discovered-node ports and non-finite/negative open-mode compute scores.
  • Preserves explicit zero topology metrics while rejecting boolean telemetry.

Security changes

  • Authenticated handshake peers can no longer send wrong-typed or out-of-range hardware fields that poison scheduler/election inputs after HMAC verification.
  • mDNS-discovered peer metadata now rejects invalid ports and non-finite scores before entering discovery caches.
  • No credentials, tokens, or secret files added; diff-only secret scan returned no matches.

Usability changes

  • Malformed peer advertisements fail early and deterministically instead of surfacing later as bad routing/scoring behavior.
  • Topology parsing still ignores unknown fields for forward compatibility.

Tests/checks run

  • python -m pytest tests/test_security/test_hw_exchange.py -q (red first: 17 failures, then 41 passed)
  • python -m pytest tests/test_pool/test_topology.py -q (red first for new cases, then 16 passed)
  • python -m pytest tests/test_security/test_fleet_discovery.py -q (red first: 7 failures, then 24 passed)
  • python -m pytest tests/test_security/test_hw_exchange.py tests/test_fuzz/test_fuzz_hw_exchange.py -q (51 passed)
  • python -m pytest tests/test_pool/test_topology.py tests/test_pool/test_network.py tests/test_pool/test_registry.py -q (37 passed)
  • python -m pytest tests/test_security/test_fleet_discovery.py tests/test_pool/test_peer_removed.py tests/test_pool/test_registry.py -q (37 passed)
  • make lint (ruff passed; mypy passed with existing quantize.py note)
  • python -m pytest tests/ -q (1021 passed, 2 expected deprecation warnings)
  • git diff --check master...HEAD
  • Diff-only secret scan with rg

Commit list

  • d6520f6 Harden hardware profile handshake validation
  • 805dfd8 Bound network topology advertisements
  • b7ddf26 Validate discovered node metadata
  • 9dedd56 Preserve zero topology metrics

Risks or manual review notes

  • Manual review recommended before merge because this touches authenticated handshake and discovery metadata validation paths.
  • Compatibility note: invalid advertised data_port/port records now reject instead of being cached.

Whether the PR was merged

  • Not merged by automation; left open for manual review due to security-sensitive handshake/discovery changes.

This branch has not been deployed

No deployments
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