diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index edf7b2b..671dc35 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -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 diff --git a/README.md b/README.md index 8d7060a..5cdd3aa 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/ip2locationio.json b/ip2locationio.json index e44d962..b8b89c5 100644 --- a/ip2locationio.json +++ b/ip2locationio.json @@ -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", @@ -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": [ diff --git a/ip2locationio_connector.py b/ip2locationio_connector.py index f10ed46..f7a00a2 100644 --- a/ip2locationio_connector.py +++ b/ip2locationio_connector.py @@ -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) diff --git a/release_notes/unreleased.md b/release_notes/unreleased.md index fbcb2fd..f79972f 100644 --- a/release_notes/unreleased.md +++ b/release_notes/unreleased.md @@ -1 +1,4 @@ **Unreleased** + +* Enable TLS server certificate verification by default +* Prevent API keys in failed request URLs from reaching action results