Sanitize serial number in revocation path.

Ping #1180
This commit is contained in:
Jeff Mitchell 2016-03-08 10:51:59 -05:00
parent 34a9cb1a70
commit 7a9122bbd1
1 changed files with 5 additions and 0 deletions

View File

@ -2,6 +2,7 @@ package pki
import (
"fmt"
"strings"
"github.com/hashicorp/vault/helper/certutil"
"github.com/hashicorp/vault/logical"
@ -47,6 +48,10 @@ func (b *backend) pathRevokeWrite(req *logical.Request, data *framework.FieldDat
return logical.ErrorResponse("The serial number must be provided"), nil
}
// We store and identify by lowercase colon-separated hex, but other
// utilities use dashes and/or uppercase, so normalize
serial = strings.Replace(strings.ToLower(serial), "-", ":", -1)
b.revokeStorageLock.Lock()
defer b.revokeStorageLock.Unlock()