SecCodeCheckValidity requiring kill option and/or Library Validation?

In the codesign(1) manpage, there is a "kill" option flag documented as:


> Code with the kill flag set will die when it becomes dynamically invalid. It is therefore safe to assume that code marked this way, once validated, will have continue to have a valid identity while alive.


I have some code in an XPC process that validates the code signature of incoming connections using SecCodeCheckValidity. I have a basic requirement worked out to check the signer's certificate and the process identifier, but I would also like to validate that the remote process has this kill flag set so that the process can't become tainted after I start communicating with it.


Is there a way via the requirements syntax or flags to have SecCodeCheckValidity fail if the SecCode object does not have the kill flag set?

I don’t think that the kill flag can be expressed in the requirements language. However, you can call

SecCodeCopySigningInformation
to get
kSecCodeInfoFlags
and check that.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"
SecCodeCheckValidity requiring kill option and/or Library Validation?
 
 
Q