Skip to content

Commit

Permalink
Merge pull request #1230 from TheHive-Project/ci-fixes
Browse files Browse the repository at this point in the history
Fix build for several analyzers & responders
  • Loading branch information
jeromeleonard authored Nov 3, 2023
2 parents 05d25f2 + b493329 commit 1115fe2
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 35 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ jobs:
name: Build Catalog
runs-on: [ ubuntu-latest ]
needs: [ build_analyzers, build_responders ]
if: always()
steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down Expand Up @@ -77,7 +78,7 @@ jobs:
name: Build documentation
runs-on: [ ubuntu-latest ]
needs: [build_analyzers, build_responders ]
if: startsWith(github.ref, 'refs/tags/')
if: startsWith(github.ref, 'refs/tags/') && always()
steps:
- uses: actions/checkout@v3
- name: Prepare documentation files
Expand Down
1 change: 1 addition & 0 deletions analyzers/Maltiverse/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
FROM python:3-slim
WORKDIR /worker
COPY . Maltiverse
RUN apt update && apt install -y git
RUN test ! -e Maltiverse/requirements.txt || pip install --no-cache-dir -r Maltiverse/requirements.txt
ENTRYPOINT Maltiverse/maltiverse-client.py
6 changes: 6 additions & 0 deletions analyzers/Splunk/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# See https://github.com/splunk/splunk-sdk-python for supported python versions
FROM python:3.7
WORKDIR /worker
COPY . Splunk
RUN test ! -e Splunk/requirements.txt || pip install --no-cache-dir -r Splunk/requirements.txt
ENTRYPOINT Splunk/splunk.py
37 changes: 4 additions & 33 deletions responders/Jupyter_Responder/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,38 +1,9 @@
# syntax=docker/dockerfile:1.3-labs
FROM python:3.9
WORKDIR /worker
COPY . Jupyter_Responder
RUN test ! -e Jupyter_Responder/requirements.txt || pip install --no-cache-dir -rJupyter_Responder/requirements.txt
RUN cat <<EOF > /Jupyter_Responder/papermill_iorw.patch
--- iorw.py 2023-08-11 05:49:49.302149767 +0000
+++ iorw.py 2023-08-11 05:48:38.553642098 +0000
@@ -180,7 +180,7 @@
class HttpHandler(object):
@classmethod
def read(cls, path):
- return requests.get(path, headers={'Accept': 'application/json'}).text
+ return json.dumps(requests.get(path, headers={'Accept': 'application/json'}).json()["content"])

@classmethod
def listdir(cls, path):
@@ -188,7 +188,9 @@

@classmethod
def write(cls, buf, path):
- result = requests.put(path, json=json.loads(buf))
+ payload = {"type": "notebook", "format": "json", "path": path}
+ payload["content"] = json.loads(buf)
+ result = requests.put(path, json=payload)
result.raise_for_status()

@classmethod
EOF
RUN test ! -e Jupyter_Responder/requirements.txt || pip install --no-cache-dir -r Jupyter_Responder/requirements.txt


RUN pip install papermill
RUN apt update
RUN apt install patch
RUN patch $(python3 -c "from papermill import iorw; print(iorw.__file__)") /Jupyter_Responder/papermill_iorw.patch
RUN apt update &&\
apt install patch &&\
patch $(python3 -c "from papermill import iorw; print(iorw.__file__)") Jupyter_Responder/papermill_iorw.patch
ENTRYPOINT Jupyter_Responder/jupyter.py


22 changes: 22 additions & 0 deletions responders/Jupyter_Responder/papermill_iorw.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
--- iorw.py 2023-08-11 05:49:49.302149767 +0000
+++ iorw.py 2023-08-11 05:48:38.553642098 +0000
@@ -180,7 +180,7 @@
class HttpHandler(object):
@classmethod
def read(cls, path):
- return requests.get(path, headers={'Accept': 'application/json'}).text
+ return json.dumps(requests.get(path, headers={'Accept': 'application/json'}).json()["content"])

@classmethod
def listdir(cls, path):
@@ -188,7 +188,9 @@

@classmethod
def write(cls, buf, path):
- result = requests.put(path, json=json.loads(buf))
+ payload = {"type": "notebook", "format": "json", "path": path}
+ payload["content"] = json.loads(buf)
+ result = requests.put(path, json=payload)
result.raise_for_status()

@classmethod
2 changes: 1 addition & 1 deletion utils/docker/Dockerfile_template
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@
FROM python:3
WORKDIR /worker
COPY . {worker_name}
RUN test ! -e {worker_name}/requirements.txt || pip install --no-cache-dir -r{worker_name}/requirements.txt
RUN test ! -e {worker_name}/requirements.txt || pip install --no-cache-dir -r {worker_name}/requirements.txt
ENTRYPOINT {command}

0 comments on commit 1115fe2

Please sign in to comment.