From 036bd45ca78bbaa583bc160e29b8807188494bf5 Mon Sep 17 00:00:00 2001 From: divyaac Date: Fri, 11 Nov 2022 11:04:10 -0800 Subject: [PATCH] Added error message (#17904) * Added error message * Added changelog * Grammar Chagne * Changed wording --- builtin/credential/cert/path_login.go | 3 +++ changelog/17904.txt | 3 +++ 2 files changed, 6 insertions(+) create mode 100644 changelog/17904.txt diff --git a/builtin/credential/cert/path_login.go b/builtin/credential/cert/path_login.go index 11e63d75e..dd70e739b 100644 --- a/builtin/credential/cert/path_login.go +++ b/builtin/credential/cert/path_login.go @@ -62,6 +62,9 @@ func (b *backend) pathLoginResolveRole(ctx context.Context, req *logical.Request } func (b *backend) pathLoginAliasLookahead(ctx context.Context, req *logical.Request, d *framework.FieldData) (*logical.Response, error) { + if req.Connection == nil || req.Connection.ConnState == nil { + return nil, fmt.Errorf("tls connection not found") + } clientCerts := req.Connection.ConnState.PeerCertificates if len(clientCerts) == 0 { return nil, fmt.Errorf("no client certificate found") diff --git a/changelog/17904.txt b/changelog/17904.txt new file mode 100644 index 000000000..aa654046b --- /dev/null +++ b/changelog/17904.txt @@ -0,0 +1,3 @@ +```release-note:bug +credential/cert: adds error message if no tls connection is found during the AliasLookahead operation +``` \ No newline at end of file