fix(proxy): include OPA deny reason in CONNECT 403 response#2363
Open
zanetworker wants to merge 1 commit into
Open
fix(proxy): include OPA deny reason in CONNECT 403 response#2363zanetworker wants to merge 1 commit into
zanetworker wants to merge 1 commit into
Conversation
When a CONNECT request was denied by OPA policy, the 403 response used a generic "not permitted by policy" message for both "endpoint not in policy" and "endpoint matched but binary didn't match." Users had no way to distinguish the two without reading supervisor logs. The OPA policy already computes a detailed deny_reason (e.g., "binary '/usr/bin/node' not allowed in policy 'X'") but the proxy was not including it in the HTTP response. Now the CONNECT deny response includes a "reason" field with the OPA deny reason when available. When the reason is empty, the field is omitted for backward compatibility. Fixes NVIDIA#2355 Signed-off-by: Adel Zaalouk <azaalouk@redhat.com>
zanetworker
requested review from
a team,
derekwaynecarr,
maxamillion and
mrunalp
as code owners
July 20, 2026 09:53
Collaborator
PR Review StatusValidation: This PR is project-valid because it is a small, concentrated proxy bug fix linked to #2355 and addresses a user-visible sandbox policy debugging gap. Review findings:
Docs: missing for a direct sandbox/proxy behavior change documented in Next state: |
Collaborator
|
/ok to test e333f14 |
|
Label |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When a CONNECT request is denied by OPA policy, the 403 response used a generic "not permitted by policy" message for both "endpoint not in policy" and "endpoint matched but binary didn't match." Users had no way to distinguish the two without reading supervisor logs, making binary identity the #1 debugging friction when setting up agents.
Related Issue
Fixes #2355
Changes
build_json_error_response_with_reasonfunction that includes an optionalreasonfield in the JSON bodydeny_reason(which already contains detailed binary mismatch info)Before:
{"detail":"CONNECT host:443 not permitted by policy","error":"policy_denied"}After (binary mismatch):
{"detail":"CONNECT host:443 not permitted by policy","error":"policy_denied","reason":"binary '/usr/bin/python3.11' not allowed in policy 'allow_xxx' (ancestors: [...])"}Testing
Bug reproduced live against a running sandbox:
mise run pre-commitpassespolicy_deny_response_includes_reason,policy_deny_response_omits_empty_reasonChecklist