-
Notifications
You must be signed in to change notification settings - Fork 55
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
[SOAR-17745] Duo admin Improve handling of 429s in task code #3048
[SOAR-17745] Duo admin Improve handling of 429s in task code #3048
Conversation
@@ -64,7 +64,9 @@ class MonitorLogsOutput(insightconnect_plugin_runtime.Output): | |||
"type": "array", | |||
"title": "Logs", | |||
"description": "List of administrator, authentication and trust monitor event logs within the specified time range", | |||
"items": {}, | |||
"items": { | |||
"$ref": {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be reverted :( Sdk refresh does this automatically
plugins/duo_admin/komand_duo_admin/tasks/monitor_logs/schema.py
Outdated
Show resolved
Hide resolved
@@ -103,7 +108,46 @@ def get_parameters_for_query( | |||
self.logger.info(f"Retrieve data from {mintime} to {maxtime}. Get next page is set to {get_next_page}") | |||
return mintime, maxtime, get_next_page | |||
|
|||
def check_rate_limit(self, state: Dict): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def check_rate_limit(self, state: Dict): | |
def check_rate_limit(self, state: Dict[str, Any]) -> Union[PluginException, None]: |
@@ -285,7 +330,7 @@ def add_log_type_field(logs: list, value: str) -> list: | |||
|
|||
@staticmethod | |||
def sha1(log: dict) -> str: | |||
hash_ = sha1() # nosec B303 | |||
hash_ = sha1(usedforsecurity=False) # nosec B303 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we've got a hashing method we can call from the SDK we can use now, if you want to swap out to use that
@@ -37,6 +37,12 @@ def setUpClass(cls) -> None: | |||
"lookback": "2023-04-30T08:34:46.000Z", | |||
}, | |||
], | |||
[ | |||
"with_rate_limit", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you mind adding a test that has the whole flow of:
- happy state -> API returns 429 -> task returns 200 with rate limit in state -> second task call returns 429 as task status code
and maybe one showing the rate limit time has passed and we resume task? just i know these can be a bit tricky to test locally!
plugins/whois/.CHECKSUM
Outdated
@@ -1,5 +1,5 @@ | |||
{ | |||
"spec": "4d67f7597ca0c9b43ff85bc3d161836e", | |||
"spec": "bd19980a894fe29ad2516339a3668832", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is there Whois files in here?
plugins/whois/plugin.spec.yaml
Outdated
@@ -32,7 +32,8 @@ hub_tags: | |||
key_features: ["Perform a WHOIS lookup for a provided IP address or domain to gain information on who is responsible for a domain or IP"] | |||
references: ["[WHOIS](https://en.wikipedia.org/wiki/WHOIS)"] | |||
links: ["[WHOIS](https://en.wikipedia.org/wiki/WHOIS)"] | |||
troubleshooting: "Multiple records can be returned by the server, this plugin currently only returns the first unique records found." | |||
troubleshooting: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah these Whois files shouldn't be in the PR.
2bb8a2c
to
54c0ec4
Compare
360f870
to
86f9f03
Compare
083267f
to
7791e66
Compare
* Updating plugin.spec (#3047) * Duo admin Improve handling of 429s in task code * Linting the code * Version bump * Adjusting styling * Resolving static code analysis * Resolving plugin's validation * CR fixes * Additional test case * Bumping the SDK and linting the code --------- Co-authored-by: rmurray-r7 <ryanj_murray@rapid7.com>
* Updating plugin.spec (#3047) * Duo admin Improve handling of 429s in task code * Linting the code * Version bump * Adjusting styling * Resolving static code analysis * Resolving plugin's validation * CR fixes * Additional test case * Bumping the SDK and linting the code --------- Co-authored-by: rmurray-r7 <ryanj_murray@rapid7.com>
…3067) * Updating plugin.spec (#3047) * Duo admin Improve handling of 429s in task code * Linting the code * Version bump * Adjusting styling * Resolving static code analysis * Resolving plugin's validation * CR fixes * Additional test case * Bumping the SDK and linting the code --------- Co-authored-by: rmurray-r7 <ryanj_murray@rapid7.com>
https://rapid7.atlassian.net/browse/SOAR-17745
Unit Tests
Review our documentation on generating and writing plugin unit tests