Skip to content

Commit

Permalink
[pre-commit MyPy] Align the entire repo with MyPy #2 (demisto#29799)
Browse files Browse the repository at this point in the history
* [pre-commit MyPy] Align the entire repo with MyPy #2

* Add RN

* Revert changes in 1.12.26 RN

* Update the docker images
  • Loading branch information
mmhw authored and xsoar-bot committed Oct 5, 2023
1 parent 083e83c commit 51ff8de
Show file tree
Hide file tree
Showing 34 changed files with 231 additions and 196 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config_template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ repos:
hooks:
- id: mypy
args: [--ignore-missing-imports, --check-untyped-defs, --show-error-codes, --follow-imports=silent, --allow-redefinition]
exclude: "test_data|tests_data|.venv|.*_test.py$|infrastructure_tests"
exclude: "test_data|tests_data|.venv|.*_test.py$|infrastructure_tests|.vulture_whitelist.py"

additional_dependencies:
- astor==0.8.1 ; python_version >= "3.8" and python_version < "3.11"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def invoke_enpoint(runtime, endpoint_name, payload):

runtime = boto3.Session(aws_access_key_id=aws_access_key_id,
aws_secret_access_key=aws_secret_access_key,
region_name=demisto.params()['AWSRegion']).client('runtime.sagemaker')
region_name=demisto.params()['AWSRegion']).client('runtime.sagemaker') # type: ignore[call-overload]
endpoint_name = demisto.params()['EndpointName']


Expand Down
12 changes: 6 additions & 6 deletions Packs/AWS_Sagemaker/Integrations/AWSSagemaker/AWSSagemaker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ commonfields:
name: AWS Sagemaker
display: AWS Sagemaker
category: Data Enrichment & Threat Intelligence
description: AWS Sagemaker - Demisto Phishing Email Classifier
description: AWS Sagemaker - Demisto Phishing Email Classifier.
configuration:
- display: AWS access key
name: credentials
Expand Down Expand Up @@ -45,16 +45,16 @@ script:
- name: predict-phishing
arguments:
- name: inputText
description: The input text (usually email subject + body)
description: The input text (usually email subject + body).
outputs:
- contextPath: DBotPhishingPrediction.Label
description: 'The predicated label: malicious \ other'
description: 'The predicated label: malicious \ other.'
type: string
- contextPath: DBotPhishingPrediction.Probability
description: The predication probability (range 0-1)
description: The predication probability (range 0-1).
type: number
description: Classify input text (usually email content)
dockerimage: demisto/boto3py3:1.0.0.38849
description: Classify input text (usually email content).
dockerimage: demisto/boto3py3:1.0.0.75596
tests:
- Test Sagemaker
fromversion: 5.0.0
6 changes: 6 additions & 0 deletions Packs/AWS_Sagemaker/ReleaseNotes/1_1_4.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

#### Integrations

##### AWS Sagemaker

Updated the Docker image to: *demisto/boto3py3:1.0.0.75596*.
2 changes: 1 addition & 1 deletion Packs/AWS_Sagemaker/pack_metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "AWS Sagemaker",
"description": "AWS Sagemaker - Demisto Phishing Email Classifier",
"support": "xsoar",
"currentVersion": "1.1.3",
"currentVersion": "1.1.4",
"author": "Cortex XSOAR",
"url": "https://www.paloaltonetworks.com/cortex",
"email": "",
Expand Down
2 changes: 1 addition & 1 deletion Packs/ApiModules/Scripts/AWSApiModule/AWSApiModule.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def update_config(self):
command_config['connect_timeout'] = connect_timeout
if retries or timeout:
demisto.debug('Merging client config settings: {}'.format(command_config))
self.config = self.config.merge(Config(**command_config))
self.config = self.config.merge(Config(**command_config)) # type: ignore[arg-type]

