Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

withVault prints "Access denied to Vault Secrets at " for 403 rather than raise an exception #303

Open
AGiantSquid opened this issue Mar 28, 2023 · 0 comments
Labels

Comments

@AGiantSquid
Copy link

Jenkins and plugins versions report

360.v0a_1c04cf807d

What Operating System are you using (both controller, and any agents involved in the problem)?

linux

Reproduction steps

get a 403 response for a secret

Expected Results

plugin should raise an exception

Actual Results

jenkins prints error, but proceeds with build

Anything else?

If the plugin gets a 403, it returns true from responseHasErrors: https://github.com/jenkinsci/hashicorp-vault-plugin/blob/master/src/main/java/com/datapipe/jenkins/vault/VaultAccessor.java#L231

The check for responseHasErrors just continues if the response is invalid:
https://github.com/jenkinsci/hashicorp-vault-plugin/blob/master/src/main/java/com/datapipe/jenkins/vault/VaultAccessor.java#L170

Conversely, The plugin can throw an exception for a 404: https://github.com/jenkinsci/hashicorp-vault-plugin/blob/master/src/main/java/com/datapipe/jenkins/vault/VaultAccessor.java#L234

The plugin should raise a Forbidden exception alerting the user that they are unauthorized to get the credentials their build requires similar to how it will raise for a 404.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant