Repository: CybercentreCanada/assemblyline-service-server (language: python)

Issue:
Badlist



Discussion / hints:

Fix patch:
diff --git a/setup.py b/setup.py
index 295cc1b..49796ee 100644
--- a/setup.py
+++ b/setup.py
@@ -32,6 +32,9 @@
         'Programming Language :: Python :: 3.7',
         'Programming Language :: Python :: 3.8',
         'Programming Language :: Python :: 3.9',
+        'Programming Language :: Python :: 3.10',
+        'Programming Language :: Python :: 3.11',
+        'Programming Language :: Python :: 3.12',
     ],
     keywords="assemblyline malware gc canada cse-cst cse cst cyber cccs",
     packages=find_packages(exclude=['test/*']),


Test patch:
diff --git a/pipelines/azure-test.yaml b/pipelines/azure-test.yaml
index 9ccf4f3..77561cc 100644
--- a/pipelines/azure-test.yaml
+++ b/pipelines/azure-test.yaml
@@ -6,6 +6,10 @@ pr: ["*"]
 pool:
   vmImage: "ubuntu-20.04"
 
+variables:
+  # Try to checkout the matching branch, if the command fails, don't care.
+  BRANCH_NAME: $[coalesce(variables['System.PullRequest.SourceBranch'], variables['System.PullRequest.TargetBranch'], replace(variables['Build.SourceBranch'], 'refs/heads/', ''))]
+
 resources:
   containers:
     - container: redis
@@ -13,7 +17,7 @@ resources:
       ports:
         - 6379:6379
     - container: elasticsearch
-      image: cccs/elasticsearch:7.17.4
+      image: cccs/elasticsearch:8.10.2
       env:
         ES_JAVA_OPTS: "-Xms256m -Xmx512m"
         DISCOVERY_TYPE: "single-node"
@@ -43,9 +47,10 @@ jobs:
       matrix:
         python3_9:
           python.version: "3.9"
-        # Python3_10:
-        #   python.version: '3.10'
-
+        Python3_10:
+          python.version: '3.10'
+        Python3_11:
+          python.version: '3.11'
     timeoutInMinutes: 15
     services:
       elasticsearch: elasticsearch
@@ -75,17 +80,12 @@ jobs:
         displayName: Setup Environment
         workingDirectory: $(Pipeline.Workspace)/s/assemblyline-service-server
       - script: |
-          # Try to checkout the matching branch, if the command fails, don't care.
-          export BRANCH_NAME=$(basename -- "$SYSTEM_PULLREQUEST_SOURCEBRANCH")
-          export BRANCH_NAME=${BRANCH_NAME:-"$BUILD_SOURCEBRANCHNAME"}
           git checkout -b $BRANCH_NAME -t origin/$BRANCH_NAME || true
+          sudo env "PATH=$PATH" python -m pip install --no-cache-dir -U pip cython setuptools wheel
           sudo env "PATH=$PATH" python -m pip install --no-cache-dir -e .
         displayName: Install assemblyline
         workingDirectory: $(Pipeline.Workspace)/s/assemblyline-base
       - script: |
-          # Try to checkout the matching branch, if the command fails, don't care.
-          export BRANCH_NAME=$(basename -- "$SYSTEM_PULLREQUEST_SOURCEBRANCH")
-          export BRANCH_NAME=${BRANCH_NAME:-"$BUILD_SOURCEBRANCHNAME"}
           git checkout -b $BRANCH_NAME -t origin/$BRANCH_NAME || true
           sudo env "PATH=$PATH" python -m pip install --no-cache-dir -e .
         displayName: Install assemblyline-core
diff --git a/test/docker-compose.yml b/test/docker-compose.yml
index c1be8dd..d10c5d0 100644
--- a/test/docker-compose.yml
+++ b/test/docker-compose.yml
@@ -2,7 +2,7 @@ version: "2.4"
 
 services:
   elasticsearch:
-    image: docker.elastic.co/elasticsearch/elasticsearch:7.17.4
+    image: docker.elastic.co/elasticsearch/elasticsearch:8.10.2
     environment:
       - xpack.security.enabled=true
       - discovery.type=single-node
diff --git a/test/test_srv_badlist.py b/test/test_srv_badlist.py
index b89cbdd..6793734 100644
--- a/test/test_srv_badlist.py
+++ b/test/test_srv_badlist.py
@@ -32,7 +32,6 @@ def client():
     yield client
 
 
-# noinspection PyUnusedLocal
 def test_badlist_exist(client, storage):
     valid_hash = randomizer.get_random_hash(64)
     valid_resp = randomizer.random_model_obj(Badlist, as_json=True)
@@ -44,7 +43,6 @@ def test_badlist_exist(client, storage):
     assert resp.json['api_response'] == valid_resp
 
 
-# noinspection PyUnusedLocal
 def test_badlist_missing(client, storage):
     invalid_hash = randomizer.get_random_hash(64)
     storage.badlist.get_if_exists.return_value = None
@@ -54,7 +52,6 @@ def test_badlist_missing(client, storage):
     assert resp.json['api_response'] is None
 
 
-# noinspection PyUnusedLocal
 def test_badlist_exists_tags(client, storage):
     response_item = randomizer.random_model_obj(Badlist, as_json=True)
     valid_resp = {'items': [response_item]}
@@ -68,8 +65,6 @@ def test_badlist_exists_tags(client, storage):
     for item in resp.json['api_response']:
         assert item == response_item
 
-# noinspection PyUnusedLocal
-
 
 def test_badlist_similar_tlsh(client, storage):
     response_item = randomizer.random_model_obj(Badlist, as_json=True)