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
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ repos:
exclude: "README.md"
# Central hooks
- repo: https://github.com/phantomcyber/dev-cicd-tools
rev: v2.1.4
rev: v2.2.4
hooks:
- id: build-docs
language: python
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ This table lists the configuration variables required to operate IP2Location IO.
VARIABLE | REQUIRED | TYPE | DESCRIPTION
-------- | -------- | ---- | -----------
**api_key** | required | password | IP2Location.io API key |
**verify_server_cert** | optional | boolean | Verify the IP2Location.io server certificate |

### Supported Actions

Expand Down
9 changes: 8 additions & 1 deletion ip2locationio.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"type": "information",
"product_vendor": "IP2Location.io",
"product_name": "IP2Location.io",
"python_version": "3",
"python_version": "3.9, 3.13",
"product_version_regex": ".*",
"logo": "logo_ip2locationio.svg",
"logo_dark": "logo_ip2locationio_dark.svg",
Expand All @@ -29,6 +29,13 @@
"data_type": "password",
"required": true,
"order": 0
},
"verify_server_cert": {
"description": "Verify the IP2Location.io server certificate",
"data_type": "boolean",
"required": false,
"default": true,
"order": 1
}
},
"actions": [
Expand Down
12 changes: 10 additions & 2 deletions ip2locationio_connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,17 @@ def _make_rest_call(self, endpoint, action_result, method="get", **kwargs):
url = self._base_url + endpoint

try:
r = request_func(url, verify=config.get("verify_server_cert", False), **kwargs)
r = request_func(url, verify=config.get("verify_server_cert", True), **kwargs)
except requests.exceptions.RequestException as e:
return RetVal(
action_result.set_status(phantom.APP_ERROR, f"Error connecting to IP2Location.io. Details: {type(e).__name__}"),
resp_json,
)
except Exception as e:
return RetVal(action_result.set_status(phantom.APP_ERROR, f"Error Connecting to server. Details: {e!s}"), resp_json)
return RetVal(
action_result.set_status(phantom.APP_ERROR, f"Unexpected connection error. Details: {type(e).__name__}"),
resp_json,
)

return self._process_response(r, action_result)

Expand Down
3 changes: 3 additions & 0 deletions release_notes/unreleased.md
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
**Unreleased**

* Enable TLS server certificate verification by default
* Prevent API keys in failed request URLs from reaching action results
Loading