You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Steps to repo:
Right after a certificate is first created (and it is still pending), if the customer calls GetPropertiesOfCertificates with options.IncludePending = true;, the application could fail due to the x5t property missing.
auto keyVaultUrl = "https://<keyvault-name>.vault.azure.net/";
auto cred = std::make_shared<AzureCliCredential>();
CertificateClient client(keyVaultUrl, cred);
// Create a certificate
std::cout << "Creating certificate atest-cert99" << std::endl;
std::string certificateName = "atest-cert99";
CertificateCreateOptions options;
// create a lifetime action
LifetimeAction action;
action.LifetimePercentage = 80;
action.Action = CertificatePolicyAction::AutoRenew;
options.Properties.Enabled = true;
options.Policy.Subject = "CN=sample1";
options.Policy.ValidityInMonths = 12;
options.Policy.Enabled = true;
options.Policy.ContentType = CertificateContentType::Pkcs12;
options.Policy.IssuerName = "Self";
options.Policy.LifetimeActions.emplace_back(action);
options.Properties.Name = certificateName;
client.StartCreateCertificate(certificateName, options);
// Fetch list of certificates// Observe that this will fail
GetPropertiesOfCertificatesOptions options;
options.IncludePending = true;
std::cout << "Certificates in the key vault (includePending = true):" << std::endl;
for (auto cert = client.GetPropertiesOfCertificates(options); cert.HasPage();
cert.MoveToNextPage())
{
std::cout << "Found " << cert.Items.size() << " certificates." << std::endl;
for (auto item : cert.Items)
{
std::cout << item.Name << std::endl;
}
}
The text was updated successfully, but these errors were encountered:
We cannot always assume that an x5t property will be present within the JSON response:
azure-sdk-for-cpp/sdk/keyvault/azure-security-keyvault-certificates/src/certificate_serializers.cpp
Lines 42 to 43 in bef4201
This needs to be within a check:
azure-sdk-for-cpp/sdk/core/azure-core/inc/azure/core/internal/json/json.hpp
Lines 25662 to 25668 in bef4201
Otherwise, the JSON library's
[]
operator behavior is undefined (and in debug the test/app crashes with an assertion failure and abort).Steps to repo:
Right after a certificate is first created (and it is still pending), if the customer calls
GetPropertiesOfCertificates
withoptions.IncludePending = true;
, the application could fail due to the x5t property missing.The text was updated successfully, but these errors were encountered: