Skip to content

Commit

Permalink
santad: Don't get code signature info for non Mach-O's. (#277)
Browse files Browse the repository at this point in the history
  • Loading branch information
russellhancox authored Jun 5, 2018
1 parent 61a67e4 commit 9595f80
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions Source/santad/SNTExecutionController.m
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,16 @@ - (void)validateBinaryWithMessage:(santa_message_t)message {
[_driverManager postToKernelAction:ACTION_RESPOND_ACK forVnodeID:message.vnode_id];
}

// Get codesigning info about the file.
NSError *csError;
MOLCodesignChecker *csInfo =
[[MOLCodesignChecker alloc] initWithBinaryPath:binInfo.path
fileDescriptor:binInfo.fileHandle.fileDescriptor
error:&csError];
// Ignore codesigning if there are any errors with the signature.
if (csError) csInfo = nil;
// Get codesigning info about the file but only if it's a Mach-O.
MOLCodesignChecker *csInfo;
if (binInfo.isMachO) {
NSError *csError;
csInfo = [[MOLCodesignChecker alloc] initWithBinaryPath:binInfo.path
fileDescriptor:binInfo.fileHandle.fileDescriptor
error:&csError];
// Ignore codesigning if there are any errors with the signature.
if (csError) csInfo = nil;
}

// Actually make the decision.
SNTCachedDecision *cd = [self.policyProcessor decisionForFileInfo:binInfo
Expand Down

0 comments on commit 9595f80

Please sign in to comment.