Skip to content

Commit af75ed4

Browse files
nglevinluispadron
authored andcommitted
Call out a few more bits that can be set at analysis time without additional accomodations, and allow for resetting the list of extra_keys_to_match_profile with an empty list.
Cherry-pick: 9899cc4
1 parent 5cd311f commit af75ed4

File tree

2 files changed

+27
-16
lines changed

2 files changed

+27
-16
lines changed

tools/plisttool/plisttool.py

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,7 @@
327327
# Keys which have a list of potential values in the profile, but only one in
328328
# the entitlements that must be in the profile's list of values
329329
'com.apple.developer.devicecheck.appattest-environment',
330+
'com.apple.developer.nfc.readersession.formats',
330331
]
331332

332333
ENTITLEMENTS_BETA_REPORTS_ACTIVE_MISMATCH = (
@@ -1206,11 +1207,12 @@ def validate_plist(self, plist):
12061207
self._sanity_check_profile()
12071208

12081209
if self._validation_mode != 'skip':
1210+
# TODO: b/474331541 - Remove the fallback once its values are always set
1211+
# at analysis time in entitlements_support.bzl.
12091212
extra_keys_to_match = self.options.get(
12101213
'extra_keys_to_match_profile',
1214+
_ENTITLEMENTS_TO_VALIDATE_WITH_PROFILE,
12111215
)
1212-
if not extra_keys_to_match:
1213-
extra_keys_to_match = _ENTITLEMENTS_TO_VALIDATE_WITH_PROFILE
12141216
self._validate_entitlements_against_profile(
12151217
plist,
12161218
extra_keys_to_match,
@@ -1272,14 +1274,9 @@ def _validate_entitlements_against_profile(
12721274
12731275
Args:
12741276
entitlements: The entitlements.
1275-
<<<<<<< HEAD
1276-
||||||| parent of e9f9f61b (Add an analysis time configurable option to customize the keys we compare values between entitlements xml and the assigned provisioning profile.)
1277-
1278-
=======
12791277
extra_keys_to_match: A list of additional entitlements keys to validate
1280-
that their values match those of the provisioning profile exactly.
1281-
1282-
>>>>>>> e9f9f61b (Add an analysis time configurable option to customize the keys we compare values between entitlements xml and the assigned provisioning profile.)
1278+
that their values match those of the provisioning profile exactly if
1279+
the value is not a list, and a subset if the value is a list.
12831280
Raises:
12841281
PlistToolError: For any issues found.
12851282
"""
@@ -1333,6 +1330,11 @@ def _validate_entitlements_against_profile(
13331330
'keychain-access-groups', self.target,
13341331
supports_wildcards=True)
13351332

1333+
# TODO: b/474331541 - Remove this specific check once extra_keys_to_match is
1334+
# configured exclusively at analysis time, allowing us to add the
1335+
# com.apple.security.application-groups entitlement check for all Apple
1336+
# platforms except macOS.
1337+
#
13361338
# com.apple.security.application-groups
13371339
# (This check does not apply to macOS-only provisioning profiles.)
13381340
if self._profile_metadata.get('Platform', []) != ['OSX']:
@@ -1347,13 +1349,6 @@ def _validate_entitlements_against_profile(
13471349
supports_wildcards=True,
13481350
allow_wildcards_in_entitlements=True)
13491351

1350-
# com.apple.developer.nfc.readersession.formats
1351-
self._check_entitlements_array(
1352-
entitlements,
1353-
profile_entitlements,
1354-
'com.apple.developer.nfc.readersession.formats',
1355-
self.target)
1356-
13571352
def _check_entitlement_matches_profile_value(
13581353
self,
13591354
entitlement,

tools/plisttool/plisttool_unittest.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2129,6 +2129,22 @@ def test_entitlements_wifi_info_active_mismatch(self):
21292129
},
21302130
}, plist)
21312131

2132+
def test_entitlements_wifi_info_active_mismatch_with_no_extra_keys_to_match(self):
2133+
# This is really looking for the lack of an error being raised.
2134+
plist = {'com.apple.developer.networking.wifi-info': False}
2135+
self._assert_plisttool_result({
2136+
'plists': [plist],
2137+
'entitlements_options': {
2138+
'extra_keys_to_match_profile': [],
2139+
'profile_metadata_file': {
2140+
'Entitlements': {
2141+
'com.apple.developer.networking.wifi-info': True,
2142+
},
2143+
'Version': 1,
2144+
},
2145+
},
2146+
}, plist)
2147+
21322148
def test_entitlements_profile_missing_wifi_info_active_default_validation(self):
21332149
with self.assertRaisesRegex(
21342150
plisttool.PlistToolError,

0 commit comments

Comments
 (0)