santad: Add pid_suspend protection for other processes#904
Conversation
📝 WalkthroughWalkthroughThis pull request introduces anti-suspend signing ID protection, allowing Santa to prevent suspension of specified processes identified by their signing IDs. The feature includes configuration management through Changes
Sequence Diagram(s)sequenceDiagram
participant Config as SNTConfigurator
participant Observer as KVO Observer
participant TamperClient as SNTEndpointSecurityTamperResistance
participant ESAPI as EndpointSecurityAPI
participant Kernel as Endpoint Security Kernel
Config->>Observer: antiSuspendSigningIDs changed
Observer->>TamperClient: setAntiSuspendSigningIDs:newValue
TamperClient->>TamperClient: Update _antiSuspendSigningIDs (mutex-guarded)
TamperClient->>ESAPI: MuteTargetPathEvents(client, "/", kPrefix, {SUSPEND_RESUME})
ESAPI->>Kernel: es_mute_path_events(mute_action)
Kernel-->>ESAPI: mute confirmation
ESAPI-->>TamperClient: return success
Note over TamperClient,Kernel: Subsequent SUSPEND_RESUME events reach TamperClient for signing ID matching
TamperClient->>TamperClient: Match signing ID against _antiSuspendSigningIDs
alt Signing ID matches configured list
TamperClient->>Kernel: Deny suspension
else Signing ID does not match
TamperClient->>Kernel: Allow suspension
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 1 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@Source/santad/EventProviders/SNTEndpointSecurityTamperResistance.mm`:
- Around line 262-277: The ReaderMutexLock is being constructed with
_antiSuspendMutex by value but requires a pointer; update the
absl::ReaderMutexLock construction in SNTEndpointSecurityTamperResistance.mm
(the block using absl::ReaderMutexLock lock(_antiSuspendMutex)) to pass the
address of the mutex (use &_antiSuspendMutex) so the lock acquires the correct
mutex; ensure no other occurrences of absl::ReaderMutexLock in this file use the
mutex without the address-of operator.
- Around line 168-178: In muteAllProcessesForSuspendResumeIfNeeded, the
absl::ReaderMutexLock is being constructed with the mutex object instead of its
address; update the construction to pass a pointer to _antiSuspendMutex (i.e.,
use & _antiSuspendMutex) so the ReaderMutexLock is initialized with the mutex
address, leaving the surrounding check of _antiSuspendSigningIDs and the call to
[super muteTargetPaths:forEvents:] unchanged.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: ccce4027-22c1-4107-aeff-c8abd0cc7c7b
📒 Files selected for processing (12)
Source/common/SNTConfigurator.hSource/common/SNTConfigurator.mmSource/common/es/EndpointSecurityAPI.hSource/common/es/EndpointSecurityAPI.mmSource/common/es/MockEndpointSecurityAPI.hSource/common/es/SNTEndpointSecurityClient.mmSource/common/es/SNTEndpointSecurityClientBase.hSource/santad/BUILDSource/santad/EventProviders/SNTEndpointSecurityTamperResistance.hSource/santad/EventProviders/SNTEndpointSecurityTamperResistance.mmSource/santad/EventProviders/SNTEndpointSecurityTamperResistanceTest.mmSource/santad/Santad.mm
No description provided.