Skip to content

Commit

Permalink
signature check of fat binaries (keybase#16111)
Browse files Browse the repository at this point in the history
  • Loading branch information
maxtaco authored Feb 19, 2019
1 parent 8278989 commit cfe1f89
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions osx/Helper/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
<key>CFBundleName</key>
<string>Helper</string>
<key>CFBundleVersion</key>
<string>1.0.39</string>
<string>1.0.40</string>
<key>KBBuild</key>
<string>3</string>
<key>CFBundleShortVersionString</key>
<string>1.0.39</string>
<string>1.0.40</string>
<key>SMAuthorizedClients</key>
<array>
<string>anchor apple generic and (certificate leaf[field.1.2.840.113635.100.6.1.9] /* exists */ or certificate 1[field.1.2.840.113635.100.6.2.6] /* exists */ and certificate leaf[field.1.2.840.113635.100.6.1.13] /* exists */ and certificate leaf[subject.OU] = &quot;99229SGT5K&quot;) and (identifier &quot;keybase.Installer2&quot; or identifier &quot;keybase.Keybase&quot;)</string>
Expand Down
2 changes: 1 addition & 1 deletion osx/Helper/KBHelper.m
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ - (void)checkKeybaseResource:(NSURL *)bin withIdentifier:(NSString *)identifier
NSString *nsRequirement = [NSString stringWithFormat:@"anchor apple generic %@ and (certificate leaf[field.1.2.840.113635.100.6.1.9] /* exists */ or certificate 1[field.1.2.840.113635.100.6.2.6] /* exists */ and certificate leaf[field.1.2.840.113635.100.6.1.13] /* exists */ and certificate leaf[subject.OU] = \"99229SGT5K\")", identifier];

SecRequirementCreateWithString((__bridge CFStringRef)nsRequirement,kSecCSDefaultFlags, &keybaseRequirement);
OSStatus codeCheckResult = SecStaticCodeCheckValidityWithErrors(staticCode, kSecCSDefaultFlags, keybaseRequirement, NULL);
OSStatus codeCheckResult = SecStaticCodeCheckValidityWithErrors(staticCode, (kSecCSDefaultFlags | kSecCSStrictValidate | kSecCSCheckNestedCode | kSecCSCheckAllArchitectures | kSecCSEnforceRevocationChecks), keybaseRequirement, NULL);
if (codeCheckResult != errSecSuccess) {
*error = KBMakeError(codeCheckResult, @"Binary not signed by Keybase");
}
Expand Down
2 changes: 1 addition & 1 deletion osx/Helper/fs.m
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ +(void)checkKeybaseResource:(NSURL *)bin identifier:(NSString *)identifier error
NSString *nsRequirement = [NSString stringWithFormat:@"anchor apple generic %@ and (certificate leaf[field.1.2.840.113635.100.6.1.9] /* exists */ or certificate 1[field.1.2.840.113635.100.6.2.6] /* exists */ and certificate leaf[field.1.2.840.113635.100.6.1.13] /* exists */ and certificate leaf[subject.OU] = \"99229SGT5K\")", identifier];

SecRequirementCreateWithString((__bridge CFStringRef)nsRequirement,kSecCSDefaultFlags, &keybaseRequirement);
OSStatus codeCheckResult = SecStaticCodeCheckValidityWithErrors(staticCode, kSecCSDefaultFlags, keybaseRequirement, NULL);
OSStatus codeCheckResult = SecStaticCodeCheckValidityWithErrors(staticCode, (kSecCSDefaultFlags | kSecCSStrictValidate | kSecCSCheckNestedCode | kSecCSCheckAllArchitectures | kSecCSEnforceRevocationChecks), keybaseRequirement, NULL);
if (codeCheckResult != errSecSuccess) {
*error = KBMakeError(codeCheckResult, @"Binary not signed by Keybase");
}
Expand Down
10 changes: 5 additions & 5 deletions osx/Installer/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,25 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.1.72</string>
<string>1.1.73</string>
<key>CFBundleSignature</key>
<string>KEYB</string>
<key>CFBundleVersion</key>
<string>1.1.72</string>
<string>1.1.73</string>
<key>KBFuseBuild</key>
<string>3.8.2</string>
<key>KBFuseVersion</key>
<string>3.8.2</string>
<key>KBHelperBuild</key>
<string>1.0.39</string>
<string>1.0.40</string>
<key>KBHelperVersion</key>
<string>1.0.39</string>
<string>1.0.40</string>
<key>LSMinimumSystemVersion</key>
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
<key>LSUIElement</key>
<true/>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2018 Keybase. All rights reserved.</string>
<string>Copyright © 2019 Keybase. All rights reserved.</string>
<key>NSMainNibFile</key>
<string>MainMenu</string>
<key>NSPrincipalClass</key>
Expand Down
2 changes: 1 addition & 1 deletion osx/KBKit/KBKit/Component/KBAppBundle.m
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ - (void)validate:(NSString *)sourcePath completion:(KBCompletion)completion {
return;
}
CFErrorRef err;
if (SecStaticCodeCheckValidityWithErrors((SecCodeRef)staticCodeRef, kSecCSDefaultFlags, requirementRef, &err) != errSecSuccess) {
if (SecStaticCodeCheckValidityWithErrors((SecCodeRef)staticCodeRef, (kSecCSDefaultFlags | kSecCSStrictValidate | kSecCSCheckNestedCode | kSecCSCheckAllArchitectures | kSecCSEnforceRevocationChecks), requirementRef, &err) != errSecSuccess) {
completion(KBMakeError(-1, @"Failed to validate bundle signature: Check"));
return;
}
Expand Down
2 changes: 1 addition & 1 deletion packaging/desktop/kbfuse.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ cd $dir
client_dir="$dir/../.."
fuse_dir="$client_dir/osx/Fuse"
tmp_dir="/tmp/desktop-kbfuse"
installer_url="https://prerelease.keybase.io/darwin-package/KeybaseInstaller-1.1.72-darwin.tgz"
installer_url="https://prerelease.keybase.io/darwin-package/KeybaseInstaller-1.1.73-darwin.tgz"

if [ "$EUID" -ne 0 ]; then
echo "Please run as root"
Expand Down
2 changes: 1 addition & 1 deletion packaging/desktop/package_darwin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ shared_support_dir="$out_dir/Keybase.app/Contents/SharedSupport"
resources_dir="$out_dir/Keybase.app/Contents/Resources/"

# The KeybaseInstaller.app installs KBFuse, keybase.Helper, services and CLI via a native app
installer_url="https://prerelease.keybase.io/darwin-package/KeybaseInstaller-1.1.72-darwin.tgz"
installer_url="https://prerelease.keybase.io/darwin-package/KeybaseInstaller-1.1.73-darwin.tgz"
# KeybaseUpdater.app is the native updater UI (prompt dialogs)
updater_url="https://prerelease.keybase.io/darwin-package/KeybaseUpdater-1.0.6-darwin.tgz"

Expand Down

0 comments on commit cfe1f89

Please sign in to comment.