From 7502bc247fab5b3efaf4b4719736f410c2881755 Mon Sep 17 00:00:00 2001 From: Russell Hancox Date: Tue, 21 May 2024 12:48:48 -0400 Subject: [PATCH] santactl/fileinfo: Include teamID/platform prefix in signing ID (#1356) --- Source/santactl/Commands/SNTCommandFileInfo.m | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/Source/santactl/Commands/SNTCommandFileInfo.m b/Source/santactl/Commands/SNTCommandFileInfo.m index a3b086bf9..bcc21d6e0 100644 --- a/Source/santactl/Commands/SNTCommandFileInfo.m +++ b/Source/santactl/Commands/SNTCommandFileInfo.m @@ -388,10 +388,8 @@ - (SNTAttributeBlock)rule { if (identifier) { if (teamID) { signingID = [NSString stringWithFormat:@"%@:%@", teamID, identifier]; - } else { - if (csc.platformBinary) { - signingID = [NSString stringWithFormat:@"platform:%@", identifier]; - } + } else if (csc.platformBinary) { + signingID = [NSString stringWithFormat:@"platform:%@", identifier]; } } @@ -524,7 +522,16 @@ - (SNTAttributeBlock)teamID { - (SNTAttributeBlock)signingID { return ^id(SNTCommandFileInfo *cmd, SNTFileInfo *fileInfo) { MOLCodesignChecker *csc = [fileInfo codesignCheckerWithError:NULL]; - return csc.signingID; + + NSString *identifier = csc.signingID; + NSString *teamID = csc.teamID; + if (!identifier) return nil; + if (teamID) { + return [NSString stringWithFormat:@"%@:%@", teamID, identifier]; + } else if (csc.platformBinary) { + return [NSString stringWithFormat:@"platform:%@", identifier]; + } + return nil; }; }