Skip to content

Provider-covered endpoints cannot be extended through agent policy proposals #2921

Closed

Description

@zredlined

User Story

As an OpenShell policy reviewer, I need an agent's incremental policy proposal to reach normal review when it extends access to an endpoint already covered by a provider, so that provider defaults remain a baseline rather than a ceiling.

Problem Statement

With Providers v2 enabled and the built-in GitHub provider attached, an agent proposal for write access to api.github.com:443 is rejected before a draft is created. The provider contributes a read-oriented rule for the same endpoint, and candidate validation reports an overlapping-rule conflict because the rules differ on advisor_proposed metadata.

Removing an equivalent GitHub read rule from the sandbox's base policy does not help: the provider rule alone is enough to conflict with the proposed rule. The proposal therefore never reaches the configured manual reviewer.

Impact / Why This Matters

  • Agents cannot request incremental access on an endpoint supplied by an attached provider.
  • Provider defaults become a de facto ceiling for that host, even though provider and user policy layers are intended to compose.
  • Reviewers never see the proposal, so a policy decision is replaced by a candidate-validation failure.

Acceptance Criteria

  • An agent proposal may add narrower or broader access to a provider-covered host without conflicting solely because advisor_proposed differs.
  • The proposal reaches the normal pending-review flow when the composed candidate is otherwise valid.
  • Provider-owned policy remains immutable; approval changes only the sandbox/user policy layer.
  • An integration test covers a provider read rule and an agent write proposal for the same host.

Reproduction Steps

  1. Enable Providers v2, agent policy proposals, and manual proposal approval.
  2. Create a sandbox and attach the built-in GitHub provider.
  3. From the sandbox, submit a proposal for api.github.com:443 that allows PUT /repos/<owner>/<repo>/contents/<path> for /usr/bin/gh.
  4. Observe that no pending draft is created and the proposal is rejected during candidate validation.

Environment

  • OpenShell: 0.0.112-dev.5+g679fe4c3 (679fe4c334f0c62a653b004fae7008a631bf7f22)
  • Also observed on gateway commit d9d38a561944dd041342c004dbfe6ff5b3c8d8de
  • OpenShell SDK: 0.0.106
  • Linux ARM64 under Docker

Logs

network endpoint ambiguity validation failed
overlapping rules for api.github.com:443 have conflicting metadata:
advisor_proposed=false vs advisor_proposed=true

Related design context: provider policies supply defaults that compose with user policy (#734 and discussion #865).

Activity

  1. johntmyers commented on Aug 25, 2026

    @johntmyers
    Collaborator

    🏗️ build-plan

    Implementation Plan

    Issue type: fix
    Complexity: Medium
    Confidence: High — the failing path is reproduced from current code and the minimal validator fix is clear.

    Summary

    policy.local agent-authored proposals arrive with advisor_proposed=true on endpoints and the deprecated binary provenance bit set. Provider-composed endpoints use the same host and port with advisor_proposed=false, and candidate validation currently treats that provenance bit as overlapping endpoint metadata, so the proposal is rejected before review. I will treat advisor_proposed as provenance instead of endpoint-contract metadata, add a regression that uses the real policy.local-shaped input against a provider-covered host, and tighten the surrounding provenance semantics and docs where the current behavior is unclear.

    Scope

    • crates/openshell-policy/src/ambiguity.rs: stop reporting endpoint ambiguity solely because advisor_proposed differs; add unit coverage for overlapping endpoints that differ only by advisor provenance.
    • crates/openshell-policy/src/merge.rs: verify and, if needed, align endpoint merge/coverage behavior so explicit endpoint provenance dominates advisor overlays without breaking /wait convergence or the SSRF two-step flow.
    • crates/openshell-server/src/grpc/policy.rs: add an integration regression for a provider read rule plus a policy.local-shaped agent write proposal on the same host, and verify approval mutates only the sandbox/user policy layer.
    • docs/sandboxes/policy-advisor.mdx and architecture/gateway.md: clarify advisor_proposed semantics for endpoint overlap, exact-host SSRF trust, and binary identity.

    Implementation Steps

    1. Remove advisor_proposed from endpoint ambiguity conflict detection and add focused policy-layer tests for compatible overlap.
    2. Audit endpoint merge and coverage semantics for mixed explicit/proposed provenance; implement the minimal fix only if current behavior can block approval, /wait, or exact-host trust unexpectedly.
    3. Add server-side regression coverage for Providers v2 composition using the actual policy.local proposal shape (advisor_proposed=true endpoint, proposal binary provenance set) and assert the proposal reaches pending review instead of failing preflight.
    4. Extend the regression through approval to confirm provider-owned policy remains immutable and only the user/base policy changes.
    5. Update policy-advisor and gateway docs to explain the true/false provenance semantics clearly for reviewers and policy authors.

    Test Plan

    • Unit tests: crates/openshell-policy/src/ambiguity.rs and crates/openshell-policy/src/merge.rs for overlap, provenance merge, and coverage behavior.
    • Integration tests: crates/openshell-server/src/grpc/policy.rs for provider-composed effective policy plus agent-authored proposal submission and approval.
    • E2E tests: N/A unless the implementation requires changes under e2e/; the server integration path should cover the acceptance criteria directly.

    Risks & Open Questions

    • If endpoint merge semantics currently OR advisor provenance, preserving explicit provenance may also require a matching coverage adjustment so /wait still reports the approved proposal as loaded.
    • The SSRF boundary must stay intact: advisor-only endpoints and binaries must not start satisfying exact-host trust merely because provider or user policy already covers the same host.
    • This issue has no normal lifecycle labels (state:validated, state:accepted or roadmap, agent:implementation-requested). Those labels are expected in the queued workflow, but this direct request authorizes implementation, so I am continuing without changing labels.

    Documentation Impact

    • Update the published policy-advisor docs to spell out provenance behavior for reviewers and agents.
    • Update the gateway architecture doc where provider-composed policy and policy-local provenance are described.
    • No gateway TOML or driver config docs are expected.

    Gateway Config Impact

    None expected.

    LSM Compatibility

    None expected. This change stays in policy merge, validation, and docs paths; it does not alter /proc binary identity collection, process execution, or SELinux/AppArmor-sensitive host inspection.


    Revision 1 — initial plan

  2. johntmyers commented on Aug 25, 2026

    @johntmyers
    Collaborator

    🏗️ build-from-issue-agent

    Implementation Complete

    PR: #2935

    What was built

    Policy-advisor endpoint provenance no longer conflicts with otherwise compatible provider endpoints. Explicit endpoint and binary identity now dominate advisor provenance during merges, proposal coverage converges correctly, and the provider rule remains immutable through approval.

    Tests

    • Unit: policy ambiguity, endpoint merge order, proposal coverage, and policy.local marker coverage
    • Integration: Providers v2 plus a real policy.local-shaped GitHub write proposal through pending review and approval
    • E2E: mise run e2e:mechanistic-existing-endpoint passed against a Docker-backed gateway and sandbox

    Docs updated

    • docs/sandboxes/policy-advisor.mdx: plain examples for true/false endpoint provenance, binary identity, and SSRF exact-host trust
    • docs/sandboxes/policies.mdx: endpoint ambiguity semantics
    • architecture/security-policy.md: stable provenance and SSRF invariants

    The issue will auto-close when the PR is merged.

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

    state:acceptedA maintainer decided OpenShell should pursue this issue

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions