fix: remove bogus /v1/pdp/evaluate default from PDP config#30
Conversation
The pdp_endpoint was defaulting to {server_url}/v1/pdp/evaluate which
does not exist. Policy evaluation is LOCAL: the Go core fetches the
OPA bundle via CAPISCIO_BUNDLE_URL and evaluates it with its embedded
OPA engine. The pdp_endpoint should only be set when an explicit
remote PDP service is deployed.
The bogus default caused the guard's Phase 2 org-policy check to
silently fail (404), meaning org policy overrides (lockdown, selective)
had no effect — only hardcoded @guard min_trust_level values applied.
|
✅ Integration tests passed! capiscio-core gRPC tests working. |
There was a problem hiding this comment.
Pull request overview
This PR aims to fix org-policy enforcement configuration during MCPServerIdentity.connect() by removing a previously introduced default PDP endpoint ({server_url}/v1/pdp/evaluate) that does not exist, and by documenting/logging that policy evaluation is intended to be local (via the Go core + OPA bundle) unless a remote PDP is explicitly configured.
Changes:
- Update
connect()parameter docs forpdp_endpointto describe it as an optional remote PDP URL. - Change the effective PDP endpoint default from a derived URL to an empty string.
- Adjust logging to distinguish between “remote PDP configured” vs “local OPA bundle” modes.
| Defaults to empty (local OPA bundle evaluation via Go core). | ||
| Use ``CAPISCIO_PDP_ENDPOINT`` env var or this param only when | ||
| a remote PDP service is explicitly deployed. |
| @@ -553,7 +556,10 @@ async def connect( | |||
| workspace=server_id, | |||
| ) | |||
| ) | |||
| logger.info("Org-policy enforcement enabled: pdp_endpoint=%s", effective_pdp) | |||
| if effective_pdp: | |||
| logger.info("Remote PDP configured: pdp_endpoint=%s", effective_pdp) | |||
| else: | |||
| logger.debug("Using local OPA bundle for policy evaluation") | |||
EM-OBSERVE (Go core default) is shadow-mode: logs DENY but allows through. When connect() sets CAPISCIO_BUNDLE_URL for local OPA evaluation, it now also defaults CAPISCIO_ENFORCEMENT_MODE to EM-GUARD so policy decisions are actually enforced. Callers can still override via the env var for explicit shadow-mode.
|
✅ Integration tests passed! capiscio-core gRPC tests working. |
|
Addressing the two Copilot review comments about Phase 2 being disabled when This is intentional and architecturally correct. The guard has two evaluation phases:
Before this PR, The docstring comment about "local OPA bundle evaluation" refers to Phase 1's behavior, not Phase 2. I'll update the docstring for clarity. Verified end-to-end: the policy-demo runs successfully with |
Problem
MCPServerIdentity.connect()was defaultingpdp_endpointto{server_url}/v1/pdp/evaluate— an endpoint that doesn't exist. This was added yesterday as a WIP placeholder in commit 8b222e3 ("wip: per-request PDP approach (to be replaced by env-var wiring)").The bogus default caused the guard's Phase 2 org-policy check to silently fail (HTTP 404), meaning org policy overrides (lockdown, selective) had no effect — only hardcoded
@guardmin_trust_levelvalues applied.This broke the policy-demo's Phase 2 (Lockdown) and Phase 3 (Selective) scenarios.
Fix
Default
pdp_endpointto empty string instead. Policy evaluation is local: the Go core fetches the OPA bundle viaCAPISCIO_BUNDLE_URLand evaluates it with its embedded OPA engine. Thepdp_endpointshould only be set when an explicit remote PDP service is deployed.Architecture reminder