Skip to content

Commit b87777a

Browse files
matt-muellerChromium LUCI CQ
authored andcommitted
TrustStoreMac: add debug info flag for SecTrustSettingsCopyTrustSettings errors
Change-Id: Ifc9eaf96914875fb6621a904c277e26e355e7b90 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3140645 Reviewed-by: Ryan Sleevi <[email protected]> Commit-Queue: Matt Mueller <[email protected]> Cr-Commit-Position: refs/heads/main@{#918853}
1 parent 8ec5ef8 commit b87777a

File tree

4 files changed

+23
-16
lines changed

4 files changed

+23
-16
lines changed

components/security_interstitials/content/cert_logger.proto

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,7 @@ message TrialVerificationInfo {
259259
MAC_TRUST_SETTINGS_DICT_CONTAINS_RESULT = 9;
260260
MAC_TRUST_SETTINGS_DICT_INVALID_RESULT_TYPE = 10;
261261
MAC_TRUST_SETTINGS_DICT_CONTAINS_ALLOWED_ERROR = 11;
262+
MAC_COPY_TRUST_SETTINGS_ERROR = 12;
262263
}
263264
// Debug flags from the trial verifier path building attempt, only populated
264265
// on reports from macOS. Contains the union of flags from all the GetTrust

components/security_interstitials/content/certificate_error_report.cc

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -108,22 +108,22 @@ void AddVerifyFlagsToReport(
108108
void AddMacTrustFlagsToReport(
109109
int mac_trust_flags,
110110
::google::protobuf::RepeatedField<int>* report_flags) {
111-
#define COPY_TRUST_FLAGS(flag) \
112-
if (mac_trust_flags & net::TrustStoreMac::TRUST_##flag) \
113-
report_flags->Add( \
114-
chrome_browser_ssl::TrialVerificationInfo::MAC_TRUST_##flag);
115-
116-
COPY_TRUST_FLAGS(SETTINGS_ARRAY_EMPTY);
117-
COPY_TRUST_FLAGS(SETTINGS_DICT_EMPTY);
118-
COPY_TRUST_FLAGS(SETTINGS_DICT_UNKNOWN_KEY);
119-
COPY_TRUST_FLAGS(SETTINGS_DICT_CONTAINS_POLICY);
120-
COPY_TRUST_FLAGS(SETTINGS_DICT_INVALID_POLICY_TYPE);
121-
COPY_TRUST_FLAGS(SETTINGS_DICT_CONTAINS_APPLICATION);
122-
COPY_TRUST_FLAGS(SETTINGS_DICT_CONTAINS_POLICY_STRING);
123-
COPY_TRUST_FLAGS(SETTINGS_DICT_CONTAINS_KEY_USAGE);
124-
COPY_TRUST_FLAGS(SETTINGS_DICT_CONTAINS_RESULT);
125-
COPY_TRUST_FLAGS(SETTINGS_DICT_INVALID_RESULT_TYPE);
126-
COPY_TRUST_FLAGS(SETTINGS_DICT_CONTAINS_ALLOWED_ERROR);
111+
#define COPY_TRUST_FLAGS(flag) \
112+
if (mac_trust_flags & net::TrustStoreMac::flag) \
113+
report_flags->Add(chrome_browser_ssl::TrialVerificationInfo::MAC_##flag);
114+
115+
COPY_TRUST_FLAGS(TRUST_SETTINGS_ARRAY_EMPTY);
116+
COPY_TRUST_FLAGS(TRUST_SETTINGS_DICT_EMPTY);
117+
COPY_TRUST_FLAGS(TRUST_SETTINGS_DICT_UNKNOWN_KEY);
118+
COPY_TRUST_FLAGS(TRUST_SETTINGS_DICT_CONTAINS_POLICY);
119+
COPY_TRUST_FLAGS(TRUST_SETTINGS_DICT_INVALID_POLICY_TYPE);
120+
COPY_TRUST_FLAGS(TRUST_SETTINGS_DICT_CONTAINS_APPLICATION);
121+
COPY_TRUST_FLAGS(TRUST_SETTINGS_DICT_CONTAINS_POLICY_STRING);
122+
COPY_TRUST_FLAGS(TRUST_SETTINGS_DICT_CONTAINS_KEY_USAGE);
123+
COPY_TRUST_FLAGS(TRUST_SETTINGS_DICT_CONTAINS_RESULT);
124+
COPY_TRUST_FLAGS(TRUST_SETTINGS_DICT_INVALID_RESULT_TYPE);
125+
COPY_TRUST_FLAGS(TRUST_SETTINGS_DICT_CONTAINS_ALLOWED_ERROR);
126+
COPY_TRUST_FLAGS(COPY_TRUST_SETTINGS_ERROR);
127127

128128
#undef COPY_TRUST_FLAGS
129129
}

net/cert/internal/trust_store_mac.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,7 @@ TrustStatus IsSecCertificateTrustedForPolicyInDomain(
231231
}
232232
if (err) {
233233
OSSTATUS_LOG(ERROR, err) << "SecTrustSettingsCopyTrustSettings error";
234+
*debug_info |= TrustStoreMac::COPY_TRUST_SETTINGS_ERROR;
234235
return TrustStatus::UNSPECIFIED;
235236
}
236237
TrustStatus trust = IsTrustSettingsTrustedForPolicy(
@@ -326,6 +327,7 @@ TrustStatus IsCertificateTrustedForPolicy(const ParsedCertificate* cert,
326327
continue;
327328
}
328329
OSSTATUS_LOG(ERROR, err) << "SecTrustSettingsCopyTrustSettings error";
330+
*debug_info |= TrustStoreMac::COPY_TRUST_SETTINGS_ERROR;
329331
continue;
330332
}
331333
if (out_is_known_root && trust_domain == kSecTrustSettingsDomainSystem) {

net/cert/internal/trust_store_mac.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,10 @@ class NET_EXPORT TrustStoreMac : public TrustStore {
6868
// One of the trustSettings dictionaries contained a
6969
// kSecTrustSettingsAllowedError key.
7070
TRUST_SETTINGS_DICT_CONTAINS_ALLOWED_ERROR = 1 << 10,
71+
72+
// SecTrustSettingsCopyTrustSettings returned a value other than
73+
// errSecSuccess or errSecItemNotFound.
74+
COPY_TRUST_SETTINGS_ERROR = 1 << 11,
7175
};
7276

7377
enum class TrustImplType {

0 commit comments

Comments
 (0)