Skip to content

Slice B: group-scoped connectivity discovery matrix - #21

Open
Krishcalin wants to merge 2 commits into
mainfrom
matrix-discovery
Open

Krishcalin wants to merge 2 commits into
mainfrom
matrix-discovery

Conversation

@Krishcalin

Copy link
Copy Markdown
Owner

Slice B — Group-scoped connectivity discovery matrix

The visible AlgoSec "Matrix" capability, from docs/matrices-dr-sets-plan.md. Independent of the DR PRs (#19/#20) — it only reads TopologyService.graph(), so it can merge in any order. Base main.

What it does

Segmentation verifies declared intent; this discovers what the estate actually does, for the zones of one device group — built on the same path-walk engine, not a new one.

MatrixService.discover(group, graph):

  1. Derives the group's zones — the connected networks its devices sit on (/30 transit links and /32 loopbacks excluded).
  2. Walks every ordered zone pair and reports the path's routing + policy verdicts as they came back (capped at MAX_ZONES).

The trap it's built around

The zones are the group's; the graph is the whole estate. A group's two edges may reach each other only through a core that is not in the group — truncating the graph to the group would report that real path as unreachable. The walk crosses everything, and the response carries a scope_note saying so. test_the_walk_crosses_a_device_outside_the_group asserts exactly this (the cell's hops include the out-of-group core).

Honesty

An unrouted pair is not-routed/unreachable, never quietly reachable — the same discipline as the segmentation matrix.

API & read-only

GET /matrix/discover/{group_id} (SNAPSHOT_READ), recomputed per call, stored never (a saved "isolated" is a claim about an estate that has since changed). No device is written; SRS §8 holds.

Tests

Zone derivation + group-scoping, the crosses-outside-the-group proof, unrouted honesty, transit/loopback exclusion, and the API (200 + 404). Registered in the authorization matrix (coverage guard green).

🤖 Generated with Claude Code

Segmentation verifies declared intent; this discovers what the estate actually does,
for the zones of one device group — the AlgoSec "Matrix" view, built on the same path
engine rather than a new one.

- MatrixService.discover(group, graph): derive the group's zones (the connected
  networks its devices sit on, /30 transit links and /32 loopbacks excluded), then walk
  every ordered zone pair and report the path's routing + policy verdicts as they came
  back. Capped at MAX_ZONES so a broad group cannot fan out unboundedly.
- The zones are the group's; the graph is the WHOLE estate. This is the trap the module
  is arranged around: two edges in a group may reach each other only through a core that
  is not in the group, and truncating the graph to the group would report that real path
  as unreachable. The walk crosses everything and the response carries a scope_note
  saying so. test_the_walk_crosses_a_device_outside_the_group is that assertion.
- Honesty preserved: an unrouted pair is not-routed/unreachable, never quietly reachable.
- GET /matrix/discover/{group_id} (SNAPSHOT_READ), recomputed per call and stored never —
  a saved "isolated" is a claim about an estate that has since changed.

Tests: zone derivation and group-scoping, the crosses-outside-the-group proof, unrouted
honesty, transit/loopback exclusion, and the API (200 + 404). Endpoint registered in the
authorization matrix (coverage guard green).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…on't render as complete

Two findings in the connectivity matrix, both an empty/partial result presented as a
complete "what can reach what" answer (invariant 2, which the sibling segmentation
service already guards):

- _derive_zones silently dropped every IPv6 subnet (`if not isinstance(network,
  IPv4Network): continue`). An IPv6-only group produced an empty matrix; a dual-stack
  group had its IPv6 reachability omitted — in both cases with no caveat. It now reports
  whether any real IPv6 subnet was skipped, and discover() states it as a limitation.

- A group deriving 0 or 1 zone yields no source/destination pair, so cells=[] with no
  limitation — indistinguishable from "fully isolated / nothing to report". discover()
  now adds a limitation when fewer than two comparable zones exist, saying it is the
  absence of comparable zones rather than a clean answer.

Regression tests: a single-zone group is labelled rather than presented complete; an
IPv6 interface is flagged rather than silently dropped.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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