fix: 🐛 credential library serializer for SSH certificate (#2790)

✅ Closes: https://hashicorp.atlassian.net/browse/ICU-16880
This commit is contained in:
Cameron Perera authored and GitHub committed 2025-04-25 10:23:51 -05:00
1 parent de83d59bde
commit 40ec4493ea
2 files changed
+61

No files matched your search

@@ -28,6 +28,7 @@ export default class CredentialLibrarySerializer extends ApplicationSerializer {
case TYPE_CREDENTIAL_LIBRARY_VAULT_GENERIC:
return this.serializeVaultGeneric(...arguments);
case TYPE_CREDENTIAL_LIBRARY_VAULT_SSH_CERTIFICATE:
return this.serializeVaultSshCertificate(...arguments);
default:
return super.serialize(...arguments);
}
@@ -61,4 +62,16 @@ export default class CredentialLibrarySerializer extends ApplicationSerializer {
return serialized;
}
}
serializeVaultSshCertificate() {
const serialized = super.serialize(...arguments);
if (serialized.attributes) {
const { key_type } = serialized.attributes;
if (key_type !== 'rsa' && key_type !== 'ecdsa') {
// If the key type is not RSA or ECDSA, set key_bits to null
serialized.attributes.key_bits = null;
}
return serialized;
}
}
}