Skip to content

Commit 87ce32f

Browse files
authored
Upload checkmarx results to github (#28)
* fix: tell github security scan has been done. * fix: filter results github can't handle * fix: bash lint
1 parent 043fb2e commit 87ce32f

File tree

2 files changed

+20
-7
lines changed

2 files changed

+20
-7
lines changed

.github/workflows/checkmarx.yaml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,4 +80,17 @@ jobs:
8080
base_uri: https://eu-2.ast.checkmarx.net/
8181
cx_client_id: ${{ secrets.CX_CLIENT_ID }}
8282
cx_client_secret: ${{ secrets.CX_CLIENT_SECRET_EU }}
83-
additional_params: --scs-repo-url https://github.com/midnightntwrk/midnight-node-docker --scs-repo-token ${{ secrets.MIDNIGHTCI_REPO }}
83+
additional_params: >
84+
--report-format sarif
85+
--scs-repo-url https://github.com/midnightntwrk/midnight-node-docker
86+
--scs-repo-token ${{ secrets.MIDNIGHTCI_REPO }}
87+
- name: Filter out repo level issues that github can't handle
88+
run: |
89+
mv ./cx_result.sarif ./cx_result.sarif.orig
90+
jq '. | .runs[0].results |= map(select(.locations[0].physicalLocation.artifactLocation.uri != ""))' cx_result.sarif.orig > cx_result.sarif
91+
92+
# Upload results to github
93+
- name: Upload SARIF file
94+
uses: github/codeql-action/upload-sarif@86b04fb0e47484f7282357688f21d5d0e32175fe # v3.29.2
95+
with:
96+
sarif_file: cx_result.sarif

midnight-shell.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
CONTAINER_NAME="midnight"
55

66
# Check if the container already exists
7-
if [ $(docker ps -a -f name=^${CONTAINER_NAME}$ --format '{{.Names}}' | grep -w ${CONTAINER_NAME} | wc -l) -eq 0 ]; then
7+
if [ "$(docker ps -a -f name=^${CONTAINER_NAME}$ --format '{{.Names}}' | grep -c -w "${CONTAINER_NAME}")" -eq 0 ]; then
88
echo "Container '${CONTAINER_NAME}' does not exist. Creating and starting it..."
9-
9+
1010
# Run the container with the specified configuration
1111
docker run -it \
1212
--name ${CONTAINER_NAME} \
@@ -18,13 +18,13 @@ if [ $(docker ps -a -f name=^${CONTAINER_NAME}$ --format '{{.Names}}' | grep -w
1818
"${MIDNIGHT_NODE_IMAGE}"
1919
else
2020
echo "Container '${CONTAINER_NAME}' already exists. Opening an interactive shell..."
21-
21+
2222
# Check if the container is running, if not, start it
23-
if [ $(docker ps -f name=^${CONTAINER_NAME}$ --format '{{.Names}}' | grep -w ${CONTAINER_NAME} | wc -l) -eq 0 ]; then
23+
if [ "$(docker ps -f name=^${CONTAINER_NAME}$ --format '{{.Names}}' | grep -c -w "${CONTAINER_NAME}")" -eq 0 ]; then
2424
echo "Starting container '${CONTAINER_NAME}'..."
2525
docker start ${CONTAINER_NAME}
2626
fi
27-
27+
2828
# Open an interactive shell in the container
2929
docker exec -it ${CONTAINER_NAME} /bin/bash
30-
fi
30+
fi

0 commit comments

Comments
 (0)