def aws_session(self, service, region=None, role_arn=None, role_session_name=None, role_session_duration=None,
role_policy=None):
Expand Down
5 changes: 3 additions & 2 deletions Packs/ApiModules/Scripts/AWSApiModule/AWSApiModule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@ subtype: python3
tags:
- infra
- server
comment: AWS Client class, provides generic Infrastructure to all AWS integrations
comment: AWS Client class, provides generic Infrastructure to all AWS integrations.
scripttarget: 0
dependson: {}
timeout: 0s
dockerimage: demisto/boto3py3:1.0.0.52713
fromversion: 5.5.0

tests:
- No tests (auto formatted)
6 changes: 6 additions & 0 deletions Packs/CommonScripts/ReleaseNotes/1_12_28.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

#### Scripts

##### GetDockerImageLatestTag

Updated the Docker image to: *demisto/python3:3.10.13.74666*.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import re
from pkg_resources import parse_version

requests.packages.urllib3.disable_warnings()

ACCEPT_HEADER = {
'Accept': "application/json, "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,22 @@ comment: Gets docker image latest tag. Script simulates the docker pull flow but
args:
- name: docker_image
required: true
description: 'Docker image full name with version: For example: demisto/python'
description: 'Docker image full name with version: For example: demisto/python.'
- name: use_system_proxy
auto: PREDEFINED
predefined:
- "yes"
- "no"
description: Use system proxy settings
description: Use system proxy settings.
defaultValue: "yes"
- name: trust_any_certificate
auto: PREDEFINED
predefined:
- "yes"
- "no"
description: Trust any certificate (not secure)
description: Trust any certificate (not secure).
defaultValue: "no"
tests:
- No test - no testplaybook, but unit tests exist
fromversion: 5.0.0
dockerimage: demisto/python3:3.10.6.33415
dockerimage: demisto/python3:3.10.13.74666
2 changes: 1 addition & 1 deletion Packs/CommonScripts/pack_metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "Common Scripts",
"description": "Frequently used scripts pack.",
"support": "xsoar",
"currentVersion": "1.12.27",
"currentVersion": "1.12.28",
"author": "Cortex XSOAR",
"url": "https://www.paloaltonetworks.com/cortex",
"email": "",
Expand Down
4 changes: 2 additions & 2 deletions Packs/Kenna/Integrations/KennaV2/KennaV2_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

from KennaV2 import parse_response, search_vulnerabilities, get_connectors, Client, \
search_fixes, search_assets, get_asset_vulnerabilities, get_connector_runs
from Tests_Data.ExpectedResult import VULNERABILITIES_SEARCH_EXPECTED, GET_CONNECTORS_EXPECTED, SEARCH_FIXES_EXPECTED, \
from test_data.ExpectedResult import VULNERABILITIES_SEARCH_EXPECTED, GET_CONNECTORS_EXPECTED, SEARCH_FIXES_EXPECTED, \
SEARCH_ASSETS_EXPECTED, GET_ASSETS_VULNERABILITIES_EXPECTED, GET_CONNECTOR_RUNS_EXPECTED
from Tests_Data.RawData import VULNERABILITIES_SEARCH_RESPONSE, GET_CONNECTORS_RESPONSE, SEARCH_FIXES_RESPONSE, \
from test_data.RawData import VULNERABILITIES_SEARCH_RESPONSE, GET_CONNECTORS_RESPONSE, SEARCH_FIXES_RESPONSE, \
SEARCH_ASSETS_RESPONSE, GET_ASSETS_VULNERABILITIES_RESPONSE, GET_CONNECTOR_RUNS_RESPONSE


Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import urllib3
import demistomock as demisto # noqa: F401
import xmltodict
from CommonServerPython import * # noqa: F401
Expand Down Expand Up @@ -508,7 +509,7 @@ def main():
try:

if ngfw_tls_verify is False or csp_tls_verify is False:
requests.packages.urllib3.disable_warnings()
urllib3.disable_warnings()

# Establish PANOS XMLAPI Class Connector
xmlapi = PanOSXMLAPI(ngfw_host, ngfw_port, ngfw_api_key, ngfw_tls_verify, ngfw_timeout, system_proxy,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ commonfields:
name: Palo Alto Networks Automatic SLR (Community)
display: Palo Alto Networks Automatic SLR
category: Utilities
description: Allow XSOAR to automatically generate Security Lifecycle Review's (SLR's)
description: Allow XSOAR to automatically generate Security Lifecycle Review's (SLR's).
configuration:
- display: Firewall Management FQDN or IP Address
name: ngfw_fqdn_ip
Expand Down Expand Up @@ -176,129 +176,129 @@ script:
arguments: []
outputs:
- contextPath: AutoSLR.generate.job_id
description: Job ID of stats_dump.tar.gz generation job
description: Job ID of stats_dump.tar.gz generation job.
type: string
description: Initiates the stats_dump.tar.gz generation job on the target firewall
description: Initiates the stats_dump.tar.gz generation job on the target firewall.
- name: autoslr-ngfw-check
arguments:
- name: job_id
required: true
description: Job ID to check
description: Job ID to check.
outputs:
- contextPath: AutoSLR.generate.job_status
description: Returns true when completed, false is an error occured
description: Returns true when completed, false is an error occured.
type: boolean
description: Checks the status of the stats_dump.tar.gz generation job, returns true when completed
description: Checks the status of the stats_dump.tar.gz generation job, returns true when completed.
- name: autoslr-ngfw-download
arguments:
- name: job_id
required: true
description: Job ID of stats_dump.tar.gz generation task
description: Job ID of stats_dump.tar.gz generation task.
outputs:
- contextPath: AutoSLR.generate.file_name
description: Filename of downloaded file
description: Filename of downloaded file.
type: string
- contextPath: InfoFile.EntryID
description: EntryID of Downloaded File
description: EntryID of Downloaded File.
type: string
description: Downloads the stats_dump.tar.gz from the target firewall
description: Downloads the stats_dump.tar.gz from the target firewall.
- name: autoslr-csp-upload
arguments:
- name: input_file
description: EntryID of the file to upload
description: EntryID of the file to upload.
outputs:
- contextPath: AutoSLR.upload.id
description: SLR Reference ID
description: SLR Reference ID.
type: string
- contextPath: AutoSLR.upload.send_to
description: Email address where the report is being sent to
description: Email address where the report is being sent to.
type: string
description: Uploads the stats_dump.tar.gz to Palo Alto Networks
description: Uploads the stats_dump.tar.gz to Palo Alto Networks.
- name: autoslr-ngfw-system-info
arguments: []
outputs:
- contextPath: AutoSLR.ngfw_system_info.hostname
description: Firewall Hostname
description: Firewall Hostname.
type: string
- contextPath: AutoSLR.ngfw_system_info.serial
description: Firewall Serial Number
description: Firewall Serial Number.
type: string
- contextPath: AutoSLR.ngfw_system_info.software
description: Firewall PANOS Version
description: Firewall PANOS Version.
type: string
description: Retrieve information about the target firewall
description: Retrieve information about the target firewall.
- name: autoslr-dump-params
arguments: []
outputs:
- contextPath: AutoSLR.params.csp_host
description: CSP URL
description: CSP URL.
type: string
- contextPath: AutoSLR.params.csp_proxy
description: Use XSOAR Proxy
description: Use XSOAR Proxy.
type: boolean
- contextPath: AutoSLR.params.csp_timeout
description: Timeout for API Operation
description: Timeout for API Operation.
type: number
- contextPath: AutoSLR.params.csp_tls_verify
description: Enable/Disable TLS Certificate Verification
description: Enable/Disable TLS Certificate Verification.
type: boolean
- contextPath: AutoSLR.params.csp_verbose
description: Enable/Disable Verbose Log Output
description: Enable/Disable Verbose Log Output.
type: boolean
- contextPath: AutoSLR.params.ngfw_host
description: Firewall Management FQDN/IP Address
description: Firewall Management FQDN/IP Address.
type: string
- contextPath: AutoSLR.params.ngfw_port
description: Firewall Management TCP Port
description: Firewall Management TCP Port.
type: number
- contextPath: AutoSLR.params.ngfw_proxy
description: Use XSOAR Proxy
description: Use XSOAR Proxy.
type: boolean
- contextPath: AutoSLR.params.ngfw_timeout
description: Timeout for API Operation
description: Timeout for API Operation.
type: number
- contextPath: AutoSLR.params.ngfw_tls_verify
description: Enable/Disable TLS Certificate Verification
description: Enable/Disable TLS Certificate Verification.
type: boolean
- contextPath: AutoSLR.params.ngfw_verbose
description: Enable/Disable Verbose Log Output
description: Enable/Disable Verbose Log Output.
type: boolean
- contextPath: AutoSLR.params.slr_account_name
description: Customer Name
description: Customer Name.
type: string
- contextPath: AutoSLR.params.slr_country
description: Customer Deployment Country
description: Customer Deployment Country.
type: string
- contextPath: AutoSLR.params.slr_deployment_location
description: Customer Deployment Logical Location
description: Customer Deployment Logical Location.
type: string
- contextPath: AutoSLR.params.slr_geographic_region
description: Customer Deployment Geographic Region
description: Customer Deployment Geographic Region.
type: string
- contextPath: AutoSLR.params.slr_industry
description: Customer Industry
description: Customer Industry.
type: string
- contextPath: AutoSLR.params.slr_language
description: 'Customer Langugage '
description: 'Customer Langugage.'
type: string
- contextPath: AutoSLR.params.slr_prepared_by
description: Person who generated the report (name)
description: Person who generated the report (name).
type: string
- contextPath: AutoSLR.params.slr_requested_by
description: Person who generated the report (email)
description: Person who generated the report (email).
type: string
- contextPath: AutoSLR.params.slr_send_to
description: Email address to send the completed report to
description: Email address to send the completed report to.
type: string
- contextPath: AutoSLR.params.system_proxy
description: Use XSOAR Proxy
description: Use XSOAR Proxy.
type: boolean
- contextPath: AutoSLR.params.system_verbose
description: Enable/Disable Verbose Log Output
description: Enable/Disable Verbose Log Output.
type: boolean
description: This command will dump all the non-sensitive parameters to the context, useful for debugging purposes
description: This command will dump all the non-sensitive parameters to the context, useful for debugging purposes.
execution: true
dockerimage: demisto/xml-feed:1.0.0.29458
dockerimage: demisto/xml-feed:1.0.0.75078
subtype: python3
fromversion: 5.0.0
tests:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

#### Integrations

##### Palo Alto Networks Automatic SLR

Updated the Docker image to: *demisto/xml-feed:1.0.0.75078*.
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@
"name": "Automatic SLR by Palo Alto Networks",
"description": "Automate the generation of Palo Alto Networks Security Lifecycle Reviews (SLR's) using XSOAR.",
"support": "community",
"currentVersion": "1.0.2",
"currentVersion": "1.0.3",
"author": "Matt Smith",
"url": "",
"email": "",
"created": "2020-11-25T15:05:50Z",
"categories": ["Network Security"],
"categories": [
"Network Security"
],
"tags": [],
"useCases": [],
"keywords": [],
Expand Down
2 changes: 0 additions & 2 deletions Packs/PerimeterX/Integrations/BotDefender/BotDefender.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

from CommonServerPython import * # noqa: E402 lgtm [py/polluting-import]

# Disable insecure warnings
requests.packages.urllib3.disable_warnings()

# CONSTANTS
DATE_FORMAT = '%Y-%m-%dT%H:%M:%SZ'
Expand Down
Loading

0 comments on commit 51ff8de

Please sign in to comment.