-
Notifications
You must be signed in to change notification settings - Fork 45
Add Silverfort Identity Security integration #430
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
Open
FrankGasparovic
wants to merge
3
commits into
chronicle:main
Choose a base branch
from
silverfort-open-source:add-silverfort-integration
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
content/response_integrations/third_party/partner/silverfort/.python-version
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| 3.11 | ||
Empty file.
Empty file.
74 changes: 74 additions & 0 deletions
74
content/response_integrations/third_party/partner/silverfort/actions/change_policy_state.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| """Change Policy State action for Silverfort integration.""" | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| from typing import TYPE_CHECKING | ||
|
|
||
| from TIPCommon.extraction import extract_action_param | ||
|
|
||
| from ..core.base_action import SilverfortAction | ||
| from ..core.constants import CHANGE_POLICY_STATE_SCRIPT_NAME | ||
|
|
||
| if TYPE_CHECKING: | ||
| from typing import NoReturn | ||
|
|
||
|
|
||
| SUCCESS_MESSAGE: str = "Successfully {action} policy: {policy_id}" | ||
| ERROR_MESSAGE: str = "Failed to change policy state!" | ||
|
|
||
|
|
||
| class ChangePolicyState(SilverfortAction): | ||
| """Action to enable or disable a policy in Silverfort.""" | ||
|
|
||
| def __init__(self) -> None: | ||
| """Initialize the Change Policy State action.""" | ||
| super().__init__(CHANGE_POLICY_STATE_SCRIPT_NAME) | ||
| self.output_message: str = "" | ||
| self.error_output_message: str = ERROR_MESSAGE | ||
|
|
||
| def _extract_action_parameters(self) -> None: | ||
| """Extract action parameters.""" | ||
| self.params.policy_id = extract_action_param( | ||
| self.soar_action, | ||
| param_name="Policy ID", | ||
| is_mandatory=True, | ||
| print_value=True, | ||
| ) | ||
| self.params.enabled = extract_action_param( | ||
| self.soar_action, | ||
| param_name="Enable Policy", | ||
| is_mandatory=True, | ||
| input_type=bool, | ||
| print_value=True, | ||
| ) | ||
|
|
||
| def _perform_action(self, _=None) -> None: | ||
| """Perform the change policy state action.""" | ||
| client = self._get_policy_client() | ||
|
|
||
| client.change_policy_state( | ||
| policy_id=self.params.policy_id, | ||
| state=self.params.enabled, | ||
| ) | ||
|
|
||
| action = "enabled" if self.params.enabled else "disabled" | ||
|
|
||
| self.json_results = { | ||
| "policy_id": self.params.policy_id, | ||
| "enabled": self.params.enabled, | ||
| "status": action, | ||
| } | ||
|
|
||
| self.output_message = SUCCESS_MESSAGE.format( | ||
| action=action, | ||
| policy_id=self.params.policy_id, | ||
| ) | ||
|
|
||
|
|
||
| def main() -> NoReturn: | ||
| """Main entry point for the Change Policy State action.""" | ||
| ChangePolicyState().run() | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| main() |
21 changes: 21 additions & 0 deletions
21
...ent/response_integrations/third_party/partner/silverfort/actions/change_policy_state.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| creator: admin | ||
| description: Enable or disable an authentication policy in Silverfort. This is a | ||
| quick way to toggle a policy's active state without modifying its configuration. | ||
| dynamic_results_metadata: | ||
| - result_example_path: resources/change_policy_state_JsonResult_example.json | ||
| result_name: JsonResult | ||
| show_result: true | ||
| integration_identifier: Silverfort | ||
| name: Change Policy State | ||
| parameters: | ||
| - default_value: '' | ||
| description: The ID of the policy to enable or disable. | ||
| is_mandatory: true | ||
| name: Policy ID | ||
| type: string | ||
| - default_value: true | ||
| description: Set to true to enable the policy, false to disable it. | ||
| is_mandatory: true | ||
| name: Enable Policy | ||
| type: boolean | ||
| script_result_name: is_success |
73 changes: 73 additions & 0 deletions
73
content/response_integrations/third_party/partner/silverfort/actions/get_entity_risk.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| """Get Entity Risk action for Silverfort integration.""" | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| from typing import TYPE_CHECKING | ||
|
|
||
| from TIPCommon.extraction import extract_action_param | ||
|
|
||
| from ..core.base_action import SilverfortAction | ||
| from ..core.constants import GET_ENTITY_RISK_SCRIPT_NAME | ||
| from ..core.exceptions import SilverfortInvalidParameterError | ||
|
|
||
| if TYPE_CHECKING: | ||
| from typing import NoReturn | ||
|
|
||
|
|
||
| SUCCESS_MESSAGE: str = "Successfully retrieved risk information for: {entity}" | ||
| ERROR_MESSAGE: str = "Failed to get entity risk information!" | ||
|
|
||
|
|
||
| class GetEntityRisk(SilverfortAction): | ||
| """Action to get risk information for a user or resource.""" | ||
|
|
||
| def __init__(self) -> None: | ||
| """Initialize the Get Entity Risk action.""" | ||
| super().__init__(GET_ENTITY_RISK_SCRIPT_NAME) | ||
| self.output_message: str = "" | ||
| self.error_output_message: str = ERROR_MESSAGE | ||
|
|
||
| def _extract_action_parameters(self) -> None: | ||
| """Extract action parameters.""" | ||
| self.params.user_principal_name = extract_action_param( | ||
| self.soar_action, | ||
| param_name="User Principal Name", | ||
| print_value=True, | ||
| ) | ||
| self.params.resource_name = extract_action_param( | ||
| self.soar_action, | ||
| param_name="Resource Name", | ||
| print_value=True, | ||
| ) | ||
|
|
||
| def _validate_params(self) -> None: | ||
| """Validate action parameters.""" | ||
| if not self.params.user_principal_name and not self.params.resource_name: | ||
| raise SilverfortInvalidParameterError( | ||
| "Either 'User Principal Name' or 'Resource Name' must be provided." | ||
| ) | ||
|
|
||
| def _perform_action(self, _=None) -> None: | ||
| """Perform the get entity risk action.""" | ||
| client = self._get_risk_client() | ||
|
|
||
| entity_risk = client.get_entity_risk( | ||
| user_principal_name=self.params.user_principal_name, | ||
| resource_name=self.params.resource_name, | ||
| ) | ||
|
|
||
| # Set JSON result | ||
| self.json_results = entity_risk.to_json() | ||
|
|
||
| # Determine entity identifier for message | ||
| entity = self.params.user_principal_name or self.params.resource_name | ||
| self.output_message = SUCCESS_MESSAGE.format(entity=entity) | ||
|
|
||
|
|
||
| def main() -> NoReturn: | ||
| """Main entry point for the Get Entity Risk action.""" | ||
| GetEntityRisk().run() | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| main() |
24 changes: 24 additions & 0 deletions
24
content/response_integrations/third_party/partner/silverfort/actions/get_entity_risk.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| creator: admin | ||
| description: Get risk information for a user or resource from Silverfort. Returns | ||
| the current risk score, severity, and risk factors. You must provide either the | ||
| User Principal Name (for users) or Resource Name (for resources). | ||
| dynamic_results_metadata: | ||
| - result_example_path: resources/get_entity_risk_JsonResult_example.json | ||
| result_name: JsonResult | ||
| show_result: true | ||
| integration_identifier: Silverfort | ||
| name: Get Entity Risk | ||
| parameters: | ||
| - default_value: '' | ||
| description: The user principal name (e.g., user@domain.com). Either this or Resource | ||
| Name must be provided. | ||
| is_mandatory: false | ||
| name: User Principal Name | ||
| type: string | ||
| - default_value: '' | ||
| description: The resource name for non-user entities. Either this or User Principal | ||
| Name must be provided. | ||
| is_mandatory: false | ||
| name: Resource Name | ||
| type: string | ||
| script_result_name: is_success |
60 changes: 60 additions & 0 deletions
60
content/response_integrations/third_party/partner/silverfort/actions/get_policy.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| """Get Policy action for Silverfort integration.""" | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| from typing import TYPE_CHECKING | ||
|
|
||
| from TIPCommon.extraction import extract_action_param | ||
|
|
||
| from ..core.base_action import SilverfortAction | ||
| from ..core.constants import GET_POLICY_SCRIPT_NAME | ||
|
|
||
| if TYPE_CHECKING: | ||
| from typing import NoReturn | ||
|
|
||
|
|
||
| SUCCESS_MESSAGE: str = "Successfully retrieved policy: {policy_name} (ID: {policy_id})" | ||
| ERROR_MESSAGE: str = "Failed to get policy information!" | ||
|
|
||
|
|
||
| class GetPolicy(SilverfortAction): | ||
| """Action to get policy details from Silverfort.""" | ||
|
|
||
| def __init__(self) -> None: | ||
| """Initialize the Get Policy action.""" | ||
| super().__init__(GET_POLICY_SCRIPT_NAME) | ||
| self.output_message: str = "" | ||
| self.error_output_message: str = ERROR_MESSAGE | ||
|
|
||
| def _extract_action_parameters(self) -> None: | ||
| """Extract action parameters.""" | ||
| self.params.policy_id = extract_action_param( | ||
| self.soar_action, | ||
| param_name="Policy ID", | ||
| is_mandatory=True, | ||
| print_value=True, | ||
| ) | ||
|
|
||
| def _perform_action(self, _=None) -> None: | ||
| """Perform the get policy action.""" | ||
| client = self._get_policy_client() | ||
|
|
||
| policy = client.get_policy(self.params.policy_id) | ||
|
|
||
| # Set JSON result | ||
| self.json_results = policy.to_json() | ||
|
|
||
| policy_name = policy.policy_name or f"Policy {self.params.policy_id}" | ||
| self.output_message = SUCCESS_MESSAGE.format( | ||
| policy_name=policy_name, | ||
| policy_id=self.params.policy_id, | ||
| ) | ||
|
|
||
|
|
||
| def main() -> NoReturn: | ||
| """Main entry point for the Get Policy action.""" | ||
| GetPolicy().run() | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| main() |
17 changes: 17 additions & 0 deletions
17
content/response_integrations/third_party/partner/silverfort/actions/get_policy.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| creator: admin | ||
| description: Get detailed information about a specific authentication policy from | ||
| Silverfort by its ID. Returns the policy configuration including users, groups, | ||
| sources, destinations, and action settings. | ||
| dynamic_results_metadata: | ||
| - result_example_path: resources/get_policy_JsonResult_example.json | ||
| result_name: JsonResult | ||
| show_result: true | ||
| integration_identifier: Silverfort | ||
| name: Get Policy | ||
| parameters: | ||
| - default_value: '' | ||
| description: The ID of the policy to retrieve. | ||
| is_mandatory: true | ||
| name: Policy ID | ||
| type: string | ||
| script_result_name: is_success |
60 changes: 60 additions & 0 deletions
60
content/response_integrations/third_party/partner/silverfort/actions/get_service_account.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| """Get Service Account action for Silverfort integration.""" | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| from typing import TYPE_CHECKING | ||
|
|
||
| from TIPCommon.extraction import extract_action_param | ||
|
|
||
| from ..core.base_action import SilverfortAction | ||
| from ..core.constants import GET_SERVICE_ACCOUNT_SCRIPT_NAME | ||
|
|
||
| if TYPE_CHECKING: | ||
| from typing import NoReturn | ||
|
|
||
|
|
||
| SUCCESS_MESSAGE: str = "Successfully retrieved service account: {display_name} ({guid})" | ||
| ERROR_MESSAGE: str = "Failed to get service account information!" | ||
|
|
||
|
|
||
| class GetServiceAccount(SilverfortAction): | ||
| """Action to get service account details from Silverfort.""" | ||
|
|
||
| def __init__(self) -> None: | ||
| """Initialize the Get Service Account action.""" | ||
| super().__init__(GET_SERVICE_ACCOUNT_SCRIPT_NAME) | ||
| self.output_message: str = "" | ||
| self.error_output_message: str = ERROR_MESSAGE | ||
|
|
||
| def _extract_action_parameters(self) -> None: | ||
| """Extract action parameters.""" | ||
| self.params.guid = extract_action_param( | ||
| self.soar_action, | ||
| param_name="Service Account GUID", | ||
| is_mandatory=True, | ||
| print_value=True, | ||
| ) | ||
|
|
||
| def _perform_action(self, _=None) -> None: | ||
| """Perform the get service account action.""" | ||
| client = self._get_service_account_client() | ||
|
|
||
| service_account = client.get_service_account(self.params.guid) | ||
|
|
||
| # Set JSON result | ||
| self.json_results = service_account.to_json() | ||
|
|
||
| display_name = service_account.display_name or service_account.upn or self.params.guid | ||
| self.output_message = SUCCESS_MESSAGE.format( | ||
| display_name=display_name, | ||
| guid=self.params.guid, | ||
| ) | ||
|
|
||
|
|
||
| def main() -> NoReturn: | ||
| """Main entry point for the Get Service Account action.""" | ||
| GetServiceAccount().run() | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| main() |
17 changes: 17 additions & 0 deletions
17
...ent/response_integrations/third_party/partner/silverfort/actions/get_service_account.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| creator: admin | ||
| description: Get detailed information about a specific service account from Silverfort | ||
| by its GUID. Returns the service account's attributes including risk, predictability, | ||
| protection status, and more. | ||
| dynamic_results_metadata: | ||
| - result_example_path: resources/get_service_account_JsonResult_example.json | ||
| result_name: JsonResult | ||
| show_result: true | ||
| integration_identifier: Silverfort | ||
| name: Get Service Account | ||
| parameters: | ||
| - default_value: '' | ||
| description: The GUID of the service account to retrieve. | ||
| is_mandatory: true | ||
| name: Service Account GUID | ||
| type: string | ||
| script_result_name: is_success |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.