Skip to content

Commit

Permalink
Update Process.m
Browse files Browse the repository at this point in the history
  • Loading branch information
objective-see committed Sep 11, 2024
1 parent 27036e7 commit d7155c7
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions Shared/Libraries/FileMonitor/Process.m
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,9 @@ -(id)init:(es_message_t*)message csOption:(NSUInteger)csOption
//init uuid
self.uid = audit_token_to_euid(process->audit_token);

//add cs flags
self.csFlags = [NSNumber numberWithUnsignedInt:process->codesigning_flags];

//path
self.path = convertStringToken(&process->executable->path);

Expand All @@ -168,6 +171,17 @@ -(id)init:(es_message_t*)message csOption:(NSUInteger)csOption
// via inode, so will be same binary (though pid/args, etc will be different)
cachedProcess = [processesCache objectForKey:inode];

//(basic) sanity check
// make sure cs flags still match
if(YES != [self.csFlags isEqualTo:cachedProcess.csFlags])
{
//unset
cachedProcess = nil;

//remove
[processesCache removeObjectForKey:inode];
}

//generate name
if(nil == cachedProcess)
{
Expand All @@ -190,9 +204,6 @@ -(id)init:(es_message_t*)message csOption:(NSUInteger)csOption
self.architecture = cachedProcess.architecture;
}

//add cs flags
self.csFlags = [NSNumber numberWithUnsignedInt:process->codesigning_flags];

//add signing id
if(nil == cachedProcess)
{
Expand Down

0 comments on commit d7155c7

Please sign in to comment.