mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2026-03-11 08:54:48 +00:00
SSH Agent: Improve OpenSSH certificate validation
- Check elements non-empty before accessing first() - Validate minimum 2 elements (type + nonce) - Reject invalid/unsupported certificate types - Verify Base64 nonce decoding success
This commit is contained in:
parent
82f6d3ae12
commit
94ef87050a
1 changed files with 6 additions and 1 deletions
|
|
@ -693,7 +693,7 @@ bool OpenSSHKey::parseCertificate(QByteArray& data)
|
|||
"sk-ecdsa-sha2-nistp521-cert-v01@openssh.com",
|
||||
};
|
||||
|
||||
if(!certificateTypeList.contains(elements.first())) {
|
||||
if(elements.isEmpty() || elements.size() < 2 || !certificateTypeList.contains(elements.first())) {
|
||||
m_error = tr("Invalid or unsupported certificate file");
|
||||
return false;
|
||||
}
|
||||
|
|
@ -701,6 +701,11 @@ bool OpenSSHKey::parseCertificate(QByteArray& data)
|
|||
m_certificateType = elements.first();
|
||||
m_rawCertificateData = QByteArray::fromBase64(elements[1].toLatin1());
|
||||
|
||||
if (m_rawCertificateData.isEmpty()) {
|
||||
m_error = tr("Base64 decoding failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue