Skip to content

Commit

Permalink
Fix proxy usage (#85) (#29181)
Browse files Browse the repository at this point in the history
* Fix proxy usage (#85)

* Fix proxy usage in ZF client

* Fix variable USE_SSL to verify requests

* Remove proxy object from client

Given that the proxy works by default with env vars, the proxy object
is not necessary

* Update version and add release notes

* Fix call to modified alerts (#86)

* Fix call to modified alerts

* Update docker image

* Fix tests associated with get modified data
  • Loading branch information
figarrido committed Sep 12, 2023
1 parent b3f4b73 commit d942898
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
11 changes: 7 additions & 4 deletions Packs/ZeroFox/Integrations/ZeroFox/ZeroFox.py
Expand Up @@ -1100,10 +1100,9 @@ def get_modified_remote_data_command(
args = GetModifiedRemoteDataArgs(args)
last_update = args.last_update

# Get alerts created before `last_update` and modified after `last_update`
# Get alerts modified after `last_update`
list_alert_params = {
"last_modified_min_date": str(last_update),
"max_timestamp": str(last_update),
}

try:
Expand Down Expand Up @@ -1674,7 +1673,9 @@ def main():
FETCH_TIME: str = params.get(
"fetch_time", FETCH_TIME_DEFAULT,
).strip()
FETCH_LIMIT: int = int(demisto.params().get("fetch_limit", "100"))
FETCH_LIMIT: int = int(params.get("fetch_limit", "100"))
USE_SSL: bool = not params.get("insecure", False)
PROXY: bool = params.get('proxy', False)

commands: dict[str, Callable[[ZFClient, dict[str, Any]], Any]] = {
"get-modified-remote-data": get_modified_remote_data_command,
Expand All @@ -1700,15 +1701,17 @@ def main():
"zerofox-search-exploits": search_exploits_command,
}
try:
handle_proxy()
client = ZFClient(
base_url=BASE_URL,
ok_codes={200, 201},
username=USERNAME,
password=PASSWORD,
fetch_limit=FETCH_LIMIT,
verify=USE_SSL,
proxy=PROXY,
)

handle_proxy()
command = demisto.command()

if command == 'test-module':
Expand Down
2 changes: 0 additions & 2 deletions Packs/ZeroFox/Integrations/ZeroFox/ZeroFox_test.py
Expand Up @@ -223,7 +223,6 @@ def test_get_modified_remote_data_command_with_no_data(requests_mock, mocker):
spy.assert_called_once()
list_alerts_call_args = spy.call_args[0][0]
assert list_alerts_call_args["last_modified_min_date"] == args["lastUpdate"]
assert list_alerts_call_args["max_timestamp"] == args["lastUpdate"]
assert len(results.modified_incident_ids) == 0


Expand All @@ -249,7 +248,6 @@ def test_get_modified_remote_data_command(requests_mock, mocker):
spy.assert_called_once()
list_alerts_call_args = spy.call_args[0][0]
assert list_alerts_call_args["last_modified_min_date"] == args["lastUpdate"]
assert list_alerts_call_args["max_timestamp"] == args["lastUpdate"]
assert len(results.modified_incident_ids) == 10
for modified_incident_id in results.modified_incident_ids:
assert isinstance(modified_incident_id, str)
Expand Down
4 changes: 3 additions & 1 deletion Packs/ZeroFox/ReleaseNotes/1_1_1.md
@@ -1,3 +1,5 @@
#### Integrations

##### ZeroFox
- Updated the Docker image to: *demisto/python3:3.10.13.72123*.
- Fixed an issue related to the usage of a proxy.
- Updated the docker image to: *demisto/python3:3.10.13.72123*.
3 changes: 1 addition & 2 deletions Packs/ZeroFox/pack_metadata.json
Expand Up @@ -6,7 +6,6 @@
"author": "ZeroFox",
"url": "https://www.zerofox.com/contact-us/",
"email": "integration-support@zerofox.com",

"created": "2020-04-14T00:00:00Z",
"categories": [
"Data Enrichment & Threat Intelligence"
Expand All @@ -20,4 +19,4 @@
],
"dependencies": {},
"displayedImages": []
}
}

0 comments on commit d942898

Please sign in to comment.