Skip to content

Commit

Permalink
Removed dupe checking because json library auto-removes dupes.
Browse files Browse the repository at this point in the history
Signed-off-by: Brian Sonnenberg <[email protected]>
  • Loading branch information
briansonnenberg committed Dec 12, 2024
1 parent ed26529 commit e16fd5d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 48 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,10 @@ SPIFFEValidator::parseTrustBundles(const std::string& trust_bundle_mapping_str)
(*trust_domains)
->iterate([&spiffe_data, &success](const std::string& domain_name,
const Envoy::Json::Object& domain_object) -> bool {
if (spiffe_data->trust_bundle_stores.contains(domain_name)) {
ENVOY_LOG(error, "Duplicate domain '{}' in SPIFFE bundle map", domain_name);
return (success = false);
} else {
spiffe_data->trust_bundle_stores[domain_name] = X509StorePtr(X509_STORE_new());
}
// TODO: Duplicates are currently ignored and only the last value is used.
// This is because our json parser auto de-dupes keys in the dict and
// only include the last one in this iteration function.
spiffe_data->trust_bundle_stores[domain_name] = X509StorePtr(X509_STORE_new());

ENVOY_LOG(info, "Loading domain '{}' from SPIFFE bundle map", domain_name);

Expand Down
32 changes: 0 additions & 32 deletions test/common/tls/test_data/trust_bundles_dupe_domains.json

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -827,16 +827,6 @@ name: envoy.tls.cert_validator.spiffe
)EOF")),
EnvoyException, "Failed to load SPIFFE Bundle map");
}
{
EXPECT_THROW_WITH_MESSAGE(initialize(TestEnvironment::substitute(R"EOF(
name: envoy.tls.cert_validator.spiffe
typed_config:
"@type": type.googleapis.com/envoy.extensions.transport_sockets.tls.v3.SPIFFECertValidatorConfig
trust_bundles:
filename: "{{ test_rundir }}/test/common/tls/test_data/trust_bundles_dupe_domains.json"
)EOF")),
EnvoyException, "Failed to load SPIFFE Bundle map");
}
}

TEST_F(TestSPIFFEValidator, TestDoVerifyCertChainMultipleTrustDomainBundleMappingInline) {
Expand Down

0 comments on commit e16fd5d

Please sign in to comment.