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

Fix bug with vault cli when reading an individual field containing a Printf formatting verb #2109

Merged
merged 1 commit into from
Nov 22, 2016

Conversation

kylemcc
Copy link
Contributor

@kylemcc kylemcc commented Nov 17, 2016

There appears to be an interesting bug with the Vault CLI tool with the -field option. If the selected field's value contains a formatting verb, e.g.: %s, the output of the CLI tool will contain the familiar %!s(MISSING) in the middle of the value.

The fix is simply printing with Fprint instead of Fprintf (which appears to be unnecessary anyway).

Edit: Simplified this even further. The Sprintf seems superfluous. Eliminating it and passing the format string to Fprintf fixes this.

Steps to reproduce, if interested:

$ vault write secret/foo password=bar%sbaz
Success! Data written to: secret/foo
$
$ vault read -field=password secret/foo
bar%!s(MISSING)baz

@jefferai
Copy link
Member

LGTM -- thanks!

@jefferai jefferai merged commit 9571df6 into hashicorp:master Nov 22, 2016
@jefferai jefferai added this to the 0.6.3 milestone Nov 22, 2016
chrishoffman added a commit to chrishoffman/vault that referenced this pull request Nov 24, 2016
* upstream/master:
  Add version sha to server startup output
  Change current version number
  changelog++
  Don't say mlock is supported on OSX when it isn't. (hashicorp#2120)
  Change command examples for First Secrets hashicorp#2116 (hashicorp#2117)
  changelog++
  cli: fix bug with 'vault read -field=...' when the field value contains a printf formatting verb (hashicorp#2109)
  Update docs to fix hashicorp#2102
  Updating changelog
  http: increase request limit from 8MB to 32MB
  http: limit maximum request size
  Update libraries doc for Haskell community library (hashicorp#2101)
  Don't exclude 0 from the set of valid polynomials in Shamir. This leads to a potential (although extremely trivial) amount of information leakage.
  Bump proto files after update
  changelog++
  check for failure on that mysql query (hashicorp#2105)
  Bump deps
  Document bug causing certain LDAP settings to be forgotten on upgrade to 0.6.1+.
  Set number of pester retries to zero by default and make seal command… (hashicorp#2093)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants