Skip to content
This repository has been archived by the owner on Feb 5, 2025. It is now read-only.

Commit

Permalink
santad: SNTPolicyProcessor fix nil scope check (#208)
Browse files Browse the repository at this point in the history
Fixes `santactl rule --check` returning `Whitelisted (Scope)` incorrectly
  • Loading branch information
tburgin authored Oct 6, 2017
1 parent 1c95e8e commit 0c39342
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Source/santad/SNTPolicyProcessor.m
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ - (SNTCachedDecision *)decisionForFilePath:(NSString *)filePath
/// @return @c YES if file is in scope, @c NO otherwise.
///
- (NSString *)fileIsScopeWhitelisted:(SNTFileInfo *)fi {
if (!fi) return nil;

// Determine if file is within a whitelisted path
NSRegularExpression *re = [[SNTConfigurator configurator] whitelistPathRegex];
if ([re numberOfMatchesInString:fi.path options:0 range:NSMakeRange(0, fi.path.length)]) {
Expand All @@ -147,6 +149,8 @@ - (NSString *)fileIsScopeWhitelisted:(SNTFileInfo *)fi {
}

- (NSString *)fileIsScopeBlacklisted:(SNTFileInfo *)fi {
if (!fi) return nil;

NSRegularExpression *re = [[SNTConfigurator configurator] blacklistPathRegex];
if ([re numberOfMatchesInString:fi.path options:0 range:NSMakeRange(0, fi.path.length)]) {
return @"Blacklist Regex";
Expand Down

0 comments on commit 0c39342

Please sign in to comment.