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

Update SNTPolicyProcessor to use a map #1304

Merged
merged 15 commits into from
May 9, 2024

Conversation

pmarkowsky
Copy link
Contributor

@pmarkowsky pmarkowsky commented Mar 8, 2024

This PR refactors SNTPolicyProcessor to use a flat_hash_map instead of the switch statement.

This is being done for two reasons:

  1. To make it easier to add rules in the future or change the states
  2. In preparation for more advanced rules e.g. something to solve Support for advanced rulesets, including evaluation of flags, via Common Expression Language #1200

@pmarkowsky pmarkowsky added santad Work related to the Santa Daemon authorizer labels Mar 8, 2024
@pmarkowsky pmarkowsky added this to the 2024.4 milestone Mar 8, 2024
@pmarkowsky pmarkowsky self-assigned this Mar 8, 2024
@pmarkowsky pmarkowsky force-pushed the markowsky/refactor-policy-processor branch from d73d15f to d642bde Compare March 12, 2024 21:07
Source/santad/SNTPolicyProcessor.mm Outdated Show resolved Hide resolved
Source/santad/SNTPolicyProcessor.mm Outdated Show resolved Hide resolved
Source/santad/SNTPolicyProcessor.mm Outdated Show resolved Hide resolved
Source/santad/SNTPolicyProcessor.mm Outdated Show resolved Hide resolved
Source/santad/SNTPolicyProcessor.mm Outdated Show resolved Hide resolved
Source/santad/SNTPolicyProcessor.mm Outdated Show resolved Hide resolved
@pmarkowsky pmarkowsky force-pushed the markowsky/refactor-policy-processor branch 2 times, most recently from f747b57 to 95c1351 Compare March 25, 2024 19:25
@pmarkowsky pmarkowsky marked this pull request as ready for review April 1, 2024 20:38
@pmarkowsky pmarkowsky requested a review from a team as a code owner April 1, 2024 20:38
@pmarkowsky pmarkowsky force-pushed the markowsky/refactor-policy-processor branch from 95c1351 to 3e19d5c Compare April 1, 2024 20:38
russellhancox
russellhancox previously approved these changes Apr 1, 2024
Source/santad/SNTPolicyProcessor.mm Outdated Show resolved Hide resolved
Source/santad/SNTPolicyProcessor.mm Outdated Show resolved Hide resolved
Source/santad/SNTPolicyProcessor.mm Outdated Show resolved Hide resolved
Source/santad/SNTPolicyProcessor.mm Outdated Show resolved Hide resolved
Source/santad/SNTPolicyProcessor.mm Outdated Show resolved Hide resolved
Source/santad/SNTPolicyProcessor.mm Show resolved Hide resolved
Source/santad/SNTPolicyProcessor.mm Show resolved Hide resolved
Source/santad/SNTPolicyProcessor.mm Outdated Show resolved Hide resolved
Source/santad/SNTPolicyProcessor.mm Outdated Show resolved Hide resolved
Source/santad/SNTPolicyProcessor.mm Outdated Show resolved Hide resolved
…ement

Update SNTPolicyProcessor to use a map instead of a giant switch statement.

Add unit tests for the method that sets SNTCachedDecision values.
@pmarkowsky pmarkowsky force-pushed the markowsky/refactor-policy-processor branch from 8e8e9ae to 9efe329 Compare April 24, 2024 03:50
@pmarkowsky pmarkowsky requested a review from mlw April 24, 2024 03:50
Source/santad/SNTPolicyProcessorTest.m Outdated Show resolved Hide resolved
Source/santad/SNTPolicyProcessor.mm Outdated Show resolved Hide resolved
Source/santad/SNTPolicyProcessor.mm Outdated Show resolved Hide resolved
Source/santad/SNTPolicyProcessor.mm Outdated Show resolved Hide resolved
Source/santad/SNTPolicyProcessorTest.m Outdated Show resolved Hide resolved
Source/santad/SNTPolicyProcessorTest.m Outdated Show resolved Hide resolved
@pmarkowsky pmarkowsky requested a review from mlw May 9, 2024 13:10
mlw
mlw previously approved these changes May 9, 2024
Source/santad/SNTPolicyProcessor.h Outdated Show resolved Hide resolved
Source/santad/SNTPolicyProcessor.mm Show resolved Hide resolved
Co-authored-by: Russell Hancox <russellhancox@users.noreply.github.com>
russellhancox
russellhancox previously approved these changes May 9, 2024
@mlw mlw merged commit 6cca5ab into google:main May 9, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
authorizer santad Work related to the Santa Daemon
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants