Fix SyncProductFilter and SyncCAFilter having no effect - #66
Open
Pichatorn-A4K wants to merge 1 commit into
Open
Pichatorn-A4K wants to merge 1 commit into
Pichatorn-A4K wants to merge 1 commit into
Conversation
Two separate problems in the same area, both of which make a configured filter silently do the wrong thing. SyncProductFilter: the product-filter block in GetAllConnectorCertsForOrder logs 'Skipping...' but is missing the 'return null' that the SyncCAFilter and Division blocks immediately above it both have, so execution falls through and the order is synchronized anyway. It appears to work on a full sync only because ListAllCertificateOrders also passes filters[product_name_id] to DigiCert; on an incremental sync (status-changes takes no product filter) it is not enforced at all. SyncCAFilter: 'caList.ForEach(c => c.ToUpper())' discards its result, because String.ToUpper returns a new string rather than mutating in place, so the list is never upper-cased. The comparison further down is against 'orderResponse.certificate.ca_cert.Id.ToUpper()', i.e. the DigiCert side IS upper-cased, so a filter entered in lower case matches nothing and the sync returns zero certificates with no error - only a trace line. (CertCentralConfig.SyncCAs also materialises a new List on each access, so an in-place mutation could not have persisted either.)
This was referenced Sep 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two independent problems in the sync-filter area, both of which make a configured filter silently do
something other than what it says. Found while auditing the shipped
2.4.1assembly; both are alsopresent in
2.4.2-rc.0.1.
SyncProductFilternever filtersGetAllConnectorCertsForOrderhas three filter blocks in a row. TheSyncCAFilterand Divisionblocks both
return nullwhen the order does not match; the product block logs and then fallsthrough:
It appears to work on a full sync only because
ListAllCertificateOrdersalso sendsfilters[product_name_id]to DigiCert. On an incremental sync the filter is not applied at all,because
status-changestakes no product filter — so out-of-scope products reach Command while thelog claims they were skipped.
2.
SyncCAFilternever matches a lower-case valueString.ToUpper()returns a new string; the result is discarded, so the list is never upper-cased.The comparison downstream is:
The DigiCert side is upper-cased, so a CA ID entered in lower case matches nothing and every
order is skipped — the sync returns zero certificates with no error, only a trace line per order.
CertCentralConfig.SyncCAsalso materialises a freshList<string>on each access, so an in-placemutation could not have persisted even if
ToUpper()had mutated. The fix assigns the projectionback, and additionally trims and drops empty entries so a trailing comma in the config value does not
produce an entry that can never match.
Verification
Driving
Synchronize()offline against a fakeCertCentralClient:SyncCAFiltermatches the order (and a genuinely different filter value stillexcludes it, so the test cannot pass for the wrong reason);
SyncProductFilterexcludes a non-matching product and keeps a matching one.Reverting either change makes the corresponding test fail. The tests are not in this PR because the
repository has no test project; happy to contribute the harness separately.
🤖 Generated with Claude Code