Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ repos:
- id: check-json
- id: check-yaml
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.15.22
rev: v0.16.1
hooks:
- id: ruff
args: [ "--fix", "--unsafe-fixes"] # Allow unsafe fixes (ruff pretty strict about what it can fix)
- id: ruff-format
- repo: https://github.com/djlint/djLint
rev: v1.40.7
rev: v1.43.1
hooks:
- id: djlint-reformat-django
- id: djlint-django
Expand Down Expand Up @@ -61,7 +61,7 @@ repos:
exclude: "README.md"
# Central hooks
- repo: https://github.com/phantomcyber/dev-cicd-tools
rev: v2.2.3
rev: v2.2.9
hooks:
- id: build-docs
language: python
Expand Down
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ Read only: **True**

PARAMETER | REQUIRED | DESCRIPTION | TYPE | CONTAINS
--------- | -------- | ----------- | ---- | --------
**credentials** | optional | Assumed role credentials | string | `aws credentials` |
**credentials** | optional | Assumed role credentials | password | `aws credentials` |

#### Action Output

Expand All @@ -102,7 +102,6 @@ action_result.summary.num_queries | numeric | | 7 |
action_result.message | string | | Num queries: 7 |
summary.total_objects | numeric | | 1 |
summary.total_objects_successful | numeric | | 1 |
action_result.parameter.credentials | string | `aws credentials` | {'AccessKeyId': 'TESTSJL6ZZZZZ3M7TEST', 'Expiration': '2021-06-07 22:28:04', 'SecretAccessKey': 'ZZZZZAmvLPictcVBPvjJx0d7MRezOuxiLCMZZZZZ', 'SessionToken': 'ZZZZZXIvYXdzEN///////////wEaDFRU0s4AVrw0k0oYICK4ATAzOqzAkg9bHY29lYmP59UvVOHjLufOy4s7SnAzOxGqGIXnukLis4TWNhrJl5R5nYyimrm6K/9d0Cw2SW9gO0ZRjEJHWJ+yY5Qk2QpWctS2BGn4n+G8cD6zEweCCMj+ScI5p8n7YI4wOdvXvOsVMmjV6F09Ujqr1w+NwoKXlglznXGs/7Q1kNZOMiioEhGUyoiHbQb37GCKslDK+oqe0KNaUKQ96YCepaLgMbMquDgdAM8I0TTxUO0o5ILF/gUyLT04R7QlOfktkdh6Qt0atTS+xeKi1hirKRizpJ8jjnxGQIikPRToL2v3ZZZZZZ=='} |

## action: 'run query'

Expand All @@ -121,7 +120,7 @@ PARAMETER | REQUIRED | DESCRIPTION | TYPE | CONTAINS
**database** | optional | Database to run query on | string | |
**s3_location** | required | S3 location to save results | string | |
**encryption** | optional | Encyption scheme of S3 location | string | |
**credentials** | optional | Assumed role credentials | string | `aws credentials` |
**credentials** | optional | Assumed role credentials | password | `aws credentials` |

#### Action Output

Expand All @@ -137,7 +136,6 @@ action_result.summary.num_rows | numeric | | 0 |
action_result.message | string | | Num rows: 0 |
summary.total_objects | numeric | | 1 |
summary.total_objects_successful | numeric | | 1 |
action_result.parameter.credentials | string | `aws credentials` | {'AccessKeyId': 'TESTSJL6ZZZZZ3M7TEST', 'Expiration': '2021-06-07 22:28:04', 'SecretAccessKey': 'ZZZZZAmvLPictcVBPvjJx0d7MRezOuxiLCMZZZZZ', 'SessionToken': 'ZZZZZXIvYXdzEN///////////wEaDFRU0s4AVrw0k0oYICK4ATAzOqzAkg9bHY29lYmP59UvVOHjLufOy4s7SnAzOxGqGIXnukLis4TWNhrJl5R5nYyimrm6K/9d0Cw2SW9gO0ZRjEJHWJ+yY5Qk2QpWctS2BGn4n+G8cD6zEweCCMj+ScI5p8n7YI4wOdvXvOsVMmjV6F09Ujqr1w+NwoKXlglznXGs/7Q1kNZOMiioEhGUyoiHbQb37GCKslDK+oqe0KNaUKQ96YCepaLgMbMquDgdAM8I0TTxUO0o5ILF/gUyLT04R7QlOfktkdh6Qt0atTS+xeKi1hirKRizpJ8jjnxGQIikPRToL2v3ZZZZZZ=='} |

______________________________________________________________________

