Skip to content

Commit 065ca81

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 23c30d1 commit 065ca81

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 = (
@@ -1197,11 +1198,12 @@ def validate_plist(self, plist):
11971198
self._sanity_check_profile()
11981199

11991200
if self._validation_mode != 'skip':
1201+
# TODO: b/474331541 - Remove the fallback once its values are always set
1202+
# at analysis time in entitlements_support.bzl.
12001203
extra_keys_to_match = self.options.get(
12011204
'extra_keys_to_match_profile',
1205+
_ENTITLEMENTS_TO_VALIDATE_WITH_PROFILE,
12021206
)
1203-
if not extra_keys_to_match:
1204-
extra_keys_to_match = _ENTITLEMENTS_TO_VALIDATE_WITH_PROFILE
12051207
self._validate_entitlements_against_profile(
12061208
plist,
12071209
extra_keys_to_match,
@@ -1263,14 +1265,9 @@ def _validate_entitlements_against_profile(
12631265
12641266
Args:
12651267
entitlements: The entitlements.
1266-
<<<<<<< HEAD
1267-
||||||| parent of e9f9f61b (Add an analysis time configurable option to customize the keys we compare values between entitlements xml and the assigned provisioning profile.)
1268-
1269-
=======
12701268
extra_keys_to_match: A list of additional entitlements keys to validate
1271-
that their values match those of the provisioning profile exactly.
1272-
1273-
>>>>>>> e9f9f61b (Add an analysis time configurable option to customize the keys we compare values between entitlements xml and the assigned provisioning profile.)
1269+
that their values match those of the provisioning profile exactly if
1270+
the value is not a list, and a subset if the value is a list.
12741271
Raises:
12751272
PlistToolError: For any issues found.
12761273
"""
@@ -1325,6 +1322,11 @@ def _validate_entitlements_against_profile(
13251322
supports_wildcards=True,
13261323
allow_wildcards_in_entitlements=True)
13271324

1325+
# TODO: b/474331541 - Remove this specific check once extra_keys_to_match is
1326+
# configured exclusively at analysis time, allowing us to add the
1327+
# com.apple.security.application-groups entitlement check for all Apple
1328+
# platforms except macOS.
1329+
#
13281330
# com.apple.security.application-groups
13291331
# (This check does not apply to macOS-only provisioning profiles.)
13301332
if self._profile_metadata.get('Platform', []) != ['OSX']:
@@ -1339,13 +1341,6 @@ def _validate_entitlements_against_profile(
13391341
supports_wildcards=True,
13401342
allow_wildcards_in_entitlements=True)
13411343

1342-
# com.apple.developer.nfc.readersession.formats
1343-
self._check_entitlements_array(
1344-
entitlements,
1345-
profile_entitlements,
1346-
'com.apple.developer.nfc.readersession.formats',
1347-
self.target)
1348-
13491344
def _check_entitlement_matches_profile_value(
13501345
self,
13511346
entitlement,

tools/plisttool/plisttool_unittest.py

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

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

0 commit comments

Comments
 (0)