Skip to content

feat(cli): ipv6 egress cidr fix and deny-class property tests for sandbox policy #701

Closed

Description

@dan-petty

Context & Rationale

The policy boundary is a set of pure functions: safe_resolve_subpath, validate_no_path_traversal and validate_path_parameter (src/devops_cli/core/paths.py:16-175), the last guarding agent tool kwargs via ai/ext_langchain.py:18 and ai/agents/context.py:19; is_loopback_or_private_host (core/validation.py:81-98); and the whitelist validators and ipBlock builders behind devops sandbox network-policy (sandbox/models.py:55-215). Tests use hand-picked inputs with no IPv6 or NUL case (tests/test_consolidation_core_paths.py:128-171, tests/test_validation.py:190-216); hypothesis is not a dependency. Defects found: _resolve_public_host and _resolve_local_host append /32 to IPv6 addresses (models.py:125,149,163,185), so the docstring "strictly to validated whitelisted destinations" (models.py:190) is false; _extract_host_or_ip truncates IPv6 hosts (models.py:63-65); NUL makes safe_resolve_subpath raise ValueError past error_cls (paths.py:56); a substring .. test rejects benign names; six metadata-name checks in five modules disagree (core/validation.py:40,229, sandbox/probe.py:55, sandbox/models.py:84, telemetry/waterfall.py:127, ai/models/ollama.py:37). vibes' campaign is a fixed event table with an unread seed (lsm_gate.py:257-276); its README accepts 0.85 containment, its pattern claims 1.0.

Scope & Deliverables

  • Context & Rationale*: The policy boundary is a set of pure functions: safe_resolve_subpath, validate_no_path_traversal and validate_path_parameter (src/devops_cli/core/paths.py:16-175), the last guarding agent tool kwargs via ai/ext_langchain.py:18 and ai/agents/context.py:19; is_loopback_or_private_host (core/validation.py:81-98); and the whitelist validators and ipBlock builders behind devops sandbox network-policy (sandbox/models.py:55-215). Tests use hand-picked inputs with no IPv6 or NUL case (tests/test_consolidation_core_paths.py:128-171, tests/test_validation.py:190-216); hypothesis is not a dependency. Defects found: _resolve_public_host and _resolve_local_host append /32 to IPv6 addresses (models.py:125,149,163,185), so the docstring "strictly to validated whitelisted destinations" (models.py:190) is false; _extract_host_or_ip truncates IPv6 hosts (models.py:63-65); NUL makes safe_resolve_subpath raise ValueError past error_cls (paths.py:56); a substring .. test rejects benign names; six metadata-name checks in five modules disagree (core/validation.py:40,229, sandbox/probe.py:55, sandbox/models.py:84, telemetry/waterfall.py:127, ai/models/ollama.py:37). vibes' campaign is a fixed event table with an unread seed (lsm_gate.py:257-276); its README accepts 0.85 containment, its pattern claims 1.0.
  • Deliverable*: Three PRs. PR1, no new dependency: emit each address's full-length prefix (ipaddress.ip_network(ip).with_prefixlen) and parse bare and [addr]:port IPv6 with urllib.parse/ipaddress, with IPv6 regression tests. PR2: one metadata predicate on ollama's superset (fd00:ec2::254, bare metadata, trailing dot) at all six sites; NUL raises error_cls; a component-wise part == ".." check after one decode. PR3: add hypothesis to the dev group unless Reach Tally, Replay Gate and Hash-Seed Check for Parser Fuzzing already has, and write properties whose classes come from the oracle, not syntax: forbidden means resolving outside the base after exactly the decoding the consumer does, reaching a non-global or metadata address, or containing NUL (must raise error_cls); a benign generator must pass, so deny-everything fails; every emitted ipBlock carries its family's maximum prefix and contains the resolved address. Build addresses with st.ip_addresses(v=..., network=...) and a stubbed getaddrinfo. Service URLs stay with Structured Fuzzing of Parsers and Schema Boundaries; in-container escapes with Sandbox Enforcement Audit: Declared vs Engine vs Enforced.
  • Constraint*: The sibling task's CI profile runs explicit examples only, so these tests need a per-test @settings(phases=[Phase.explicit, Phase.generate], derandomize=True): derandomized generation is fixed per commit, not a lucky search. A property that encodes today's behaviour, such as denying %252e%252e/etc, which pathlib never decodes, passes forever and finds nothing. The metadata predicate widens what five call sites deny; test each. No floor below 1.0: a deterministic predicate that allows one forbidden input has a bug.
  • Measured*: uv run --no-sync python /tmp/claude-1000/-workspaces-devops-cli/cd5cb264-de6b-43bc-b9b0-5602359c9515/scratchpad/probe/rewrite/p.py: with getaddrinfo stubbed to one AAAA and one A record, _resolve_public_host returned 2606:4700::1/32, which covers 2**96 addresses; _extract_host_or_ip("fd00:ec2::254") returned fd00. Same run: validate_path_parameter("file_path", ...) denied notes..txt, v1..2.diff and a..b/c but allowed ~/.ssh/id_rsa and file:///etc/passwd with allow_absolute=False; safe_resolve_subpath(base, "a\x00b") raised ValueError.
  • Source*: vibes patterns/kernel-enforced-lsm-sandbox-containment.md, patterns/zero-trust-sandboxing-and-observability.md, examples/ebpf-lsm-kernel-gate/lsm_gate.py, examples/ebpf-lsm-kernel-gate/README.md, examples/ebpf-lsm-kernel-gate/test_lsm_gate.py, examples/ephemeral-container-sandbox/README.md, observations/systems/34-ebpf-lsm-kernel-gates-and-dynamic-containment-fuzzing.md

Strategic Alignment

  • Milestone: v0.2.24 (Reactive Workstation Command Center, Interactive TUI & Unified Operations Hub)
  • Roadmap Reference: docs/ROADMAP.md

Activity

  1. added this to the v0.2.24 milestone on Sep 28, 2026
  2. added
    type/feature
    scope/cli
    priority/p0-critical
    on Sep 28, 2026
  3. dan-petty commented on Oct 1, 2026

    @dan-petty
    OwnerAuthor

    Closed by #761, merged into release/v0.2.24.

    GitHub only acts on closing keywords when a pull request merges into the default branch, so this was closed by devops gh issues close-merged.

  4. added a commit that references this issue on Oct 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority/p0-criticalscope/clitype/feature

    Type

    No type

    Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions