Skip to content
Open
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
10 changes: 9 additions & 1 deletion .github/workflows/check-docker-image-is-used.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,18 @@
pull_request:
branches: [ main ]

permissions:
contents: read

jobs:
check-docker-image-is-used:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@a5ad31d6a139d249332a2605b85202e8c0b78450 # v2.19.1
with:
egress-policy: audit

- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Check action will use image
run: yq -e '.runs.image=="docker://ghcr.io/contrast-security-oss/integration-verify:main"' action.yaml || { echo "::error file=action.yaml,line=$(yq '.runs.image|line' action.yaml),column=$(yq '.runs.image|column' action.yaml),endColumn=$(yq '(.runs.image|column)+(.runs.image|length)' action.yaml)::Action is not configured to use built Docker image" && exit 1; }
20 changes: 14 additions & 6 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ env:
REGISTRY: ghcr.io
IMAGE_NAME: contrast-security-oss/integration-verify

permissions:
contents: read

jobs:
build-and-push-image:
runs-on: ubuntu-latest
Expand All @@ -20,25 +23,30 @@ jobs:
packages: write

steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@a5ad31d6a139d249332a2605b85202e8c0b78450 # v2.19.1
with:
egress-policy: audit

- name: Checkout repository
uses: actions/checkout@v6
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

- name: Set up QEMU
uses: docker/setup-qemu-action@v3
uses: step-security/setup-qemu-action@109c6ed9f089be1a250c75fd6a534e30df44e030 # v4.0.0

- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3
uses: step-security/setup-buildx-action@f931205d68723ad9589fd2a7e2ece238bf9de341 # v4.0.0

- name: Log in to the Container registry
uses: docker/login-action@v3
uses: step-security/docker-login-action@870af644803bf9f204aed474adbad2958fec048b # v4.1.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5.10.0
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
Expand All @@ -48,7 +56,7 @@ jobs:
type=semver,pattern={{major}},enable=${{ !startsWith(github.ref, 'refs/tags/v0.') }}

- name: Build and push Docker image
uses: docker/build-push-action@v6
uses: step-security/docker-build-push-action@846549baaf047e867d038826129a64d81df0f704 # v7.1.0
with:
context: .
platforms: linux/amd64, linux/arm64
Expand Down
16 changes: 12 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,20 @@ env:
PRE_COMMIT_CACHE: ~/.cache/pre-commit

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
permissions:
contents: read

jobs:
unit-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@a5ad31d6a139d249332a2605b85202e8c0b78450 # v2.19.1
with:
egress-policy: audit

- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: ${{ env.DEFAULT_PYTHON }}
cache: "pip"
Expand All @@ -33,7 +41,7 @@ jobs:
run: pip install -r requirements-dev.txt
- name: Restore pre-commit environment from cache
id: cache-precommit
uses: actions/cache@v5.0.2
uses: actions/cache@8b402f58fbc84540c8b491a91e594a4576fec3d7 # v5.0.2
with:
path: ${{ env.PRE_COMMIT_CACHE }}
key: >-
Expand All @@ -45,7 +53,7 @@ jobs:
run: pre-commit run --hook-stage manual --all-files --show-diff-on-failure
- name: Run unit-tests
run: python -m pytest --cov --cov-config=tox.ini --cov-report=term --cov-report=html
- uses: actions/upload-artifact@v6
- uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
with:
name: test-coverage
path: htmlcov
4 changes: 4 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,7 @@ repos:
rev: v1.1.406
hooks:
- id: pyright
- repo: https://github.com/gitleaks/gitleaks
rev: v8.16.3
hooks:
- id: gitleaks
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ghcr.io/astral-sh/uv:python3.13-alpine
FROM ghcr.io/astral-sh/uv:python3.13-alpine@sha256:213ea9e877219e7bcb0f55070c9130c3fc84995475fca9eb8fb362916dc3f808

ENV VIRT_ENV=/opt/venv
RUN uv venv $VIRT_ENV --python 3.13
Expand Down
Loading