Some more information:
This can pass on one run and fail, with no code changes on the next, however as Jens explains the failure has the hardened flag set but not the hard and kill flags
We noticed the script we used in Xcode to build the test targets from the xctest app was passing on its environment and hence our test hardened apps had XCTest framework included, we removed this ( env -i xcodebuild ...) but still get the intermittent failures
The test signed/hardened apps are command line apps (as Jens said, no bundles)
only the hardening bit (0x10000) is set in the flags, and the dynamic status always has the same 0x10000 set but is 50/50 missing the 0x300 values:
Our log line shows us trying to AND the 0x301 with the dynamic status flags but failing to get the 0x300 matching, also not too sure what the high 0x22 bits are?
code for pid 15481 does not have required status : 0x22010001 does not match 0x00000301
Explicitly setting the hard and kill flags (and hardened) in codesign works fine, but it seems manual work compared to asking for hardened only
Our test command line app (the file create can be watched for by the launcher show we know the app is in main before we tests it's flags)
#import <Foundation/Foundation.h>
int main(int argc, const char * argv[]) {
// if we have a filepath on the command line create a file so the caller knows we have started
if (argc == 2) {
// get the filepath
NSString* filename = [NSString stringWithUTF8String:argv[1]];
// fill with any data, we just use the filepath
NSData* data = [filename dataUsingEncoding:NSUTF8StringEncoding];
// write to a file
[data writeToFile:filename atomically:true];
}
// Wait for ever, the caller will call terminate when they are done
BOOL shouldKeepRunning = YES;
NSRunLoop *runLoop = [NSRunLoop currentRunLoop];
while (shouldKeepRunning && [runLoop runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantFuture]]) {
sleep(1);
}
}
Topic:
Code Signing
SubTopic:
General
Tags: