open-vault/builtin/credential
Rémi Lapeyre d66333f7ac
Fix handling of username_as_alias during LDAP authentication (#15525)
* Fix handling of username_as_alias during LDAP authentication

There is a bug that was introduced in the LDAP authentication method by https://github.com/hashicorp/vault/pull/11000.
It was thought to be backward compatible but has broken a number of users. Later
a new parameter `username_as_alias` was introduced in https://github.com/hashicorp/vault/pull/14324
to make it possible for operators to restore the previous behavior.
The way it is currently working is not completely backward compatible thought
because when username_as_alias is set, a call to GetUserAliasAttributeValue() will
first be made, then this value is completely discarded in pathLogin() and replaced
by the username as expected.

This is an issue because it makes useless calls to the LDAP server and will break
backward compatibility if one of the constraints in GetUserAliasAttributeValue()
is not respected, even though the resulting value will be discarded anyway.

In order to maintain backward compatibility here we have to only call
GetUserAliasAttributeValue() if necessary.

Since this change of behavior was introduced in 1.9, this fix will need to be
backported to the 1.9, 1.10 and 1.11 branches.

* Add changelog

* Add tests

* Format code

* Update builtin/credential/ldap/backend.go

Co-authored-by: Calvin Leung Huang <1883212+calvn@users.noreply.github.com>

* Format and fix declaration

* Reword changelog

Co-authored-by: Calvin Leung Huang <1883212+calvn@users.noreply.github.com>
2022-05-20 14:17:26 -07:00
..
app-id builtin: deprecate errwrap.Wrapf() throughout (#11430) 2021-04-22 11:20:59 -04:00
approle add value length check to approle createHMAC (#14746) 2022-03-29 14:43:35 -04:00
aws Remove spurious fmt.Printf calls including one of a key (#15344) 2022-05-19 12:27:02 -07:00
cert Revert the WithContext changes to vault tests (#14947) 2022-04-07 15:12:58 -04:00
github deprecating Legacy MFA (#14869) 2022-04-19 21:19:34 -04:00
ldap Fix handling of username_as_alias during LDAP authentication (#15525) 2022-05-20 14:17:26 -07:00
okta auth/okta: Add support for Okta number challenge (#15361) 2022-05-11 17:09:29 -07:00
radius deprecating Legacy MFA (#14869) 2022-04-19 21:19:34 -04:00
token Migrate to sdk/internalshared libs in go-secure-stdlib (#12090) 2021-07-15 20:17:31 -04:00
userpass deprecating Legacy MFA (#14869) 2022-04-19 21:19:34 -04:00