Skip to content

fix: skip server-side PDP when embedded Go PDP is active #27

@beonde

Description

@beonde

Problem

connect() unconditionally configures set_pip_config() with a derived PDP endpoint (Step 7), causing _evaluate_org_policy() to attempt an HTTP POST to /v1/pdp/evaluate on every ALLOW path — even when the embedded Go binary PDP is already handling policy enforcement via CAPISCIO_BUNDLE_URL.

This creates two problems:

  1. Redundant enforcement layers — the Python SDK and the Go binary both try to evaluate org policy, duplicating work
  2. Noisy warnings — when no registry server is running (e.g., local/demo setups using the embedded PDP), every ALLOW call logs PDP unavailable during org-policy check before falling through

The warning is harmless (inline badge check already passed, so fail-open is correct), but it indicates a design gap: the Python SDK shouldn't be trying to reach a server-side PDP when enforcement is already handled by the embedded Go binary.

Observed in

Demo scenario with embedded Go PDP (CAPISCIO_BUNDLE_URL set). Phase 1 and Phase 3 ALLOW calls for trusted agents all show the PDP warning.

Proposed fix

In connect.py Step 7, detect when the Go binary is the PDP (e.g., CAPISCIO_BUNDLE_URL is set in env, meaning local OPA is active) and skip set_pip_config(). The enforcement boundary should be:

  • Python SDK: badge validation (inline trust level, allowed tools)
  • Go binary: PDP evaluation (org policy via OPA)
  • Neither duplicates the other's work

Alternative: add an explicit enable_org_policy: bool = True parameter to connect() so callers can opt out when using the embedded PDP path.

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingenhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions