-
Notifications
You must be signed in to change notification settings - Fork 298
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* WIP: UI: open cert modal, hookup silence checkbox. Add cert helper funcs. * Popup dialog on file access violation. Support config-based and custom messages. * Send message to TTY on file access rule violation * TTYWriter Write now takes an es_process_t. Fix async data lifespan issue. * Dedupe TTY message printing per process per rule * Some minor swift beautification * Remove main app from dock when showing file access dialog * Update header docs * Remove define guards for ObjC header file * Update Source/common/CertificateHelpers.h Co-authored-by: Russell Hancox <[email protected]> * Fix comment typo Co-authored-by: Russell Hancox <[email protected]> * Use #import for ObjC headers * Use #import for ObjC header Co-authored-by: Russell Hancox <[email protected]> * lint * Comment use of escape sequences --------- Co-authored-by: Russell Hancox <[email protected]>
- Loading branch information
1 parent
d2e5aec
commit 3be45fd
Showing
23 changed files
with
434 additions
and
148 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/// Copyright 2023 Google LLC | ||
/// | ||
/// Licensed under the Apache License, Version 2.0 (the "License"); | ||
/// you may not use this file except in compliance with the License. | ||
/// You may obtain a copy of the License at | ||
/// | ||
/// https://www.apache.org/licenses/LICENSE-2.0 | ||
/// | ||
/// Unless required by applicable law or agreed to in writing, software | ||
/// distributed under the License is distributed on an "AS IS" BASIS, | ||
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
/// See the License for the specific language governing permissions and | ||
/// limitations under the License. | ||
|
||
#import <Foundation/Foundation.h> | ||
#import <MOLCertificate/MOLCertificate.h> | ||
#include <sys/cdefs.h> | ||
|
||
__BEGIN_DECLS | ||
|
||
/** | ||
Return a string representing publisher info from the provided certs | ||
@param certs A certificate chain | ||
@param teamID A team ID to be displayed for apps from the App Store | ||
@return A string that tries to be more helpful to users by extracting | ||
appropriate information from the certificate chain. | ||
*/ | ||
NSString *Publisher(NSArray<MOLCertificate *> *certs, NSString *teamID); | ||
|
||
/** | ||
Return an array of the underlying SecCertificateRef's for the given array | ||
of MOLCertificates. | ||
@param certs An array of MOLCertificates | ||
@return An array of SecCertificateRefs. WARNING: If the refs need to be used | ||
for a long time be careful to properly CFRetain/CFRelease the returned items. | ||
*/ | ||
NSArray<id> *CertificateChain(NSArray<MOLCertificate *> *certs); | ||
|
||
__END_DECLS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/// Copyright 2023 Google LLC | ||
/// | ||
/// Licensed under the Apache License, Version 2.0 (the "License"); | ||
/// you may not use this file except in compliance with the License. | ||
/// You may obtain a copy of the License at | ||
/// | ||
/// https://www.apache.org/licenses/LICENSE-2.0 | ||
/// | ||
/// Unless required by applicable law or agreed to in writing, software | ||
/// distributed under the License is distributed on an "AS IS" BASIS, | ||
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
/// See the License for the specific language governing permissions and | ||
/// limitations under the License. | ||
|
||
#import "Source/common/CertificateHelpers.h" | ||
|
||
#include <Security/SecCertificate.h> | ||
|
||
NSString *Publisher(NSArray<MOLCertificate *> *certs, NSString *teamID) { | ||
MOLCertificate *leafCert = [certs firstObject]; | ||
|
||
if ([leafCert.commonName isEqualToString:@"Apple Mac OS Application Signing"]) { | ||
return [NSString stringWithFormat:@"App Store (Team ID: %@)", teamID]; | ||
} else if (leafCert.commonName && leafCert.orgName) { | ||
return [NSString stringWithFormat:@"%@ - %@", leafCert.orgName, leafCert.commonName]; | ||
} else if (leafCert.commonName) { | ||
return leafCert.commonName; | ||
} else if (leafCert.orgName) { | ||
return leafCert.orgName; | ||
} else { | ||
return nil; | ||
} | ||
} | ||
|
||
NSArray<id> *CertificateChain(NSArray<MOLCertificate *> *certs) { | ||
NSMutableArray *certArray = [NSMutableArray arrayWithCapacity:[certs count]]; | ||
for (MOLCertificate *cert in certs) { | ||
[certArray addObject:(id)cert.certRef]; | ||
} | ||
|
||
return certArray; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.