Skip to content

Commit e7f3205

Browse files
committed
Add check for incorrect 'requirements' key in CodeSignatureVerifier
1 parent 647e1f8 commit e7f3205

2 files changed

Lines changed: 30 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33
All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/).
44

55

6+
## [1.8.2] - 2021-01-18
7+
8+
### Added
9+
- Added check for unexpected processor arguments in CodeSignatureVerifier.
10+
611
## [1.8.1] - 2020-12-08
712

813
### Removed
@@ -201,7 +206,8 @@ All notable changes to this project will be documented in this file. This projec
201206
- Initial release
202207

203208

204-
[Unreleased]: https://github.com/homebysix/pre-commit-macadmin/compare/v1.8.1...HEAD
209+
[Unreleased]: https://github.com/homebysix/pre-commit-macadmin/compare/v1.8.2...HEAD
210+
[1.8.2]: https://github.com/homebysix/pre-commit-macadmin/compare/v1.8.1...v1.8.2
205211
[1.8.1]: https://github.com/homebysix/pre-commit-macadmin/compare/v1.8.0...v1.8.1
206212
[1.8.0]: https://github.com/homebysix/pre-commit-macadmin/compare/v1.7.0...v1.8.0
207213
[1.7.0]: https://github.com/homebysix/pre-commit-macadmin/compare/v1.6.2...v1.7.0

pre_commit_hooks/check_autopkg_recipes.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,26 @@ def validate_endofcheckphase(process, filename):
148148
return passed
149149

150150

151+
def validate_codesignatureverifier(process, filename):
152+
"""Ensure CodeSignatureVerifier uses correct arguments."""
153+
154+
passed = True
155+
csv_args = [
156+
x.get("Arguments")
157+
for x in process
158+
if x.get("Processor") == "CodeSignatureVerifier"
159+
]
160+
if csv_args:
161+
if "requirements" in csv_args[0]:
162+
print(
163+
'{}: Found unexpected key "{}" in '
164+
"CodeSignatureVerifier arguments.".format(filename, "requirements")
165+
)
166+
passed = False
167+
168+
return passed
169+
170+
151171
def validate_minimumversion(process, min_vers, ignore_min_vers_before, filename):
152172
"""Ensure MinimumVersion is set appropriately for the processors used."""
153173

@@ -462,6 +482,9 @@ def main(argv=None):
462482
if not validate_endofcheckphase(process, filename):
463483
retval = 1
464484

485+
if not validate_codesignatureverifier(process, filename):
486+
retval = 1
487+
465488
if not validate_no_var_in_app_path(process, filename):
466489
retval = 1
467490

0 commit comments

Comments
 (0)