From 83f605954879b0a29f36d043f59b207a9617ef28 Mon Sep 17 00:00:00 2001 From: YuriiTsekhovyi <79151889+ytsek@users.noreply.github.com> Date: Tue, 13 Jul 2021 14:54:22 +0300 Subject: [PATCH] Release 2.0.1 (#73) * Add Jenkinsfile * Alpine & Python version update * Updated tips * Update module_type.json.sample --- Dockerfile | 6 ++++-- Jenkinsfile | 3 +++ README.md | 2 ++ code/api/utils.py | 5 +++++ code/container_settings.json | 2 +- code/requirements.txt | 16 ++++++++-------- module_type.json.sample | 4 ++-- 7 files changed, 25 insertions(+), 13 deletions(-) create mode 100644 Jenkinsfile diff --git a/Dockerfile b/Dockerfile index e17c40e..ee61c0a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,10 @@ -FROM alpine:3.13 +FROM alpine:3.14 LABEL maintainer="Ian Redden " # install packages we need -RUN apk update && apk add --no-cache musl-dev openssl-dev gcc python3 py3-configobj python3-dev supervisor git libffi-dev uwsgi-python3 uwsgi-http jq nano syslog-ng uwsgi-syslog py3-pip +RUN apk update && apk add --no-cache musl-dev openssl-dev gcc py3-configobj \ +supervisor git libffi-dev uwsgi-python3 uwsgi-http jq syslog-ng uwsgi-syslog \ +py3-pip python3-dev # do the Python dependencies ADD code /app diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..e8ac0fd --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,3 @@ +@Library('softserve-jenkins-library@main') _ + +startPipeline() diff --git a/README.md b/README.md index 396d649..d8c19ab 100644 --- a/README.md +++ b/README.md @@ -67,6 +67,8 @@ curl http://localhost:9090 ## Implementation Details +This application was developed and tested under Python version 3.9. + ### Implemented Relay Endpoints - `POST /health` diff --git a/code/api/utils.py b/code/api/utils.py index 67d8067..3a4c7b1 100644 --- a/code/api/utils.py +++ b/code/api/utils.py @@ -1,6 +1,7 @@ import json from typing import Optional from http import HTTPStatus +from json import JSONDecodeError import jwt import requests @@ -63,6 +64,10 @@ def get_public_key(jwks_host, token): InvalidURL: 'Wrong jwks_host in JWT payload. ' 'Make sure domain follows the ' 'visibility..cisco.com structure', + JSONDecodeError: 'Wrong jwks_host in JWT payload. ' + 'Make sure domain follows the ' + 'visibility..cisco.com structure', + } try: response = requests.get(f"https://{jwks_host}/.well-known/jwks") diff --git a/code/container_settings.json b/code/container_settings.json index 88cec97..b56ed0e 100644 --- a/code/container_settings.json +++ b/code/container_settings.json @@ -1,4 +1,4 @@ { - "VERSION": "2.0.0", + "VERSION": "2.0.1", "NAME": "AbuseIPDB" } diff --git a/code/requirements.txt b/code/requirements.txt index 9825f5c..a3bbef4 100644 --- a/code/requirements.txt +++ b/code/requirements.txt @@ -1,9 +1,9 @@ -beautifulsoup4==4.8.2 -cryptography==3.3.2 -Flask==1.1.2 -marshmallow==3.11.1 +Flask==2.0.1 +marshmallow==3.12.1 requests==2.25.1 -pyjwt[crypto]==2.0.1 -flake8==3.9.0 -coverage==5.2.1 -pytest==6.2.2 +cryptography==3.3.2 +pyjwt[crypto]==2.1.0 +flake8==3.9.2 +coverage==5.5 +pytest==6.2.4 +beautifulsoup4==4.9.3 diff --git a/module_type.json.sample b/module_type.json.sample index c32b2d9..45f7040 100644 --- a/module_type.json.sample +++ b/module_type.json.sample @@ -3,7 +3,7 @@ "default_name": "AbuseIPDB", "short_description": "Check IP addresses against AbuseIPDB's abusive IP database.", "description": "AbuseIPDB is a project dedicated to helping combat the spread of hackers, spammers, and abusive activity on the Internet. It is a public database of reported attacks from sysadmins and webmasters across the globe. With this module, you can scan AbuseIPDB's database for reports of attacks for a given IP.", - "tips": "When configuring this integration, you must first gather some information from your AbuseIPDB account. \n\n1. Log into AbuseIPDB, click **APIv2**\n2. Click **Create Key**, provide a **Name**, click **CREATE**\n3. Copy the **Key** into a file, or leave the tab open \n4. Complete the **Add New AbuseIPDB Module** form:\n - **Module Name** - Leave the default name or enter a name that is meaningful to you\n - **API Key** - Enter the API Key from your AbuseIPDB account information\n - **Entities Limit** - Enter the limit that restricts the maximum number of CTIM entities of each type returned in a single response per each requested observable. Must be a positive integer. Defaults to 100 (if unset or incorrect)\n5. Click **Save** to complete the AbuseIPDB module configuration. ", + "tips": "When configuring the AbuseIPDB IP Checker integration, you must obtain the API key from your AbuseIPDB account and then add the AbuseIPDB IP Checker integration module in SecureX. \n\n1. Log in to your AbuseIPDB account and click **APIv2**.\n2. Click **Create Key** and enter a **Name**.\n3. Click **CREATE**.\n4. Copy the **Key** into a file or leave the tab open. \n5. In SecureX, complete the **Add New AbuseIPDB IP Checker Integration Module** form:\n - **Integration Module Name** - Leave the default name or enter a name that is meaningful to you.\n - **API Key** - Paste the copied API key from AbuseIPDB into this field.\n - **Entities Limit** - Specify the maximum number of judgements and sightings in a single response, per requested observable (must be a positive value). We recommend that you enter a limit in the range of 50 to 1000. The default is 100 entities.\n\n6. Click **Save** to complete the AbuseIPDB integration module configuration. ", "external_references": [], "configuration_spec": [ { @@ -17,7 +17,7 @@ "key": "custom_CTR_ENTITIES_LIMIT", "type": "integer", "label": "Entities Limit", - "tooltip": "Restricts the maximum number of `Judgement` and `Sightings`", + "tooltip": "Restricts the maximum number of `Judgement` and `Sightings`. Please note that the number over 100 might lead to data inconsistency", "required": false } ],