GUACAMOLE-641: Canonicalize individual, tokenized components of secret names rather than the whole name.

In the event that a secret name is structured, such as the URL-like
notation used by Keeper Secrets Manager, canonicalizing/encoding the
entire name could result in the name itself becoming invalid. Only the
portions that come from tokens should be canonicalized.
This commit is contained in:
Michael Jumper
2022-01-21 16:34:23 -08:00
parent 16cb9ed69b
commit 786430612e
3 changed files with 31 additions and 14 deletions

View File

@@ -66,8 +66,8 @@ public class AzureKeyVaultSecretService extends CachedVaultSecretService {
* not allowed by Azure Key Vault, replacing them with a single dash.
*/
@Override
public String canonicalize(String name) {
Matcher disallowed = DISALLOWED_CHARACTERS.matcher(name);
public String canonicalize(String nameComponent) {
Matcher disallowed = DISALLOWED_CHARACTERS.matcher(nameComponent);
return disallowed.replaceAll("-");
}