in mozregression/launchers.py [0:0]
def _codesign_verify(appdir):
"""Calls `codesign` to verify signature, and returns state."""
if mozinfo.os != "mac":
raise Exception("_codesign_verify should only be called on macOS.")
try:
output = check_output(["codesign", "-v", appdir], stderr=STDOUT)
except CalledProcessError as e:
output = e.output
exit_code = e.returncode
else:
exit_code = 0
LOG.debug(f"codesign verify exit code: {exit_code}")
if exit_code == 0:
return CodesignResult.PASS
elif exit_code == 1:
if b"code object is not signed at all" in output:
# NOTE: this output message was tested on macOS 11, 12, and 13.
return CodesignResult.UNSIGNED
else:
return CodesignResult.INVALID
# NOTE: Remaining codes normally mean the command was called with incorrect
# arguments or if there is any other unforeseen issue with running the command.
return CodesignResult.OTHER