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

ToUpper base32 values for TOTP key ingress #6400

Merged
merged 1 commit into from
Mar 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion builtin/logical/totp/backend_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"log"
"net/url"
"path"
"strings"
"testing"
"time"

Expand All @@ -25,7 +26,7 @@ func createKey() (string, error) {

key := keyUrl.Secret()

return key, err
return strings.ToLower(key), err
}

func generateCode(key string, period uint, digits otplib.Digits, algorithm otplib.Algorithm) (string, error) {
Expand Down
2 changes: 1 addition & 1 deletion builtin/logical/totp/path_keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ func (b *backend) pathKeyCreate(ctx context.Context, req *logical.Request, data
return logical.ErrorResponse("the key value is required"), nil
}

_, err := base32.StdEncoding.DecodeString(keyString)
_, err := base32.StdEncoding.DecodeString(strings.ToUpper(keyString))
if err != nil {
return logical.ErrorResponse(fmt.Sprintf(
"invalid key value: %s", err)), nil
Expand Down