Skip to content

anyshift-io/sre-skills / skills/sg-deceptive-reachability-auditor

sg-deceptive-reachability-auditor

Unverified

FileKindSize
FAILURE_MODES.mdmarkdown3.4 KB
SKILL.mdskill md14.5 KB
fixtures/01-orphaned-front-internal-cidr/instances.jsonconfig1.2 KB
fixtures/01-orphaned-front-internal-cidr/meta.jsonconfig378 B
fixtures/01-orphaned-front-internal-cidr/security-groups.jsonconfig6.8 KB
fixtures/02-public-alb-no-sg-ref/instances.jsonconfig1.2 KB
fixtures/02-public-alb-no-sg-ref/meta.jsonconfig477 B
fixtures/02-public-alb-no-sg-ref/security-groups.jsonconfig7.1 KB
fixtures/03-disjoint-public-vpn-islands/instances.jsonconfig1.4 KB
fixtures/03-disjoint-public-vpn-islands/meta.jsonconfig569 B
fixtures/03-disjoint-public-vpn-islands/security-groups.jsonconfig6.8 KB
fixtures/04-broken-segment-midchain/instances.jsonconfig1.2 KB
fixtures/04-broken-segment-midchain/meta.jsonconfig541 B
fixtures/04-broken-segment-midchain/security-groups.jsonconfig6.3 KB
fixtures/05-six-hop-cdn-waf-gw-app-svc-db/instances.jsonconfig1.4 KB
fixtures/05-six-hop-cdn-waf-gw-app-svc-db/meta.jsonconfig394 B
fixtures/05-six-hop-cdn-waf-gw-app-svc-db/security-groups.jsonconfig8.0 KB
fixtures/06-compromised-ci-runner-deep/instances.jsonconfig1.6 KB
fixtures/06-compromised-ci-runner-deep/meta.jsonconfig466 B
fixtures/06-compromised-ci-runner-deep/security-groups.jsonconfig7.5 KB
fixtures/07-five-hop-ingress-mesh-broker-db/instances.jsonconfig1.2 KB
fixtures/07-five-hop-ingress-mesh-broker-db/meta.jsonconfig394 B
fixtures/07-five-hop-ingress-mesh-broker-db/security-groups.jsonconfig7.4 KB
tests/README.mdmarkdown3.1 KB
tests/_deep.pyscript3.0 KB
tests/_reach_engine.pyscript20.9 KB
tests/_replay.pyscript881 B
tests/eval/README.mdmarkdown4.3 KB
tests/eval/eval_results.jsonconfig561.5 KB
tests/eval/judge_prompt.mdmarkdown3.2 KB
tests/eval/rubric.mdmarkdown4.7 KB
tests/eval/run_eval.pyscript19.8 KB
tests/eval/scenarios.pyscript13.2 KB
tests/replay_01_orphaned_front_internal_cidr.pyscript1.9 KB
tests/replay_02_public_alb_no_sg_ref.pyscript1.9 KB
tests/replay_03_disjoint_public_vpn_islands.pyscript2.0 KB
tests/replay_04_broken_segment_midchain.pyscript2.0 KB
tests/replay_05_six_hop_cdn_waf_gw_app_svc_db.pyscript1.8 KB
tests/replay_06_compromised_ci_runner_deep.pyscript2.0 KB
tests/replay_07_five_hop_ingress_mesh_broker_db.pyscript1.8 KB

tests/_deep.py

View on GitHub
"""
Deterministic ground-truth engine for the sg-deep-lateral-auditor screening harness.

This module REUSES the already-validated reachability engine from the sibling skill
`lateral-movement-reachability-auditor` verbatim. The proven graph/BFS/articulation
logic lives in `_reach_engine.py` (a byte-for-byte copy of that skill's `tests/_reach.py`),
so ground truth here is provably the same computation. We do NOT change the engine.

The only thing this file adds is a thin alias `run_deep(fixture_dir) -> Reachability`
so the screening harness can speak its own verb while computing the identical result.
The returned object exposes the same surface the sibling engine returns:

    .findings        list[Finding]            (P1 path / B1 blast radius / H1 hub)
    .codes()         set[str]
    .top_severity    "critical"|"high"|... | None
    .clean           bool
    .boundary        list[str]
    .shortest_path   list[str]
    .reachable       list[str]   (blast radius, entry excluded)
    .edges           list[tuple[str,str]]

This screening harness is scoped ENTIRELY to the model's empirically-located WEAK
region: LONG (4-6 hop) lateral chains buried in a 10-14 SG fleet, plus deceptive /
segmented-clean fleets where a loud public exposure or a visible-but-orphaned deep
SG-ref chain must NOT be reported as a reachable path to the crown jewel. There are no
short, obvious 2-3 hop direct paths -- those the base model already aces. The "needle"
is the COMPOSITION of many ordinary single-upstream SG-to-SG edges into one long path
that only appears when the whole chain is assembled; a per-rule read never sees it.

The aggregation across the whole fleet is exactly what the engine already does: one
transitive closure over the entire SG set (every SG a node, every UserIdGroupPair an
edge), not a per-SG verdict.

Stdlib only. No external dependencies. No credentials. Python 3.10+.
"""

from __future__ import annotations

import sys
from pathlib import Path

sys.path.insert(0, str(Path(__file__).resolve().parent))

# Re-export the proven engine's public surface unchanged.
from _reach_engine import (  # noqa: E402
    Finding,
    Reachability,
    build_graph,
    load_instances,
    load_security_groups,
    run_reach,
)

__all__ = ["run_deep", "Finding", "Reachability", "build_graph", "load_instances", "load_security_groups"]


def run_deep(fixture_dir: Path) -> Reachability:
    """Run the validated reachability engine over one fleet fixture and return the
    same Reachability result shape. This is the ground-truth oracle the screening
    harness anchors its LLM judge against.

    For this estate/fleet harness the "aggregation across sub-items" is the single
    transitive closure the engine already computes over the WHOLE security-group set:
    every SG in the fleet is a node, every UserIdGroupPair an edge, and the result is
    one fleet-wide reachability verdict (the long needle path + blast radius, or
    clean), not a per-SG list. We do not re-implement that; we delegate to the proven
    engine unchanged.
    """
    return run_reach(Path(fixture_dir))
rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first.Stars: 194kUpdated Claude CodeCodexVerifiedInstall