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

Bad format string in AppRole error message #14096

Closed
candlerb opened this issue Feb 16, 2022 · 2 comments · Fixed by #14107
Closed

Bad format string in AppRole error message #14096

candlerb opened this issue Feb 16, 2022 · 2 comments · Fixed by #14107
Labels
auth/approle bug Used to indicate a potential bug

Comments

@candlerb
Copy link
Contributor

Describe the bug
This is only a minor bug, but I think there's a bad Print/Printf somewhere.

When I login using an AppRole / Secret, but the source address is not in the cidr_list for the secret, the error message contains a funky token %!w(<nil>)

Error writing data to auth/approle/login: Error making API request.

URL: PUT https://..../v1/auth/approle/login
Code: 400. Errors:

* source address "2001:db8::2" unauthorized through CIDR restrictions on the secret ID: %!w(<nil>)

To Reproduce
Steps to reproduce the behavior:

  1. Create an AppRole
  2. Create a secret ID bound to a particular CIDR address
    vault write auth/approle/role/totp-validate/secret-id cidr_list="192.0.2.1/32,2001:db8::1/128"
    
  3. Try to login using the AppRole and secret ID from a different IP address
    vault read auth/approle/role/<rolename>/role-id
    vault write auth/approle/login role_id=<role_id> secret_id=<secret_id>
    

Expected behavior
Clean error message.

Environment:

  • Vault Server Version (retrieve with vault status): 1.9.3
  • Vault CLI Version (retrieve with vault version): 1.9.3
  • Server Operating System/Architecture: Ubuntu 20.04 x86_64
@heatherezell
Copy link
Contributor

Looks like it's here:

"source address %q unauthorized through CIDR restrictions on the secret ID: %w",

@heatherezell heatherezell added the bug Used to indicate a potential bug label Feb 16, 2022
@ccapurso
Copy link
Contributor

Hi, @candlerb. Thank you for bringing this to our attention! As @hsimon-hashicorp has mentioned, this is a fairly straightforward fix. PR #14107 has been opened to addressed this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auth/approle bug Used to indicate a potential bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants