Skip to content

Conversation

aliculPix4D
Copy link
Contributor

@aliculPix4D aliculPix4D commented Oct 10, 2024

go-concourse:connection client prints response body to the end user

  • if policy checker (e.g. OPA) does not allow the action the reason is never shown to the end user. The end user saw only Forbidden without the message why it is forbidden. To see more details end user was required to run the command with --verbose or inspect the request in web UI (if possible e.g. by clicking on expose pipeline button).
  • this PR improves the error message the end user sees by printing also the reason from the response body. It is very important that a user sees the message of why the action was forbidden e.g by policy checker.

Almost every fly command (except e.g. set-pipeline) still uses the deprecated HTTP client called connection client, so this PR affects many commands.

Example: fly expose-pipeline (and many other commands) when policy checker (OPA) returned 200 and denied the action (correct JSON body).

What users saw before:

$ fly -t main expose-pipeline -p test
error: forbidden

What users see now?

$ fly -t main expose-pipeline -p test
error: forbidden: policy check failed: 
 * <actual deny reason from OPA policy>

@aliculPix4D aliculPix4D requested a review from a team as a code owner October 10, 2024 15:26
@xtremerui
Copy link
Contributor

if you could resolve the conflict we are good to go. Thank you!

- if policy checker (e.g. OPA) does not allow the action the reason is never shown to the end user. The end user saw only Forbidden without the message why it is forbidden. To see more details end user was required to run the command with --verbose or inspect the request in web UI.
- this PR improves the error message the end user sees by printing also the reason from the response body

Signed-off-by: aliculPix4D <aleksandar.licul@pix4d.com>
@aliculPix4D aliculPix4D force-pushed the go-concourse-connection-client-improve-error-msg branch from 8e75eeb to fa06840 Compare November 28, 2024 08:35
@aliculPix4D
Copy link
Contributor Author

aliculPix4D commented Nov 28, 2024

if you could resolve the conflict we are good to go. Thank you!

Done.

@xtremerui Thanks for taking care of these PRs...

@xtremerui xtremerui merged commit 67b05c3 into concourse:master Nov 28, 2024
11 checks passed
@aliculPix4D aliculPix4D deleted the go-concourse-connection-client-improve-error-msg branch January 9, 2025 10:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants