Skip to content

Commit

Permalink
[DEPLOY] v0.8.2 - Handle incorrectly specified parameter payload valu…
Browse files Browse the repository at this point in the history
…es (#424)

* Update _util.py

* Bump version -> 0.8.2

* Update CHANGELOG.md

* Update CHANGELOG.md

* Expanded unit testing to complete code coverage.

* Update comment

* Fix unit test method call

* Update wordlist.txt

Co-authored-by: valerianrossigneux <[email protected]>
  • Loading branch information
jshcodes and valerianrossigneux authored Nov 8, 2021
1 parent d25f03e commit 555d413
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 2 deletions.
1 change: 1 addition & 0 deletions .github/wordlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,7 @@ urlencoded
urllib
util
uuid
valerianrossigneux
validator
ver
www
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# Version 0.8.2
## Issues resolved
+ Fixed: Issue in `_util.args_to_params` when handling Python reserved words defined as keys incorrectly in the parameter dictionary. Closes #422.
- Special thanks to @valerianrossigneux for originally identifying this issue, and his assistance testing a fix. :bow:

# Version 0.8.1
## Added features and functionality
+ Added: New Discover Service Class and matching unit testing to represent the recently released Falcon Discover API.
Expand Down
10 changes: 9 additions & 1 deletion src/falconpy/_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,7 @@ def args_to_params(payload: dict, passed_arguments: dict, endpoints: list, epnam
Returns: dictionary representing QueryString parameters.
"""
returned_payload = {}
if epname != "Manual": # pylint: disable=R1702
for arg in passed_arguments:
eps = [ep[5] for ep in endpoints if epname in ep[0]][0]
Expand All @@ -337,7 +338,14 @@ def args_to_params(payload: dict, passed_arguments: dict, endpoints: list, epnam
# Unrecognized argument
pass

return payload
# Clean up reserved word conversions when passing in an invalid raw payload
for element in payload:
if not isinstance(element, str):
returned_payload[element.__name__] = payload[element]
else:
returned_payload[element] = payload[element]

return returned_payload


def process_service_request(calling_object: object,
Expand Down
2 changes: 1 addition & 1 deletion src/falconpy/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
For more information, please refer to <https://unlicense.org>
"""
_VERSION = '0.8.1'
_VERSION = '0.8.2'
_MAINTAINER = 'Joshua Hiller'
_AUTHOR = 'CrowdStrike'
_AUTHOR_EMAIL = '[email protected]'
Expand Down
14 changes: 14 additions & 0 deletions tests/test_uber_api_complete.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,9 +229,23 @@ def uberCCAWS_DisableSSLVerify(self):
else:
return False

def uber_test_invalid_reserved_word_payload(self):
params = {
"limit": 1,
"facet": "cve,host_info",
filter:"created_timestamp:>'2021-01-01T00:00:01Z'"
}
if falcon.command("combinedQueryVulnerabilities", parameters=params)["status_code"] in AllowedResponses:
return True
else:
return False

def test_GetAWSSettings(self):
assert self.uberCCAWS_GetAWSSettings() is True

def test_reserved_words(self):
assert self.uber_test_invalid_reserved_word_payload() is True

def test_QueryAWSAccounts(self):
assert self.uberCCAWS_QueryAWSAccounts() is True

Expand Down

0 comments on commit 555d413

Please sign in to comment.