fix: Protect credentialstore attrs hmac values in serializati

This commit is contained in:
Susmitha Girumala committed 2021-07-28 13:22:47 -04:00
1 parent 61c80518de
commit e40ff1f63c
4 files changed
+146 -16

No files matched your search

@@ -19,6 +19,16 @@ export default class FragmentCredentialStoreAttributesSerializer extends JSONSer
if (type === 'string' && json[key] === '') json[key] = null;
// Do not serialize read-only attributes.
if (options.readOnly) delete json[key];
// Token cannot be unset. If it's falsy, it must be removed.
if (key === 'token' && !json[key]) delete json[key];
// Client certificate key cannot be unset when certificate is set.
// If it's falsy, it must be removed.
if (
key === 'client_certificate_key' &&
!json[key] &&
json['client_certificate']
)
delete json[key];
return value;
}
}