Expand Down
24 changes: 2 additions & 22 deletions athena.json
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@
"parameters": {
"credentials": {
"description": "Assumed role credentials",
"data_type": "string",
"data_type": "password",
"primary": true,
"contains": [
"aws credentials"
Expand Down Expand Up @@ -273,16 +273,6 @@
"example_values": [
1
]
},
{
"data_path": "action_result.parameter.credentials",
"data_type": "string",
"example_values": [
"{'AccessKeyId': 'TESTSJL6ZZZZZ3M7TEST', 'Expiration': '2021-06-07 22:28:04', 'SecretAccessKey': 'ZZZZZAmvLPictcVBPvjJx0d7MRezOuxiLCMZZZZZ', 'SessionToken': 'ZZZZZXIvYXdzEN///////////wEaDFRU0s4AVrw0k0oYICK4ATAzOqzAkg9bHY29lYmP59UvVOHjLufOy4s7SnAzOxGqGIXnukLis4TWNhrJl5R5nYyimrm6K/9d0Cw2SW9gO0ZRjEJHWJ+yY5Qk2QpWctS2BGn4n+G8cD6zEweCCMj+ScI5p8n7YI4wOdvXvOsVMmjV6F09Ujqr1w+NwoKXlglznXGs/7Q1kNZOMiioEhGUyoiHbQb37GCKslDK+oqe0KNaUKQ96YCepaLgMbMquDgdAM8I0TTxUO0o5ILF/gUyLT04R7QlOfktkdh6Qt0atTS+xeKi1hirKRizpJ8jjnxGQIikPRToL2v3ZZZZZZ=='}"
],
"contains": [
"aws credentials"
]
}
],
"render": {
Expand Down Expand Up @@ -333,7 +323,7 @@
},
"credentials": {
"description": "Assumed role credentials",
"data_type": "string",
"data_type": "password",
"primary": true,
"contains": [
"aws credentials"
Expand Down Expand Up @@ -419,16 +409,6 @@
"example_values": [
1
]
},
{
"data_path": "action_result.parameter.credentials",
"data_type": "string",
"example_values": [
"{'AccessKeyId': 'TESTSJL6ZZZZZ3M7TEST', 'Expiration': '2021-06-07 22:28:04', 'SecretAccessKey': 'ZZZZZAmvLPictcVBPvjJx0d7MRezOuxiLCMZZZZZ', 'SessionToken': 'ZZZZZXIvYXdzEN///////////wEaDFRU0s4AVrw0k0oYICK4ATAzOqzAkg9bHY29lYmP59UvVOHjLufOy4s7SnAzOxGqGIXnukLis4TWNhrJl5R5nYyimrm6K/9d0Cw2SW9gO0ZRjEJHWJ+yY5Qk2QpWctS2BGn4n+G8cD6zEweCCMj+ScI5p8n7YI4wOdvXvOsVMmjV6F09Ujqr1w+NwoKXlglznXGs/7Q1kNZOMiioEhGUyoiHbQb37GCKslDK+oqe0KNaUKQ96YCepaLgMbMquDgdAM8I0TTxUO0o5ILF/gUyLT04R7QlOfktkdh6Qt0atTS+xeKi1hirKRizpJ8jjnxGQIikPRToL2v3ZZZZZZ=='}"
],
"contains": [
"aws credentials"
]
}
],
"render": {
Expand Down
10 changes: 7 additions & 3 deletions athena_connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ def __init__(self):
self._session_token = None
self._proxy = None

@staticmethod
def _sanitize_action_parameters(param):
return {key: value for key, value in param.items() if key != "credentials"}

def initialize(self):
self._state = self.load_state()

Expand Down Expand Up @@ -178,7 +182,7 @@ def _make_boto_call(self, action_result, method, **kwargs):
return phantom.APP_SUCCESS, resp_json

def _handle_test_connectivity(self, param):
action_result = self.add_action_result(ActionResult(dict(param)))
action_result = self.add_action_result(ActionResult(self._sanitize_action_parameters(param)))

if not self._create_client(action_result, param):
return action_result.get_status()
Expand All @@ -193,7 +197,7 @@ def _handle_test_connectivity(self, param):
return action_result.set_status(phantom.APP_SUCCESS)

def _handle_list_queries(self, param):
action_result = self.add_action_result(ActionResult(dict(param)))
action_result = self.add_action_result(ActionResult(self._sanitize_action_parameters(param)))
self.save_progress(f"In action handler for: {self.get_action_identifier()}")

if not self._create_client(action_result, param):
Expand All @@ -219,7 +223,7 @@ def _handle_list_queries(self, param):

def _handle_run_query(self, param):
self.save_progress(f"In action handler for: {self.get_action_identifier()}")
action_result = self.add_action_result(ActionResult(dict(param)))
action_result = self.add_action_result(ActionResult(self._sanitize_action_parameters(param)))

query = param["query"].strip()
s3 = param["s3_location"]
Expand Down
2 changes: 2 additions & 0 deletions release_notes/unreleased.md
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
**Unreleased**

* Prevent action-scoped AWS credentials from being retained in action results.
4 changes: 1 addition & 3 deletions run_query.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@
{{ title1 }}
{% endblock %}
{% block title2 %}{{ title2 }}{% endblock %}
{%
block custom_tools %}
{% endblock %}
{% block custom_tools %}{% endblock %}
{% block widget_content %}
<!-- Main Start Block -->
<style>
Expand Down
Loading