<rdar://problem/11400476>

On Lion, because the rights initially doesn't exist in /etc/authorization, if an admin user logs in and uses lldb within the first 5 minutes, it is possible to do AuthorizationCopyRights on LaunchUsingXPCRightName and get the rights back. As another security measure, we make sure that the LaunchUsingXPCRightName rights actually exists.

Removed Xcode as the user of the XPC service to shrink the security surface area.

llvm-svn: 156424
This commit is contained in:
Han Ming Ong 2012-05-08 21:35:52 +00:00
parent 222bb03518
commit b9c53daa55
3 changed files with 11 additions and 5 deletions

View File

@ -33,7 +33,6 @@
<key>_AllowedClients</key>
<array>
<string> identifier = com.apple.lldb AND_APPLE_CODE_SIGNED</string>
<string> identifier = com.apple.dt.Xcode AND_APPLE_CODE_SIGNED</string>
</array>
<key>_RoleAccount</key>
<string>root</string>

View File

@ -33,10 +33,18 @@ int _validate_authorization(xpc_object_t message)
// Given a set of rights, return the subset that is currently authorized by the AuthorizationRef given; count(subset) > 0 -> success.
bool auth_success = (status == errAuthorizationSuccess && outAuthorizedRights && outAuthorizedRights->count > 0) ? true : false;
if (outAuthorizedRights) AuthorizationFreeItemSet(outAuthorizedRights);
return auth_success ? 0 : 3;
if (!auth_success)
return 3;
// On Lion, because the rights initially doesn't exist in /etc/authorization, if an admin user logs in and uses lldb within the first 5 minutes,
// it is possible to do AuthorizationCopyRights on LaunchUsingXPCRightName and get the rights back.
// As another security measure, we make sure that the LaunchUsingXPCRightName rights actually exists.
status = AuthorizationRightGet(LaunchUsingXPCRightName, NULL);
if (status == errAuthorizationSuccess)
return 0;
else
return 4;
}
#endif

View File

@ -33,7 +33,6 @@
<key>_AllowedClients</key>
<array>
<string> identifier = com.apple.lldb AND_APPLE_CODE_SIGNED</string>
<string> identifier = com.apple.dt.Xcode AND_APPLE_CODE_SIGNED</string>
</array>
<key>ServiceType</key>
<string>Application</string>