Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,23 @@ jobs:
with:
dockerfile: Dockerfile

# Scan the Dockerfile with KICS to check for security issues.
- name: Docker Scan
uses: Checkmarx/kics-github-action@v2.1.10
with:
path: Dockerfile
fail_on: high,medium
output_path: results
output_formats: 'json,sarif'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# Upload the results of the KICS scan as a build artifact.
- name: Upload SARIF file
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: results/results.sarif

test:
runs-on: ubuntu-latest
steps:
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@
# Environments
venv/
virtualenv/

# Security Artifacts
results.json
27 changes: 27 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Contribution Guide

Contributions in the form of issues and pull requests are welcome. Please read the following guidelines before contributing.

## Pre-commit Hooks

This project uses [pre-commit](https://pre-commit.com/) to run a series of checks before committing code. To install the pre-commit hooks, run the following command:

```bash
pre-commit install
```

Run the following command to run the pre-commit hooks on all files:

```bash
pre-commit run --all-files
```

## Security Testing

This project uses [KICS](https://docs.kics.io/latest/getting-started/) to scan for security issues in the infrastructure such as the `Dockerfile`. To run the scan, run the following command:

```bash
docker run -t -v $(pwd):/path checkmarx/kics:latest scan -p /path/Dockerfile -o "/path/"
```

This will generate a `results.json` file as well as print the contents to the console. Any findings above a `low` severity should be addressed before committing code as they will fail the CI pipeline.
5 changes: 5 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.11-slim-bullseye

Check warning on line 1 in Dockerfile

View workflow job for this annotation

GitHub Actions / lint

[LOW] Healthcheck Instruction Missing

Ensure that HEALTHCHECK is being used. The HEALTHCHECK instruction tells Docker how to test a container to check that it is still working

Check warning on line 1 in Dockerfile

View workflow job for this annotation

GitHub Actions / lint

[LOW] Healthcheck Instruction Missing

Ensure that HEALTHCHECK is being used. The HEALTHCHECK instruction tells Docker how to test a container to check that it is still working

# This is based on guidance in https://github.com/casework/CASE-Utilities-Python/tree/main
WORKDIR /opt/workspace
Expand All @@ -12,6 +12,11 @@
# Copy in the entrypoint file
COPY entrypoint.py /opt/workspace/entrypoint.py

# Setup a user with the appropriate permissions
RUN useradd -ms /bin/bash case &&\
chown -R case:case /opt/workspace
USER case

# Define the base path for the validation path
ENV CASE_PATH="/opt/json/"
ENV CASE_VERSION="case-1.4.0"
Expand Down
Loading