Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add transitive whitelisting to Santa #224

Merged
merged 46 commits into from
Jul 20, 2018

Conversation

nguyen-phillip
Copy link
Contributor

Creates a new queue to listen for compiler-related events in santa-driver (exec, close, and rename), and these are passed on to SNTCompilerController which uses them to determine when it should auto-whitelist compiled binaries.

@nguyen-phillip
Copy link
Contributor Author

For testing purposes:
sudo santactl rule --compiler --force --path /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld
sudo santactl rule --compiler --force --path /usr/local/go/pkg/tool/darwin_amd64/link

Copy link
Contributor

@tburgin tburgin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work so far!

As discussed we should be able to get rid of the compiler queue and use the decision queue instead. This only works if we are able to reduce the number of compiler messages sent over the great divide by filtering "file closes" based on known compiler PIDs. These known PIDs would be reported to the kernel by the exec decision from santad and invalidated by either a polling kernel thread or another message from santad (triggered by the kqueue syscall (funny we don't have access to this in kernel 😭 )).

This is a large change. It removes most of the boilerplate queue code and a lot of the user-space code.

I have added a few comments on things I don't think need removing for this new approach.

I will do a thorough review once we confirm the new plan works and the pull is updated.

@@ -1051,11 +1057,31 @@
attributes = {
LastUpgradeCheck = 0730;
TargetAttributes = {
0D0016A1192BCD3C005E7FCD = {
DevelopmentTeam = 9L79GAXCBC;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove any DevelopmentTeam additions

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

// because that was the first unused integer from sys/kauth.h. The reason that we don't
// simply use the KAUTH_VNODE_WRITE_DATA constant as is is because it overlaps with the other
// KAUTH_FILEOP constants.
#define KAUTH_FILEOP_WRITE 8
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is still needed we should give the actions used by KAUTH_SCOPE_FILEOP room to grow. I don't really like the idea of adding our own action, but if we need to make it more than 8 incase fileop adds a new action in the future.

Maybe KAUTH_FILEOP_DELETE + 32 or something

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

}

- (void)runWithArguments:(NSArray *)arguments {
SNTConfigurator *config = [SNTConfigurator configurator];
if ([config syncBaseURL] && ![arguments containsObject:@"--check"]) {
// TODO: --force flag was added so that we could manually add compiler rules during testing.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can add the --force flag in an #ifdef DEBUG block so it can only be used on debug builds.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@nguyen-phillip
Copy link
Contributor Author

PTAL.

Also for testing with Xcode:
sudo santactl rule --force --compiler --path /usr/bin/codesign
And for rust:
sudo santactl rule --force --whitelist --path ~/.cargo/bin/rustc
sudo santactl rule --force --whitelist --path ~/.rustup/toolchains/stable-x86_64-apple-darwin/bin/rustc

Copy link
Contributor

@tburgin tburgin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great! My one main concern is around the thread management for the exit watcher. See the comments.

///
/// Sets timestamp of rule to the current time.
///
- (void)refreshTimestamp;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's odd to have a rw property as well another method that updates the property. I suggest removing this method and let the caller set the property.

Alternatively you could make the property readonly in the interface and keep this method. If so, small nit: resetTimestamp sounds a little closer to the effective action.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renamed refreshTimestamp to resetTimestamp. I made timestamp into a readonly property, but SNTRuleTable needs to be able to set it with results from the rules database. So this meant adding an extra initializer for SNTRule.

I like having the method to reset the timestamp inside of SNTRule so that the logic for setting the timestamp value is self-contained. Otherwise we'd have to duplicate the code to set the timestamp in two places, which could lead to errors if we ever decided to change the format.

return ([self.shasum isEqual:o.shasum] &&
self.state == o.state &&
self.type == o.type &&
self.timestamp == o.timestamp);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we ever need to differentiate between two SNTRuleStateWhitelistTransitive rules that have the same shasum but different timestamps?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, removed.

// FileOpCallback method. The KAUTH_FILEOP_* constants are defined in
// sys/kauth.h and run from 1--7. KAUTH_VNODE_WRITE_DATA is already defined as
// 4 so it overlaps with the other KAUTH_FILEOP_* constants and can't be used.
// We define KAUTH_FILEOP_WRITE as something >> 7.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: > 7 (>> 7 makes me think of right shift 7)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed. Sorry -- bad shorthand for" much greater than"

@@ -286,6 +297,13 @@ santa_action_t SantaDecisionManager::GetFromCache(uint64_t identifier) {
decision_cache->remove(identifier);
return ACTION_UNSET;
}
} else if (result == ACTION_RESPOND_ALLOW_TRANSITIVE) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the need to remove these from the cache after a certain amount of time? They are whitelisted binaries as far as we are concerned. They should follow the same cache invalidation procedures as standard whitelisted binaries.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's because the the timestamps on the transitive rules only get updated when the rules are retrieved from the rules database. If a transitive rule ends up in the decision cache and manages to stay in the cache for a long period of time, then its timestamp will never be updated even though the user might be running the binary it applies to fairly often. Setting an expiration time on the transitive rules forces them to be periodically retrieved from the database, keeping its last access timestamp fresh.

struct timespec ts; // time to sleep between checks
SantaDecisionManager *sdm; // reference to SantaDecisionManager
} pid_monitor_info;

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: extra new line

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed. (BTW, this struct definition and the following function might should be moved somewhere else since they're not part of the class, I just liked having all the process monitoring code close together).

case ACTION_NOTIFY_CLOSE:
// Determine if we should add a transitive whitelisting rule for this new file.
// Requires that writing process was a compiler and that new file is executable.
[self.compilerController checkForNewExecutable:message];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

checkForNewExecutable: is not very exact. I would expect that name to return a BOOL. Maybe something like createTransitiveRule:?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.


// Check if this file is an executable.
SNTFileInfo *fi = [[SNTFileInfo alloc] initWithPath:@(target)];
if (fi.isExecutable) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: if (!fi.isExecutable) return;
Then the meat of the method does not have to be indented.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

// Check if there is an existing (non-transitive) rule for this file. We leave existing rules
// alone, so that a whitelist or blacklist rule can't be overwritten by a transitive one.
SNTRuleTable *ruleTable = [SNTDatabaseController ruleTable];
SNTRule *prevRule = [ruleTable ruleForBinarySHA256:fi.SHA1 certificateSHA256:nil];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fi.SHA256

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yikes! Done.

customMsg:@""];

// Add the new rule to the rules database.
NSError *err = [[NSError alloc] init];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NSError *err;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

/// artifacts on disk. Simply pass nil to fileInfo and pass in the desired SHA256s.
///
- (nonnull SNTCachedDecision *)decisionForFileInfo:(nullable SNTFileInfo *)fileInfo
fileSHA256:(nullable NSString *)fileSHA256
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

colon align

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

… set the enable_transitive_whitelisting flag. updated logic for when new rules trigger a decision cache flush.
@nguyen-phillip
Copy link
Contributor Author

Fixed all the small stuff, plus added in code for getting compiler rules and transitive whitelisting config from server. Need to spend some more time thinking about how to deal with the abandoned thread issue and keeping the transitive rule timestamps fresh.

…es during logging. clear out old transitive rules. treat transitive rules as unknown if transitive whitelisting is disabled
} else {
if (failed_compiler_queue_requests_ > 0) {
failed_compiler_queue_requests_--;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can remove this pop and re-queue bit, it's unnecessary.

proc_t proc = proc_find(pid);
if (!proc) break;
proc_rele(proc);
msleep(param, NULL, 0, "", &ts);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As nothing is waking this up, use IOSleep instead

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And make the timeout a constant in SantaDecisionManager.h

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Added kPidMonitorSleepTimeMilliseconds constant as a private member, and PidMonitorSleepTimeMilliseconds() as a public method to return it.

// This keeps track of all pids associated with compiler processes. It is defined as a global
// variable so that the pid monitor threads can access it without needing to reference
// our instance of SantaDecisionManager.
static SantaCache<bool> *compiler_pid_set_ = new SantaCache<bool>(500, 5);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed:

  • make this a property of SDM
  • add a counter to SDM (like listener_invocations_) to track the number of threads that are outstanding
  • atomically inc/dec that counter before making and terminating the threads
  • during SDM dealloc (or ClientDisconnect, maybe?) make this cache pointer NULL to make the threads begin terminating and then sleep-loop until the number of outstanding threads drops to 0.
  • use a struct to pass the SDM reference and the pid to the threads when they start

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Added pid_monitor_thread_count_ to track the number of threads. Added PidMonitorThreadsShouldExit() function for the threads to check, since cache pointer is private. Currently calling StopPidMonitorThreads() from SDM's free() method. Alternately I think maybe this could be called from SantaDriver::stop() similar to StopListener. Not sure which is better.

#import <Foundation/Foundation.h>
#import "SNTKernelCommon.h"

@class SNTDriverManager;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leftover?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed.

} else if (cd.decision == SNTEventStateAllowTransitive) {
// We also upgrade transitive rule decisions. These are filtered by SNTPolicyProcessor before
// they get here so that we only receive them if transitive whitelisting is enabled.
// TODO(nguyenphillip): may not need to distinguish transitive allows in the kernel anymore.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope. Got rid of ACTION_RESPOND_ALLOW_TRANSITIVE and just store SNTEventStateAllowTransitive decisions as ACTION_RESPOND_ALLOW in SantaDecisionManager's decision cache.

if (cd.decision == SNTEventStateAllowCompiler &&
[[SNTConfigurator configurator] transitiveWhitelistingEnabled]) {
// If rule indicated that the allowed binary was a compiler and Santa is configured to allow
// transitive whitelisting, upgrade the action to ACTION_RESPOND_ALLOW_COMPILER.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could SNTPolicyProcessor not make this determination?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved the check for transitiveWhitelistingEnabled to SNTPolicyProcessor so that if it's not enabled, the decision passed to SNTExecutionController from a SNTRuleStateWhitelistCompiler rule will be downgraded to SNTEventStateAllow.

…er_pid_set_doesn't have to be a global variable. Also keep track of number of pid monitor threads in SantaDecisionManager and wait for them to exit before freed.

* Don't store ACTION_RESPOND_ALLOW_TRANSITIVE in the kernel decision cache any more.  The kernel doesn't need to know about transitive rules.
* Switch from msleep to IOSleep.
@nguyen-phillip
Copy link
Contributor Author

PTAL

/// whitelist any executables that they produce. If NO, SNTRuleStateWhitelistCompiler rules are
/// interpreted as if they were simply SNTRuleStateWhitelist rules. Defaults to NO.
///
@property BOOL transitiveWhitelistingEnabled;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There doesn't seem to be any corresponding keys in the .m for this, so it's not configurable in a mobileconfig or persisted between runs from a sync server. I think it should probably be one of those keys that can be configured with a mobileconfig but can be overridden by a server, so you'll need to add a key constant and add it to both the arrays in init.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. added key to both with a DEBUG guard around the syncServerKeys entry to be removed when the sync server supports it.

// termination and then remove the process pid from cache of compiler pids.
static void pid_monitor(void *param, __unused wait_result_t wait_result) {
pid_monitor_info *info = (pid_monitor_info *)param;
uint32_t sleep_time = info->sdm->PidMonitorSleepTimeMilliseconds();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be inside your if statement below

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

static void pid_monitor(void *param, __unused wait_result_t wait_result) {
pid_monitor_info *info = (pid_monitor_info *)param;
uint32_t sleep_time = info->sdm->PidMonitorSleepTimeMilliseconds();
if (info->sdm) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be on the safe side I'd check info is not nullptr first too

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.


// Keep track of how many times we've slept waiting for the pid monitor
// threads to exit. If we sleep for more than 5 seconds, give up on waiting.
int wait_count = 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This worries me - if the thread didn't decrement the thread count because it hasn't been scheduled there's a possibility it'll be scheduled after SDM is freed and then attempt to access it which will almost certainly panic.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Took out the counter. I was worried that SDM might get stuck waiting forever if something went wrong with the thread count, but I suppose that is probably preferable to a kernel panic. Added code to increase the sleep time to 5 sec if the wait loop is still going after 10 sec, in case this does get stuck.


pid_t client_pid_;

kauth_listener_t vnode_listener_;
kauth_listener_t fileop_listener_;

struct timespec ts_;

// When set to true, Santa will check all ancestors of a process to determine
// if it is a compiler.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There doesn't appear to be a way to make this true - is it just for testing or are we going to add a driver method to enable it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eventually there should be a way to change it along with other parameters that are currently defined as constants. Added a TODO for this and moved this to live with the other constants.

// Arguments that are passed to pid_monitor thread.
typedef struct {
pid_t pid; // process to monitor
SantaDecisionManager *sdm; // reference to SantaDecisionManager
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a TODO somewhere appropriate to split this out of SDM at some point? I'd like to make SDM smaller and I think this can almost entirely live on its own.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Don't give up on pid monitor thread cleanup, but increase check time instead.
…en out by compilers.

The rule will be deleted from the cache once SNTCompilerController finishes checking and
hashing the file.  This prevents race condition from blocking binaries that are in the
process of being whitelisted.
to be a compiler only if its pid is in the set and it still has the same
parent.  This should help prevent a fork bomb from managing to steal a
compiler pid from a compiler that has just exited but not been reaped from
the compiler_pid_set_ yet.
Copy link
Contributor Author

@nguyen-phillip nguyen-phillip left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PTAL. Also I'm wondering if SNTCompilerController should be deleted and its few methods moved into something else, like SNTApplication or SNTPolicyProcessor maybe. It made sense as a class back when it was doing more, but most of that work is now in the kernel, so it's really just a single method without any stored state. If moved into SNTPolicyProcessor, we'd just need to instantiate that class in SNTApplication and pass it off to SNTExecutionController as opposed to SNTExecutionController owning its own instance.

(x == ACTION_RESPOND_ALLOW || \
x == ACTION_RESPOND_DENY || \
x == ACTION_RESPOND_ALLOW_COMPILER || \
x == ACTION_RESPOND_ALLOW_TEMPORARY)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does ACTION_RESPOND_TOOLONG need to be a valid response?

@nguyen-phillip
Copy link
Contributor Author

Also, here's an example of what the logs look like now for executing "go run hello.go" where a temporary allow rule is being stored in the kernel while SNTCompilerController figures out the permanent rule.

[2018-02-01T21:14:15.339Z] I santad: action=EXEC|decision=ALLOW|reason=COMPILER|sha256=9f16595bf07331ddb52968c67a478b3a4bc2a3c234a8d1b12341ff0d80b92e57|pid=32312|ppid=32
306|uid=484912|user=nguyenphillip|gid=5000|group=eng|mode=L|path=/usr/local/go/pkg/tool/darwin_amd64/link|args=/usr/local/go/pkg/tool/darwin_amd64/link -o /var/folders/9
f/0snyvwy57519np346scs_fh800fsjh/T/go-build271032812/command-line-arguments/_obj/exe/hello -L /var/folders/9f/0snyvwy57519np346scs_fh800fsjh/T/go-build271032812 -s -w -e
xtld=clang -buildmode=exe -buildid=508f41f1ce9f716b155fc6d59098d21e416ecfeb /var/folders/9f/0snyvwy57519np346scs_fh800fsjh/T/go-build271032812/command-line-arguments.a

[2018-02-01T21:14:15.440Z] I santad: action=EXEC|decision=ALLOW|reason=PENDING_TRANSITIVE|sha256=pending|pid=32313|ppid=32306|uid=484912|user=nguyenphillip|gid=5000|grou
p=eng|mode=L|path=/private/var/folders/9f/0snyvwy57519np346scs_fh800fsjh/T/go-build271032812/command-line-arguments/_obj/exe/hello|args=/var/folders/9f/0snyvwy57519np346
scs_fh800fsjh/T/go-build271032812/command-line-arguments/_obj/exe/hello

[2018-02-01T21:14:15.452Z] I santad: action=WHITELIST|pid=32312|path=/private/var/folders/9f/0snyvwy57519np346scs_fh800fsjh/T/go-build271032812/command-line-arguments/_o
bj/exe/hello|sha256=03157283163866e3d7c480ab540bea175551f2e980cde2d4bddd0efe4a4a18a4

russellhancox
russellhancox previously approved these changes Apr 3, 2018
@nguyen-phillip
Copy link
Contributor Author

PTAL. Started monitoring file rename events as well as file close because under Xcode 9, if the output file already exists, ld writes to a new file and renames it, but never explicitly closes it.

@nguyen-phillip
Copy link
Contributor Author

Adding in some logs to show the behavior of ld with Xcode 9. This is every fileop and vnode scope event that occurs during execution of "clang -o hello hello.c"

  1. First time running, no pre-existing output file:

KAUTH_FILEOP_EXEC, uid=484912, pid=22122, ppid=674, process=clang, vnode=0x7fffff806e434c98, path=/usr/bin/clang
KAUTH_FILEOP_EXEC, uid=484912, pid=22122, ppid=674, process=clang, vnode=0x7fffff8059bb33e0, path=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
KAUTH_VNODE_EXECUTE|, uid=484912, pid=22122, ppid=674, process=clang, vp=0x7fffff8056e5cba0, dvp=0, path=/KauthTest
KAUTH_VNODE_READ_ATTRIBUTES|KAUTH_VNODE_READ_SECURITY|, uid=484912, pid=22122, ppid=674, process=clang, vp=0x7fffff8056e5cba0, dvp=0, path=/KauthTest
KAUTH_VNODE_READ_ATTRIBUTES|KAUTH_VNODE_READ_SECURITY|, uid=484912, pid=22122, ppid=674, process=clang, vp=0x7fffff8056e5cba0, dvp=0, path=/KauthTest
KAUTH_FILEOP_EXEC, uid=484912, pid=22122, ppid=674, process=clang, vnode=0x7fffff8059bb33e0, path=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
KAUTH_VNODE_READ_ATTRIBUTES|KAUTH_VNODE_READ_SECURITY|, uid=484912, pid=22123, ppid=22122, process=clang, vp=0x7fffff8056e5cba0, dvp=0, path=/KauthTest
KAUTH_VNODE_READ_DATA|, uid=484912, pid=22123, ppid=22122, process=clang, vp=0x7fffff8053f4b268, dvp=0, path=/KauthTest/hello.c
KAUTH_FILEOP_OPEN, uid=484912, pid=22123, ppid=22122, process=clang, vnode=0x7fffff8053f4b268, path=/KauthTest/hello.c
KAUTH_FILEOP_CLOSE, uid=484912, pid=22123, ppid=22122, process=clang, vnode=0x7fffff8053f4b268, path=/KauthTest/hello.c, modified=false
KAUTH_FILEOP_EXEC, uid=484912, pid=22122, ppid=674, process=clang, vnode=0x7fffff805abf35d0, path=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld
KAUTH_VNODE_WRITE_DATA|, uid=484912, pid=22124, ppid=22122, process=ld, vp=0x7fffff8056e5cba0, dvp=0, path=/KauthTest
KAUTH_FILEOP_OPEN, uid=484912, pid=22124, ppid=22122, process=ld, vnode=0x7fffff806f29cba0, path=/KauthTest/hello
KAUTH_FILEOP_CLOSE, uid=484912, pid=22124, ppid=22122, process=ld, vnode=0x7fffff806f29cba0, path=/KauthTest/hello, modified=true
KAUTH_VNODE_EXECUTE|, uid=484912, pid=22124, ppid=22122, process=ld, vp=0x7fffff8056e5cba0, dvp=0, path=/KauthTest
KAUTH_VNODE_WRITE_DATA|, uid=484912, pid=22124, ppid=22122, process=ld, vp=0x7fffff806f29cba0, dvp=0, path=/KauthTest/hello
KAUTH_VNODE_READ_ATTRIBUTES|KAUTH_VNODE_READ_SECURITY|, uid=484912, pid=674, ppid=671, process=bash, vp=0x7fffff8056e5cba0, dvp=0, path=/KauthTest
KAUTH_VNODE_READ_ATTRIBUTES|KAUTH_VNODE_READ_SECURITY|, uid=484912, pid=60, ppid=1, process=fseventsd, vp=0x7fffff8056e5cba0, dvp=0, path=/KauthTest
KAUTH_VNODE_READ_ATTRIBUTES|, uid=484912, pid=626, ppid=1, process=Finder, vp=0x7fffff8056e5cba0, dvp=0, path=/KauthTest
KAUTH_VNODE_READ_ATTRIBUTES|, uid=484912, pid=626, ppid=1, process=Finder, vp=0x7fffff8056e5cba0, dvp=0, path=/KauthTest
KAUTH_VNODE_WRITE_DATA|KAUTH_VNODE_APPEND_DATA|KAUTH_VNODE_DELETE_CHILD|KAUTH_VNODE_ACCESS|, uid=484912, pid=626, ppid=1, process=Finder, vp=0x7fffff8056e5cba0, dvp=0, path=/KauthTest
KAUTH_VNODE_READ_DATA|KAUTH_VNODE_ACCESS|, uid=484912, pid=626, ppid=1, process=Finder, vp=0x7fffff8056e5cba0, dvp=0, path=/KauthTest
KAUTH_VNODE_EXECUTE|KAUTH_VNODE_ACCESS|, uid=484912, pid=626, ppid=1, process=Finder, vp=0x7fffff8056e5cba0, dvp=0, path=/KauthTest
KAUTH_VNODE_READ_ATTRIBUTES|, uid=484912, pid=626, ppid=1, process=Finder, vp=0x7fffff8056e5cba0, dvp=0, path=/KauthTest
KAUTH_VNODE_READ_ATTRIBUTES|KAUTH_VNODE_READ_SECURITY|, uid=484912, pid=60, ppid=1, process=fseventsd, vp=0x7fffff8056e5cba0, dvp=0, path=/KauthTest
KAUTH_VNODE_READ_ATTRIBUTES|KAUTH_VNODE_READ_SECURITY|, uid=484912, pid=60, ppid=1, process=fseventsd, vp=0x7fffff8056e5cba0, dvp=0, path=/KauthTest
KAUTH_VNODE_READ_ATTRIBUTES|KAUTH_VNODE_READ_SECURITY|, uid=484912, pid=60, ppid=1, process=fseventsd, vp=0x7fffff8056e5cba0, dvp=0, path=/KauthTest
KAUTH_VNODE_READ_ATTRIBUTES|KAUTH_VNODE_READ_SECURITY|, uid=484912, pid=60, ppid=1, process=fseventsd, vp=0x7fffff8056e5cba0, dvp=0, path=/KauthTest
KAUTH_VNODE_READ_ATTRIBUTES|KAUTH_VNODE_READ_SECURITY|, uid=484912, pid=60, ppid=1, process=fseventsd, vp=0x7fffff8056e5cba0, dvp=0, path=/KauthTest
KAUTH_VNODE_EXECUTE|, uid=484912, pid=60, ppid=1, process=fseventsd, vp=0x7fffff8056e5cba0, dvp=0, path=/KauthTest
KAUTH_VNODE_READ_ATTRIBUTES|KAUTH_VNODE_READ_SECURITY|, uid=484912, pid=60, ppid=1, process=fseventsd, vp=0x7fffff806f29cba0, dvp=0, path=/KauthTest/hello

  1. Second time running, "hello" output file already exists:

KAUTH_FILEOP_EXEC, uid=484912, pid=24788, ppid=674, process=clang, vnode=0x7fffff806e434c98, path=/usr/bin/clang
KAUTH_FILEOP_EXEC, uid=484912, pid=24788, ppid=674, process=clang, vnode=0x7fffff8059bb33e0, path=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
KAUTH_VNODE_EXECUTE|, uid=484912, pid=24788, ppid=674, process=clang, vp=0x7fffff8056e5cba0, dvp=0, path=/KauthTest
KAUTH_VNODE_READ_ATTRIBUTES|KAUTH_VNODE_READ_SECURITY|, uid=484912, pid=24788, ppid=674, process=clang, vp=0x7fffff8056e5cba0, dvp=0, path=/KauthTest
KAUTH_VNODE_READ_ATTRIBUTES|KAUTH_VNODE_READ_SECURITY|, uid=484912, pid=24788, ppid=674, process=clang, vp=0x7fffff8056e5cba0, dvp=0, path=/KauthTest
KAUTH_FILEOP_EXEC, uid=484912, pid=24788, ppid=674, process=clang, vnode=0x7fffff8059bb33e0, path=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
KAUTH_VNODE_READ_ATTRIBUTES|KAUTH_VNODE_READ_SECURITY|, uid=484912, pid=24789, ppid=24788, process=clang, vp=0x7fffff8056e5cba0, dvp=0, path=/KauthTest
KAUTH_VNODE_READ_DATA|, uid=484912, pid=24789, ppid=24788, process=clang, vp=0x7fffff8053f4b268, dvp=0, path=/KauthTest/hello.c
KAUTH_FILEOP_OPEN, uid=484912, pid=24789, ppid=24788, process=clang, vnode=0x7fffff8053f4b268, path=/KauthTest/hello.c
KAUTH_FILEOP_CLOSE, uid=484912, pid=24789, ppid=24788, process=clang, vnode=0x7fffff8053f4b268, path=/KauthTest/hello.c, modified=false
KAUTH_FILEOP_EXEC, uid=484912, pid=24788, ppid=674, process=clang, vnode=0x7fffff805abf35d0, path=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld
KAUTH_VNODE_WRITE_DATA|KAUTH_VNODE_ACCESS|, uid=484912, pid=24790, ppid=24788, process=ld, vp=0x7fffff806f29cba0, dvp=0, path=/KauthTest/hello
KAUTH_VNODE_READ_ATTRIBUTES|KAUTH_VNODE_READ_SECURITY|, uid=484912, pid=24790, ppid=24788, process=ld, vp=0x7fffff806f29cba0, dvp=0, path=/KauthTest/hello
KAUTH_VNODE_DELETE|, uid=484912, pid=24790, ppid=24788, process=ld, vp=0x7fffff806f29cba0, dvp=0x7fffff8056e5cba0, path=/KauthTest/hello
KAUTH_FILEOP_DELETE, uid=484912, pid=24790, ppid=24788, process=ld, vnode=0x7fffff806f29cba0, path=/KauthTest/hello
KAUTH_VNODE_EXECUTE|, uid=484912, pid=24790, ppid=24788, process=ld, vp=0x7fffff8056e5cba0, dvp=0, path=/KauthTest
KAUTH_VNODE_WRITE_DATA|, uid=484912, pid=24790, ppid=24788, process=ld, vp=0x7fffff8056e5cba0, dvp=0, path=/KauthTest
KAUTH_FILEOP_OPEN, uid=484912, pid=24790, ppid=24788, process=ld, vnode=0x7fffff806f29cba0, path=/KauthTest/hello.ld_mLgH2P
KAUTH_VNODE_CHECKIMMUTABLE|, uid=484912, pid=24790, ppid=24788, process=ld, vp=0x7fffff806f29cba0, dvp=0, path=/KauthTest/hello.ld_mLgH2P
KAUTH_VNODE_WRITE_SECURITY|, uid=484912, pid=24790, ppid=24788, process=ld, vp=0x7fffff806f29cba0, dvp=0, path=/KauthTest/hello.ld_mLgH2P
KAUTH_VNODE_DELETE|, uid=484912, pid=24790, ppid=24788, process=ld, vp=0x7fffff806f29cba0, dvp=0x7fffff8056e5cba0, path=/KauthTest/hello.ld_mLgH2P
KAUTH_VNODE_WRITE_DATA|, uid=484912, pid=24790, ppid=24788, process=ld, vp=0x7fffff8056e5cba0, dvp=0, path=/KauthTest
KAUTH_FILEOP_RENAME, uid=484912, pid=24790, ppid=24788, process=ld, oldpath=/KauthTest/hello.ld_mLgH2P, newpath=/KauthTest/hello
KAUTH_VNODE_READ_ATTRIBUTES|KAUTH_VNODE_READ_SECURITY|, uid=484912, pid=674, ppid=671, process=bash, vp=0x7fffff8056e5cba0, dvp=0, path=/KauthTest
KAUTH_VNODE_READ_ATTRIBUTES|KAUTH_VNODE_READ_SECURITY|, uid=484912, pid=60, ppid=1, process=fseventsd, vp=0x7fffff8056e5cba0, dvp=0, path=/KauthTest
KAUTH_VNODE_READ_ATTRIBUTES|, uid=484912, pid=626, ppid=1, process=Finder, vp=0x7fffff8056e5cba0, dvp=0, path=/KauthTest
KAUTH_VNODE_READ_ATTRIBUTES|, uid=484912, pid=626, ppid=1, process=Finder, vp=0x7fffff8056e5cba0, dvp=0, path=/KauthTest
KAUTH_VNODE_WRITE_DATA|KAUTH_VNODE_APPEND_DATA|KAUTH_VNODE_DELETE_CHILD|KAUTH_VNODE_ACCESS|, uid=484912, pid=626, ppid=1, process=Finder, vp=0x7fffff8056e5cba0, dvp=0, path=/KauthTest
KAUTH_VNODE_READ_DATA|KAUTH_VNODE_ACCESS|, uid=484912, pid=626, ppid=1, process=Finder, vp=0x7fffff8056e5cba0, dvp=0, path=/KauthTest
KAUTH_VNODE_EXECUTE|KAUTH_VNODE_ACCESS|, uid=484912, pid=626, ppid=1, process=Finder, vp=0x7fffff8056e5cba0, dvp=0, path=/KauthTest
KAUTH_VNODE_READ_ATTRIBUTES|, uid=484912, pid=626, ppid=1, process=Finder, vp=0x7fffff8056e5cba0, dvp=0, path=/KauthTest
KAUTH_VNODE_READ_ATTRIBUTES|KAUTH_VNODE_READ_SECURITY|, uid=484912, pid=60, ppid=1, process=fseventsd, vp=0x7fffff8056e5cba0, dvp=0, path=/KauthTest
KAUTH_VNODE_READ_ATTRIBUTES|KAUTH_VNODE_READ_SECURITY|, uid=484912, pid=60, ppid=1, process=fseventsd, vp=0x7fffff8056e5cba0, dvp=0, path=/KauthTest
KAUTH_VNODE_READ_ATTRIBUTES|KAUTH_VNODE_READ_SECURITY|, uid=484912, pid=60, ppid=1, process=fseventsd, vp=0x7fffff8056e5cba0, dvp=0, path=/KauthTest
KAUTH_VNODE_READ_ATTRIBUTES|KAUTH_VNODE_READ_SECURITY|, uid=484912, pid=60, ppid=1, process=fseventsd, vp=0x7fffff8056e5cba0, dvp=0, path=/KauthTest
KAUTH_VNODE_READ_ATTRIBUTES|KAUTH_VNODE_READ_SECURITY|, uid=484912, pid=60, ppid=1, process=fseventsd, vp=0x7fffff8056e5cba0, dvp=0, path=/KauthTest
KAUTH_VNODE_EXECUTE|, uid=484912, pid=60, ppid=1, process=fseventsd, vp=0x7fffff8056e5cba0, dvp=0, path=/KauthTest
KAUTH_VNODE_READ_DATA|KAUTH_VNODE_ACCESS|, uid=484912, pid=60, ppid=1, process=fseventsd, vp=0x7fffff8056e5cba0, dvp=0, path=/KauthTest
KAUTH_VNODE_READ_ATTRIBUTES|KAUTH_VNODE_READ_SECURITY|, uid=484912, pid=60, ppid=1, process=fseventsd, vp=0x7fffff806f29cba0, dvp=0, path=/KauthTest/hello

@tburgin
Copy link
Contributor

tburgin commented Jun 1, 2018

I would be curious to see what OpenBSM logs look like when performing "clang -o hello hello.c

@nguyen-phillip
Copy link
Contributor Author

From OpenBSM, looking at all events, but filtering on the path:

  1. First time running "clang -o hello hello.c" without existing output file.

process=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang|header, 130, 11, access(2), 0, Fri Jun 1 18:37:26 2018, + 839 msec|path, hello.c|path, /KauthTest/hello.c|return, success, 0|
process=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang|header, 144, 11, open(2) - read, 0, Fri Jun 1 18:37:26 2018, + 847 msec|argument, 2, 0x1000000, flags|path, hello.c|path, /KauthTest/hello.c|return, success, 3|
process=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang|header, 142, 11, fcntl(2), 0, Fri Jun 1 18:37:26 2018, + 847 msec|argument, 2, 0x15e, cmd|path, /KauthTest/hello.c|argument, 1, 0x3, fd|return, success, 0|
process=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang|header, 130, 11, close(2), 0, Fri Jun 1 18:37:26 2018, + 848 msec|argument, 2, 0x3, fd|path, /KauthTest/hello.c|return, success, 0|
process=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld|header, 104, 11, open(2) - read,write,creat, 0, Fri Jun 1 18:37:26 2018, + 883 msec|argument, 3, 0x1ed, mode|argument, 2, 0x202, flags|path, hello|return, success, 3|
process=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld|header, 128, 11, close(2), 0, Fri Jun 1 18:37:26 2018, + 884 msec|argument, 2, 0x3, fd|path, /KauthTest/hello|return, success, 0|
process=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld|header, 126, 11, truncate(2), 0, Fri Jun 1 18:37:26 2018, + 884 msec|path, hello|path, /KauthTest/hello|return, success, 0|
process=/System/Library/CoreServices/Finder.app/Contents/MacOS/Finder|header, 125, 11, getattrlist(), 0, Fri Jun 1 18:37:27 2018, + 347 msec|path, /KauthTest|path, /KauthTest|return, success, 0|
process=/System/Library/CoreServices/Finder.app/Contents/MacOS/Finder|header, 125, 11, getattrlist(), 0, Fri Jun 1 18:37:27 2018, + 347 msec|path, /KauthTest|path, /KauthTest|return, success, 0|
process=/System/Library/CoreServices/Finder.app/Contents/MacOS/Finder|header, 125, 11, getattrlist(), 0, Fri Jun 1 18:37:27 2018, + 348 msec|path, /KauthTest|path, /KauthTest|return, success, 0|

  1. Second run of "clang -o hello hello.c" executed immediately after.

process=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang|header, 130, 11, access(2), 0, Fri Jun 1 18:37:33 2018, + 260 msec|path, hello.c|path, /KauthTest/hello.c|return, success, 0|
process=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang|header, 144, 11, open(2) - read, 0, Fri Jun 1 18:37:33 2018, + 267 msec|argument, 2, 0x1000000, flags|path, hello.c|path, /KauthTest/hello.c|return, success, 3|
process=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang|header, 142, 11, fcntl(2), 0, Fri Jun 1 18:37:33 2018, + 267 msec|argument, 2, 0x15e, cmd|path, /KauthTest/hello.c|argument, 1, 0x3, fd|return, success, 0|
process=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang|header, 130, 11, close(2), 0, Fri Jun 1 18:37:33 2018, + 267 msec|argument, 2, 0x3, fd|path, /KauthTest/hello.c|return, success, 0|
process=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld|header, 126, 11, access(2), 0, Fri Jun 1 18:37:33 2018, + 300 msec|path, hello|path, /KauthTest/hello|return, success, 0|
process=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld|header, 126, 11, access(2), 0, Fri Jun 1 18:37:33 2018, + 300 msec|path, hello|path, /KauthTest/hello|return, success, 0|
process=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld|header, 126, 11, unlink(2), 0, Fri Jun 1 18:37:33 2018, + 300 msec|path, hello|path, /KauthTest/hello|return, success, 0|
process=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld|header, 114, 11, openat(2) - read,write,create, 0, Fri Jun 1 18:37:33 2018, + 301 msec|argument, 4, 0x180, mode|argument, 3, 0xa02, flags|path, hello.ld_JHAOc5|return, success, 3|
process=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld|header, 138, 11, ftruncate(2), 0, Fri Jun 1 18:37:33 2018, + 301 msec|path, /KauthTest/hello.ld_JHAOc5|argument, 1, 0x3, fd|return, success, 0|
process=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld|header, 168, 11, chmod(2), 0, Fri Jun 1 18:37:33 2018, + 301 msec|argument, 2, 0x1ed, new file mode|path, hello.ld_JHAOc5|path, /KauthTest/hello.ld_JHAOc5|return, success, 0|
process=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld|header, 155, 11, rename(2), 0, Fri Jun 1 18:37:33 2018, + 301 msec|path, hello.ld_JHAOc5|path, /KauthTest/hello.ld_JHAOc5|path, hello|return, success, 0|
process=/System/Library/CoreServices/Finder.app/Contents/MacOS/Finder|header, 125, 11, getattrlist(), 0, Fri Jun 1 18:37:33 2018, + 736 msec|path, /KauthTest|path, /KauthTest|return, success, 0|
process=/System/Library/CoreServices/Finder.app/Contents/MacOS/Finder|header, 125, 11, getattrlist(), 0, Fri Jun 1 18:37:33 2018, + 736 msec|path, /KauthTest|path, /KauthTest|return, success, 0|
process=/System/Library/CoreServices/Finder.app/Contents/MacOS/Finder|header, 125, 11, getattrlist(), 0, Fri Jun 1 18:37:33 2018, + 736 msec|path, /KauthTest|path, /KauthTest|return, success, 0|
process=/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/FSEvents.framework/Versions/A/Support/fseventsd|header, 125, 11, access(2), 0, Fri Jun 1 18:37:34 2018, + 236 msec|path, /KauthTest|path, /KauthTest|return, success, 0|

  1. And a separate test, this is opening a file (hello_stream.txt), writing to it incrementally over a period of a few seconds, then exiting without an explicit close().

process=/usr/libexec/taskgated|header, 139, 11, open(2) - read, 0, Fri Jun 1 18:40:18 2018, + 303 msec|argument, 2, 0x1100004, flags|path, /KauthTest|path, /KauthTest|return, success, 3|
process=/usr/libexec/taskgated|header, 122, 11, close(2), 0, Fri Jun 1 18:40:18 2018, + 303 msec|argument, 2, 0x3, fd|path, /KauthTest|return, success, 0|
process=/usr/libexec/taskgated|header, 139, 11, open(2) - read, 0, Fri Jun 1 18:40:18 2018, + 303 msec|argument, 2, 0x1100004, flags|path, /KauthTest|path, /KauthTest|return, success, 3|
process=/usr/libexec/taskgated|header, 122, 11, close(2), 0, Fri Jun 1 18:40:18 2018, + 303 msec|argument, 2, 0x3, fd|path, /KauthTest|return, success, 0|
process=/usr/libexec/taskgated|header, 153, 11, open(2) - read, 0, Fri Jun 1 18:40:18 2018, + 303 msec|argument, 2, 0x0, flags|path, /KauthTest/stream|path, /KauthTest/stream|return, success, 3|
process=/usr/libexec/taskgated|header, 129, 11, close(2), 0, Fri Jun 1 18:40:18 2018, + 305 msec|argument, 2, 0x3, fd|path, /KauthTest/stream|return, success, 0|
process=/KauthTest/stream|header, 144, 11, execve(2), 0, Fri Jun 1 18:40:18 2018, + 305 msec|exec arg, ./stream|path, ./stream|path, /KauthTest/stream|return, success, 0|
process=/KauthTest/stream|header, 130, 11, open(2) - read, 0, Fri Jun 1 18:40:18 2018, + 306 msec|argument, 2, 0x0, flags|path, .|path, /KauthTest|return, success, 3|
process=/KauthTest/stream|header, 134, 11, fcntl(2), 0, Fri Jun 1 18:40:18 2018, + 306 msec|argument, 2, 0x15e, cmd|path, /KauthTest|argument, 1, 0x3, fd|return, success, 0|
process=/KauthTest/stream|header, 122, 11, close(2), 0, Fri Jun 1 18:40:18 2018, + 306 msec|argument, 2, 0x3, fd|path, /KauthTest|return, success, 0|
process=/KauthTest/stream|header, 115, 11, open(2) - write,creat,trunc, 0, Fri Jun 1 18:40:18 2018, + 308 msec|argument, 3, 0x1a4, mode|argument, 2, 0x601, flags|path, hello_stream.txt|return, success, 3|
process=/System/Library/CoreServices/Finder.app/Contents/MacOS/Finder|header, 125, 11, getattrlist(), 0, Fri Jun 1 18:40:18 2018, + 450 msec|path, /KauthTest|path, /KauthTest|return, success, 0|
process=/System/Library/CoreServices/Finder.app/Contents/MacOS/Finder|header, 125, 11, getattrlist(), 0, Fri Jun 1 18:40:18 2018, + 450 msec|path, /KauthTest|path, /KauthTest|return, success, 0|
process=/System/Library/CoreServices/Finder.app/Contents/MacOS/Finder|header, 125, 11, getattrlist(), 0, Fri Jun 1 18:40:18 2018, + 450 msec|path, /KauthTest|path, /KauthTest|return, success, 0|

process=/System/Library/CoreServices/Finder.app/Contents/MacOS/Finder|header, 125, 11, getattrlist(), 0, Fri Jun 1 18:40:29 2018, + 625 msec|path, /KauthTest|path, /KauthTest|return, success, 0|
process=/System/Library/CoreServices/Finder.app/Contents/MacOS/Finder|header, 125, 11, getattrlist(), 0, Fri Jun 1 18:40:29 2018, + 625 msec|path, /KauthTest|path, /KauthTest|return, success, 0|
process=/System/Library/CoreServices/Finder.app/Contents/MacOS/Finder|header, 125, 11, getattrlist(), 0, Fri Jun 1 18:40:29 2018, + 626 msec|path, /KauthTest|path, /KauthTest|return, success, 0|

@@ -57,6 +57,9 @@
exit(1); \
} while (0)

const char *ldPath =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is brittle. Instead of hardcoding, use this:

xcrun -f ld, which prints the full path to the active ld

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

IOConnectCallStructMethod(self.connection, kSantaUserClientAllowBinary,
&vnodeid, sizeof(vnodeid), 0, 0);
break;
case ACTION_RESPOND_DENY:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

case indents are wrong

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@nguyen-phillip nguyen-phillip merged commit 6dc7387 into google:master Jul 20, 2018
dskfh pushed a commit to dskfh/santa that referenced this pull request Jul 17, 2020
Add transitive whitelisting.

Binaries may be identified with WHITELIST_COMPILER rules.  Any executable they output will then be marked locally with a transitive whitelist rule and allowed to run if the TransitiveWhitelistingEnabled config key is true.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants