purser 0.1.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- purser-0.1.1/.dockerignore +12 -0
- purser-0.1.1/.github/dependabot.yml +23 -0
- purser-0.1.1/.github/workflows/ci.yml +140 -0
- purser-0.1.1/.github/workflows/codeql.yml +36 -0
- purser-0.1.1/.github/workflows/dependency-review.yml +23 -0
- purser-0.1.1/.github/workflows/release.yml +274 -0
- purser-0.1.1/.github/workflows/wolfi-base-check.yml +80 -0
- purser-0.1.1/.gitignore +57 -0
- purser-0.1.1/.gitlab-ci.yml +82 -0
- purser-0.1.1/BRAND.md +192 -0
- purser-0.1.1/Dockerfile +52 -0
- purser-0.1.1/Dockerfile.deep +45 -0
- purser-0.1.1/Dockerfile.hf +47 -0
- purser-0.1.1/LICENSE +201 -0
- purser-0.1.1/Makefile +93 -0
- purser-0.1.1/PKG-INFO +570 -0
- purser-0.1.1/README.md +542 -0
- purser-0.1.1/ROADMAP.md +120 -0
- purser-0.1.1/SECURITY.md +192 -0
- purser-0.1.1/THIRD_PARTY_LICENSES.md +78 -0
- purser-0.1.1/TRADEMARKS.md +42 -0
- purser-0.1.1/assets/brand/purser-logo.png +0 -0
- purser-0.1.1/assets/brand/purser-logo.svg +17 -0
- purser-0.1.1/assets/brand/purser-mark.png +0 -0
- purser-0.1.1/assets/brand/purser-mark.svg +17 -0
- purser-0.1.1/deploy/grafana/purser-overview.json +114 -0
- purser-0.1.1/deploy/helm/purser/.helmignore +9 -0
- purser-0.1.1/deploy/helm/purser/Chart.yaml +22 -0
- purser-0.1.1/deploy/helm/purser/README.md +69 -0
- purser-0.1.1/deploy/helm/purser/templates/NOTES.txt +45 -0
- purser-0.1.1/deploy/helm/purser/templates/_helpers.tpl +128 -0
- purser-0.1.1/deploy/helm/purser/templates/configmap-policy.yaml +16 -0
- purser-0.1.1/deploy/helm/purser/templates/deployment-deep.yaml +91 -0
- purser-0.1.1/deploy/helm/purser/templates/deployment-hf.yaml +103 -0
- purser-0.1.1/deploy/helm/purser/templates/deployment.yaml +106 -0
- purser-0.1.1/deploy/helm/purser/templates/hpa.yaml +33 -0
- purser-0.1.1/deploy/helm/purser/templates/ingress.yaml +36 -0
- purser-0.1.1/deploy/helm/purser/templates/networkpolicy.yaml +32 -0
- purser-0.1.1/deploy/helm/purser/templates/poddisruptionbudget.yaml +19 -0
- purser-0.1.1/deploy/helm/purser/templates/secret.yaml +14 -0
- purser-0.1.1/deploy/helm/purser/templates/service.yaml +21 -0
- purser-0.1.1/deploy/helm/purser/templates/serviceaccount.yaml +13 -0
- purser-0.1.1/deploy/helm/purser/templates/servicemonitor.yaml +22 -0
- purser-0.1.1/deploy/helm/purser/templates/tests/test-connection.yaml +26 -0
- purser-0.1.1/deploy/helm/purser/values.schema.json +94 -0
- purser-0.1.1/deploy/helm/purser/values.yaml +212 -0
- purser-0.1.1/deploy/k8s/configmap-policy.yaml +27 -0
- purser-0.1.1/deploy/k8s/deployment.yaml +103 -0
- purser-0.1.1/deploy/k8s/ingress.yaml +21 -0
- purser-0.1.1/deploy/k8s/kustomization.yaml +10 -0
- purser-0.1.1/deploy/k8s/namespace.yaml +6 -0
- purser-0.1.1/deploy/k8s/secret.yaml +12 -0
- purser-0.1.1/deploy/k8s/service.yaml +15 -0
- purser-0.1.1/docker-compose.yml +72 -0
- purser-0.1.1/docs/README.md +29 -0
- purser-0.1.1/docs/configuring-policy.md +284 -0
- purser-0.1.1/docs/data-scientists.md +162 -0
- purser-0.1.1/docs/devsecops-gitlab.md +232 -0
- purser-0.1.1/policies/allowlist-us-eu.yaml +18 -0
- purser-0.1.1/policies/default.yaml +18 -0
- purser-0.1.1/policies/signed-only.yaml +25 -0
- purser-0.1.1/policies/strict.yaml +23 -0
- purser-0.1.1/policies/trust_store.example.yaml +31 -0
- purser-0.1.1/pyproject.toml +44 -0
- purser-0.1.1/requirements-deep.lock +616 -0
- purser-0.1.1/requirements-hf.lock +832 -0
- purser-0.1.1/requirements.lock +770 -0
- purser-0.1.1/scripts/gen_sbom.py +147 -0
- purser-0.1.1/scripts/gen_third_party_licenses.py +109 -0
- purser-0.1.1/src/purser/__init__.py +3 -0
- purser-0.1.1/src/purser/api.py +302 -0
- purser-0.1.1/src/purser/cli.py +280 -0
- purser-0.1.1/src/purser/core/__init__.py +0 -0
- purser-0.1.1/src/purser/core/audit.py +95 -0
- purser-0.1.1/src/purser/core/deep.py +110 -0
- purser-0.1.1/src/purser/core/dispatch.py +102 -0
- purser-0.1.1/src/purser/core/env.py +13 -0
- purser-0.1.1/src/purser/core/findings.py +139 -0
- purser-0.1.1/src/purser/core/formats.py +206 -0
- purser-0.1.1/src/purser/core/hf.py +34 -0
- purser-0.1.1/src/purser/core/metrics.py +169 -0
- purser-0.1.1/src/purser/core/policy.py +349 -0
- purser-0.1.1/src/purser/core/provenance.py +109 -0
- purser-0.1.1/src/purser/core/scanner.py +184 -0
- purser-0.1.1/src/purser/core/signing.py +343 -0
- purser-0.1.1/src/purser/data/__init__.py +0 -0
- purser-0.1.1/src/purser/data/org_countries.yaml +92 -0
- purser-0.1.1/src/purser/scanners/__init__.py +0 -0
- purser-0.1.1/src/purser/scanners/archive.py +115 -0
- purser-0.1.1/src/purser/scanners/base.py +35 -0
- purser-0.1.1/src/purser/scanners/exfil.py +343 -0
- purser-0.1.1/src/purser/scanners/extended.py +272 -0
- purser-0.1.1/src/purser/scanners/formats.py +355 -0
- purser-0.1.1/src/purser/scanners/pickle_scanner.py +320 -0
- purser-0.1.1/src/purser/scanners/source.py +270 -0
- purser-0.1.1/src/purser_deep/__init__.py +18 -0
- purser-0.1.1/src/purser_deep/analyzers/__init__.py +0 -0
- purser-0.1.1/src/purser_deep/analyzers/gadget.py +148 -0
- purser-0.1.1/src/purser_deep/analyzers/weights.py +203 -0
- purser-0.1.1/src/purser_deep/api.py +74 -0
- purser-0.1.1/src/purser_deep/scan.py +43 -0
- purser-0.1.1/tests/conftest.py +175 -0
- purser-0.1.1/tests/test_api.py +61 -0
- purser-0.1.1/tests/test_completion.py +148 -0
- purser-0.1.1/tests/test_deep.py +142 -0
- purser-0.1.1/tests/test_env.py +13 -0
- purser-0.1.1/tests/test_exfil.py +42 -0
- purser-0.1.1/tests/test_exfil_evasion.py +100 -0
- purser-0.1.1/tests/test_extended_formats.py +216 -0
- purser-0.1.1/tests/test_formats.py +70 -0
- purser-0.1.1/tests/test_hardening.py +194 -0
- purser-0.1.1/tests/test_observability.py +145 -0
- purser-0.1.1/tests/test_pickle_scanner.py +61 -0
- purser-0.1.1/tests/test_policy.py +101 -0
- purser-0.1.1/tests/test_policy_models.py +87 -0
- purser-0.1.1/tests/test_signing.py +152 -0
- purser-0.1.1/tests/test_source.py +154 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Keep the GitHub Actions and Python dependency trees patched.
|
|
2
|
+
version: 2
|
|
3
|
+
updates:
|
|
4
|
+
- package-ecosystem: github-actions
|
|
5
|
+
directory: "/"
|
|
6
|
+
schedule:
|
|
7
|
+
interval: weekly
|
|
8
|
+
groups:
|
|
9
|
+
actions:
|
|
10
|
+
patterns: ["*"]
|
|
11
|
+
|
|
12
|
+
- package-ecosystem: pip
|
|
13
|
+
directory: "/"
|
|
14
|
+
schedule:
|
|
15
|
+
interval: weekly
|
|
16
|
+
# Lockfiles are hash-pinned and regenerated via `make lock`; Dependabot
|
|
17
|
+
# signals updates against pyproject, and `make lock-verify` gates drift.
|
|
18
|
+
open-pull-requests-limit: 5
|
|
19
|
+
|
|
20
|
+
- package-ecosystem: docker
|
|
21
|
+
directory: "/"
|
|
22
|
+
schedule:
|
|
23
|
+
interval: weekly
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
# Continuous integration: lint + test across the supported Python range,
|
|
2
|
+
# lockfile / license drift gates, Helm chart validation, and a no-push build of
|
|
3
|
+
# all three images (so a broken Dockerfile fails the PR, not the release).
|
|
4
|
+
name: CI
|
|
5
|
+
|
|
6
|
+
on:
|
|
7
|
+
push:
|
|
8
|
+
branches: [main]
|
|
9
|
+
pull_request:
|
|
10
|
+
branches: [main]
|
|
11
|
+
|
|
12
|
+
permissions:
|
|
13
|
+
contents: read
|
|
14
|
+
|
|
15
|
+
concurrency:
|
|
16
|
+
group: ci-${{ github.ref }}
|
|
17
|
+
cancel-in-progress: true
|
|
18
|
+
|
|
19
|
+
jobs:
|
|
20
|
+
test:
|
|
21
|
+
name: test (py${{ matrix.python }})
|
|
22
|
+
runs-on: ubuntu-latest
|
|
23
|
+
strategy:
|
|
24
|
+
fail-fast: false
|
|
25
|
+
matrix:
|
|
26
|
+
# The support range declared in pyproject (requires-python >=3.11).
|
|
27
|
+
python: ["3.11", "3.12", "3.13", "3.14"]
|
|
28
|
+
steps:
|
|
29
|
+
- uses: actions/checkout@v4
|
|
30
|
+
- name: Set up uv + Python ${{ matrix.python }}
|
|
31
|
+
uses: astral-sh/setup-uv@v5
|
|
32
|
+
with:
|
|
33
|
+
python-version: ${{ matrix.python }}
|
|
34
|
+
enable-cache: true
|
|
35
|
+
- name: Install (dev + sign extras)
|
|
36
|
+
run: |
|
|
37
|
+
uv venv --clear
|
|
38
|
+
uv pip install -e ".[dev,sign]"
|
|
39
|
+
- name: Ruff (lint)
|
|
40
|
+
run: uv run ruff check src tests
|
|
41
|
+
- name: Pytest
|
|
42
|
+
run: uv run pytest -q
|
|
43
|
+
|
|
44
|
+
lockfiles:
|
|
45
|
+
name: lockfile drift
|
|
46
|
+
runs-on: ubuntu-latest
|
|
47
|
+
steps:
|
|
48
|
+
- uses: actions/checkout@v4
|
|
49
|
+
- uses: astral-sh/setup-uv@v5
|
|
50
|
+
with:
|
|
51
|
+
python-version: "3.14"
|
|
52
|
+
# Pin uv: lockfile output is uv-version-specific, so this must match
|
|
53
|
+
# the version used to generate the committed locks (see Makefile).
|
|
54
|
+
version: "0.11.7"
|
|
55
|
+
# Fails if requirements*.lock drift from pyproject.toml (supply-chain gate).
|
|
56
|
+
- name: Verify lockfiles are current
|
|
57
|
+
run: make lock-verify
|
|
58
|
+
|
|
59
|
+
licenses:
|
|
60
|
+
name: THIRD_PARTY_LICENSES drift
|
|
61
|
+
runs-on: ubuntu-latest
|
|
62
|
+
steps:
|
|
63
|
+
- uses: actions/checkout@v4
|
|
64
|
+
- uses: astral-sh/setup-uv@v5
|
|
65
|
+
with:
|
|
66
|
+
python-version: "3.14"
|
|
67
|
+
# gen_sbom.py resolves licenses from *installed* metadata, so every dep
|
|
68
|
+
# must be present for the license lookup to succeed.
|
|
69
|
+
- name: Install all extras
|
|
70
|
+
run: |
|
|
71
|
+
uv venv --clear
|
|
72
|
+
uv pip install -e ".[dev,sign,hf,deep]"
|
|
73
|
+
- name: Regenerate THIRD_PARTY_LICENSES.md
|
|
74
|
+
run: uv run make licenses
|
|
75
|
+
# Gate on the invariant that matters (all licenses resolved & permissive),
|
|
76
|
+
# not a byte-for-byte diff that would be sensitive to the environment.
|
|
77
|
+
- name: Assert every license resolved
|
|
78
|
+
run: |
|
|
79
|
+
if grep -qi 'UNKNOWN (see project)' THIRD_PARTY_LICENSES.md; then
|
|
80
|
+
echo "::error::Unresolved dependency license in THIRD_PARTY_LICENSES.md:"
|
|
81
|
+
grep -ni 'UNKNOWN (see project)' THIRD_PARTY_LICENSES.md
|
|
82
|
+
exit 1
|
|
83
|
+
fi
|
|
84
|
+
echo "All dependency licenses resolved."
|
|
85
|
+
|
|
86
|
+
helm:
|
|
87
|
+
name: helm lint + template
|
|
88
|
+
runs-on: ubuntu-latest
|
|
89
|
+
steps:
|
|
90
|
+
- uses: actions/checkout@v4
|
|
91
|
+
- uses: azure/setup-helm@v4
|
|
92
|
+
- name: Lint
|
|
93
|
+
run: helm lint deploy/helm/purser
|
|
94
|
+
- name: Render (defaults)
|
|
95
|
+
run: helm template purser deploy/helm/purser > /dev/null
|
|
96
|
+
- name: Render (all optional components)
|
|
97
|
+
run: |
|
|
98
|
+
helm template purser deploy/helm/purser \
|
|
99
|
+
--set deep.enabled=true \
|
|
100
|
+
--set hf.enabled=true \
|
|
101
|
+
--set ingress.enabled=true \
|
|
102
|
+
--set autoscaling.enabled=true \
|
|
103
|
+
--set networkPolicy.enabled=true \
|
|
104
|
+
--set podDisruptionBudget.enabled=true \
|
|
105
|
+
--set metrics.serviceMonitor.enabled=true > /dev/null
|
|
106
|
+
|
|
107
|
+
docker:
|
|
108
|
+
name: docker build (${{ matrix.name }})
|
|
109
|
+
runs-on: ubuntu-latest
|
|
110
|
+
permissions:
|
|
111
|
+
contents: read
|
|
112
|
+
strategy:
|
|
113
|
+
fail-fast: false
|
|
114
|
+
matrix:
|
|
115
|
+
include:
|
|
116
|
+
- { name: core, file: Dockerfile }
|
|
117
|
+
- { name: hf, file: Dockerfile.hf }
|
|
118
|
+
- { name: deep, file: Dockerfile.deep }
|
|
119
|
+
steps:
|
|
120
|
+
- uses: actions/checkout@v4
|
|
121
|
+
- uses: docker/setup-buildx-action@v3
|
|
122
|
+
# Single-arch, loaded into the local daemon (no registry push on PRs) so
|
|
123
|
+
# the Dockerfiles are exercised and the image can be vuln-scanned.
|
|
124
|
+
- name: Build ${{ matrix.name }}
|
|
125
|
+
uses: docker/build-push-action@v6
|
|
126
|
+
with:
|
|
127
|
+
context: .
|
|
128
|
+
file: ${{ matrix.file }}
|
|
129
|
+
push: false
|
|
130
|
+
load: true
|
|
131
|
+
tags: purser-${{ matrix.name }}:ci
|
|
132
|
+
cache-from: type=gha,scope=${{ matrix.name }}
|
|
133
|
+
cache-to: type=gha,mode=max,scope=${{ matrix.name }}
|
|
134
|
+
- name: Trivy scan (HIGH/CRITICAL, fixed only)
|
|
135
|
+
uses: aquasecurity/trivy-action@v0.36.0
|
|
136
|
+
with:
|
|
137
|
+
image-ref: purser-${{ matrix.name }}:ci
|
|
138
|
+
exit-code: "1"
|
|
139
|
+
severity: HIGH,CRITICAL
|
|
140
|
+
ignore-unfixed: true
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Static analysis of the Python source with GitHub CodeQL (security-extended).
|
|
2
|
+
name: CodeQL
|
|
3
|
+
|
|
4
|
+
on:
|
|
5
|
+
push:
|
|
6
|
+
branches: [main]
|
|
7
|
+
pull_request:
|
|
8
|
+
branches: [main]
|
|
9
|
+
schedule:
|
|
10
|
+
- cron: "0 3 * * 2" # Tuesdays 03:00 UTC
|
|
11
|
+
|
|
12
|
+
permissions:
|
|
13
|
+
contents: read
|
|
14
|
+
|
|
15
|
+
jobs:
|
|
16
|
+
analyze:
|
|
17
|
+
name: analyze (python)
|
|
18
|
+
runs-on: ubuntu-latest
|
|
19
|
+
# Code scanning upload needs GitHub Advanced Security, which isn't available
|
|
20
|
+
# on private repos. Stay dormant until the repo is public (skipped != failed).
|
|
21
|
+
if: github.event.repository.visibility == 'public'
|
|
22
|
+
permissions:
|
|
23
|
+
contents: read
|
|
24
|
+
security-events: write
|
|
25
|
+
actions: read
|
|
26
|
+
steps:
|
|
27
|
+
- uses: actions/checkout@v4
|
|
28
|
+
- name: Initialize CodeQL
|
|
29
|
+
uses: github/codeql-action/init@v3
|
|
30
|
+
with:
|
|
31
|
+
languages: python
|
|
32
|
+
queries: security-extended
|
|
33
|
+
- name: Analyze
|
|
34
|
+
uses: github/codeql-action/analyze@v3
|
|
35
|
+
with:
|
|
36
|
+
category: "/language:python"
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Blocks PRs that introduce dependencies with known vulnerabilities or
|
|
2
|
+
# disallowed (copyleft) licenses — Purser ships permissive-only.
|
|
3
|
+
name: Dependency review
|
|
4
|
+
|
|
5
|
+
on:
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
permissions:
|
|
10
|
+
contents: read
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
review:
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
# The dependency-review API requires the dependency graph, which on private
|
|
16
|
+
# repos needs GitHub Advanced Security. Dormant until the repo is public.
|
|
17
|
+
if: github.event.repository.visibility == 'public'
|
|
18
|
+
steps:
|
|
19
|
+
- uses: actions/checkout@v4
|
|
20
|
+
- uses: actions/dependency-review-action@v4
|
|
21
|
+
with:
|
|
22
|
+
fail-on-severity: high
|
|
23
|
+
deny-licenses: GPL-2.0, GPL-3.0, AGPL-3.0, LGPL-3.0
|
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
# Release pipeline (runs on version tags): build + push all three images to
|
|
2
|
+
# GHCR multi-arch, generate CycloneDX SBOMs, gate on vulnerabilities, then
|
|
3
|
+
# keyless-sign + attest (SLSA provenance + SBOM) each image by digest; build the
|
|
4
|
+
# PyPI sdist+wheel (and publish via Trusted Publishing when opted in); and cut a
|
|
5
|
+
# GitHub Release carrying the SBOMs, THIRD_PARTY_LICENSES, chart, and dists.
|
|
6
|
+
name: Release
|
|
7
|
+
|
|
8
|
+
on:
|
|
9
|
+
push:
|
|
10
|
+
tags: ["v*"]
|
|
11
|
+
workflow_dispatch:
|
|
12
|
+
inputs:
|
|
13
|
+
ref:
|
|
14
|
+
description: "Tag/ref to build"
|
|
15
|
+
required: true
|
|
16
|
+
|
|
17
|
+
permissions:
|
|
18
|
+
contents: read
|
|
19
|
+
|
|
20
|
+
env:
|
|
21
|
+
REGISTRY: ghcr.io
|
|
22
|
+
|
|
23
|
+
jobs:
|
|
24
|
+
images:
|
|
25
|
+
name: build ${{ matrix.name }}
|
|
26
|
+
runs-on: ubuntu-latest
|
|
27
|
+
permissions:
|
|
28
|
+
contents: read
|
|
29
|
+
packages: write # push to GHCR
|
|
30
|
+
id-token: write # cosign keyless + provenance attestation
|
|
31
|
+
attestations: write # actions/attest-build-provenance
|
|
32
|
+
strategy:
|
|
33
|
+
fail-fast: false
|
|
34
|
+
matrix:
|
|
35
|
+
include:
|
|
36
|
+
- { name: core, file: Dockerfile, suffix: "", lock: requirements.lock }
|
|
37
|
+
- { name: hf, file: Dockerfile.hf, suffix: "-hf", lock: requirements-hf.lock }
|
|
38
|
+
- { name: deep, file: Dockerfile.deep, suffix: "-deep", lock: requirements-deep.lock }
|
|
39
|
+
steps:
|
|
40
|
+
- uses: actions/checkout@v4
|
|
41
|
+
|
|
42
|
+
- uses: docker/setup-qemu-action@v3
|
|
43
|
+
- uses: docker/setup-buildx-action@v3
|
|
44
|
+
|
|
45
|
+
- name: Log in to GHCR
|
|
46
|
+
uses: docker/login-action@v3
|
|
47
|
+
with:
|
|
48
|
+
registry: ${{ env.REGISTRY }}
|
|
49
|
+
username: ${{ github.actor }}
|
|
50
|
+
password: ${{ secrets.GITHUB_TOKEN }}
|
|
51
|
+
|
|
52
|
+
- name: Image metadata
|
|
53
|
+
id: meta
|
|
54
|
+
uses: docker/metadata-action@v5
|
|
55
|
+
with:
|
|
56
|
+
images: ${{ env.REGISTRY }}/${{ github.repository }}${{ matrix.suffix }}
|
|
57
|
+
tags: |
|
|
58
|
+
type=semver,pattern={{version}}
|
|
59
|
+
type=semver,pattern={{major}}.{{minor}}
|
|
60
|
+
type=sha
|
|
61
|
+
|
|
62
|
+
- name: Build and push (amd64 + arm64)
|
|
63
|
+
id: build
|
|
64
|
+
uses: docker/build-push-action@v6
|
|
65
|
+
with:
|
|
66
|
+
context: .
|
|
67
|
+
file: ${{ matrix.file }}
|
|
68
|
+
platforms: linux/amd64,linux/arm64
|
|
69
|
+
push: true
|
|
70
|
+
provenance: true
|
|
71
|
+
sbom: true
|
|
72
|
+
tags: ${{ steps.meta.outputs.tags }}
|
|
73
|
+
labels: ${{ steps.meta.outputs.labels }}
|
|
74
|
+
cache-from: type=gha,scope=${{ matrix.name }}
|
|
75
|
+
cache-to: type=gha,mode=max,scope=${{ matrix.name }}
|
|
76
|
+
|
|
77
|
+
- name: Set image ref
|
|
78
|
+
id: ref
|
|
79
|
+
run: echo "image=${REGISTRY}/${GH_REPO}${SUFFIX}" >> "$GITHUB_OUTPUT"
|
|
80
|
+
env:
|
|
81
|
+
GH_REPO: ${{ github.repository }}
|
|
82
|
+
SUFFIX: ${{ matrix.suffix }}
|
|
83
|
+
|
|
84
|
+
# --- SBOM (CycloneDX, license-aware) from the hash-pinned lockfile ---
|
|
85
|
+
- uses: astral-sh/setup-uv@v5
|
|
86
|
+
with:
|
|
87
|
+
python-version: "3.14"
|
|
88
|
+
- name: Install extras for license resolution
|
|
89
|
+
run: |
|
|
90
|
+
uv venv --clear
|
|
91
|
+
uv pip install -e ".[dev,sign,hf,deep]"
|
|
92
|
+
- name: Generate CycloneDX SBOM
|
|
93
|
+
run: |
|
|
94
|
+
mkdir -p sbom
|
|
95
|
+
uv run python scripts/gen_sbom.py "${{ matrix.lock }}" \
|
|
96
|
+
"sbom/purser-${{ matrix.name }}.cdx.json" \
|
|
97
|
+
--name "purser${{ matrix.suffix }}" --version "${GITHUB_REF_NAME#v}"
|
|
98
|
+
|
|
99
|
+
# --- Vulnerability gate: never sign a vulnerable image ---
|
|
100
|
+
- name: Trivy scan (HIGH/CRITICAL, fixed only)
|
|
101
|
+
uses: aquasecurity/trivy-action@v0.36.0
|
|
102
|
+
with:
|
|
103
|
+
image-ref: ${{ steps.ref.outputs.image }}@${{ steps.build.outputs.digest }}
|
|
104
|
+
exit-code: "1"
|
|
105
|
+
severity: HIGH,CRITICAL
|
|
106
|
+
ignore-unfixed: true
|
|
107
|
+
|
|
108
|
+
- name: OSV scan of SBOM deps (advisory)
|
|
109
|
+
continue-on-error: true
|
|
110
|
+
run: |
|
|
111
|
+
docker run --rm -v "${{ github.workspace }}:/w" \
|
|
112
|
+
${{ env.REGISTRY }}/google/osv-scanner:latest \
|
|
113
|
+
scan --sbom="/w/sbom/purser-${{ matrix.name }}.cdx.json"
|
|
114
|
+
|
|
115
|
+
# --- Sign + attest by digest (keyless via Fulcio/Rekor) ---
|
|
116
|
+
- uses: sigstore/cosign-installer@v3
|
|
117
|
+
- name: Cosign sign
|
|
118
|
+
run: cosign sign --yes "${IMAGE}@${DIGEST}"
|
|
119
|
+
env:
|
|
120
|
+
IMAGE: ${{ steps.ref.outputs.image }}
|
|
121
|
+
DIGEST: ${{ steps.build.outputs.digest }}
|
|
122
|
+
- name: Cosign attest SBOM
|
|
123
|
+
run: |
|
|
124
|
+
cosign attest --yes --type cyclonedx \
|
|
125
|
+
--predicate "sbom/purser-${{ matrix.name }}.cdx.json" \
|
|
126
|
+
"${IMAGE}@${DIGEST}"
|
|
127
|
+
env:
|
|
128
|
+
IMAGE: ${{ steps.ref.outputs.image }}
|
|
129
|
+
DIGEST: ${{ steps.build.outputs.digest }}
|
|
130
|
+
# GitHub-native attestation needs a paid plan or a public repo. The cosign
|
|
131
|
+
# sign + SBOM attest steps above already provide Sigstore-backed signatures
|
|
132
|
+
# and provenance (in-registry + Rekor), so this is a redundant extra that
|
|
133
|
+
# activates automatically if the repo is ever made public.
|
|
134
|
+
- name: SLSA build provenance
|
|
135
|
+
if: github.event.repository.visibility == 'public'
|
|
136
|
+
uses: actions/attest-build-provenance@v2
|
|
137
|
+
with:
|
|
138
|
+
subject-name: ${{ steps.ref.outputs.image }}
|
|
139
|
+
subject-digest: ${{ steps.build.outputs.digest }}
|
|
140
|
+
push-to-registry: true
|
|
141
|
+
|
|
142
|
+
- name: Upload SBOM artifact
|
|
143
|
+
uses: actions/upload-artifact@v4
|
|
144
|
+
with:
|
|
145
|
+
name: sbom-${{ matrix.name }}
|
|
146
|
+
path: sbom/purser-${{ matrix.name }}.cdx.json
|
|
147
|
+
|
|
148
|
+
chart:
|
|
149
|
+
name: publish Helm chart
|
|
150
|
+
needs: images
|
|
151
|
+
runs-on: ubuntu-latest
|
|
152
|
+
permissions:
|
|
153
|
+
contents: read
|
|
154
|
+
packages: write # push chart to GHCR (OCI)
|
|
155
|
+
id-token: write # cosign keyless
|
|
156
|
+
steps:
|
|
157
|
+
- uses: actions/checkout@v4
|
|
158
|
+
- uses: azure/setup-helm@v4
|
|
159
|
+
- uses: sigstore/cosign-installer@v3
|
|
160
|
+
# cosign reads Docker's config for registry auth; helm registry login
|
|
161
|
+
# writes its own, so log in with both.
|
|
162
|
+
- name: Log in to GHCR (Docker, for cosign)
|
|
163
|
+
uses: docker/login-action@v3
|
|
164
|
+
with:
|
|
165
|
+
registry: ghcr.io
|
|
166
|
+
username: ${{ github.actor }}
|
|
167
|
+
password: ${{ secrets.GITHUB_TOKEN }}
|
|
168
|
+
# Stamp the chart version + appVersion from the tag (no in-repo edit).
|
|
169
|
+
- name: Package chart
|
|
170
|
+
run: |
|
|
171
|
+
VERSION="${GITHUB_REF_NAME#v}"
|
|
172
|
+
echo "VERSION=$VERSION" >> "$GITHUB_ENV"
|
|
173
|
+
mkdir -p dist
|
|
174
|
+
helm package deploy/helm/purser \
|
|
175
|
+
--version "$VERSION" --app-version "$VERSION" -d dist
|
|
176
|
+
- name: Log in to GHCR (Helm registry)
|
|
177
|
+
run: |
|
|
178
|
+
echo "${{ secrets.GITHUB_TOKEN }}" \
|
|
179
|
+
| helm registry login ghcr.io -u ${{ github.actor }} --password-stdin
|
|
180
|
+
- name: Push chart (OCI) and cosign-sign
|
|
181
|
+
run: |
|
|
182
|
+
out=$(helm push "dist/purser-${VERSION}.tgz" \
|
|
183
|
+
"oci://ghcr.io/${{ github.repository_owner }}/charts" 2>&1)
|
|
184
|
+
echo "$out"
|
|
185
|
+
digest=$(echo "$out" | awk -F': ' '/Digest:/ {print $2}')
|
|
186
|
+
test -n "$digest" || { echo "::error::could not parse chart digest"; exit 1; }
|
|
187
|
+
cosign sign --yes \
|
|
188
|
+
"ghcr.io/${{ github.repository_owner }}/charts/purser@${digest}"
|
|
189
|
+
- name: Upload chart artifact
|
|
190
|
+
uses: actions/upload-artifact@v4
|
|
191
|
+
with:
|
|
192
|
+
name: chart
|
|
193
|
+
path: dist/*.tgz
|
|
194
|
+
|
|
195
|
+
pydist:
|
|
196
|
+
name: build PyPI distributions
|
|
197
|
+
runs-on: ubuntu-latest
|
|
198
|
+
permissions:
|
|
199
|
+
contents: read
|
|
200
|
+
steps:
|
|
201
|
+
- uses: actions/checkout@v4
|
|
202
|
+
- uses: astral-sh/setup-uv@v5
|
|
203
|
+
with:
|
|
204
|
+
python-version: "3.14"
|
|
205
|
+
# sdist + wheel via the hatchling backend (isolated build env).
|
|
206
|
+
- name: Build sdist + wheel
|
|
207
|
+
run: uv build --sdist --wheel --out-dir dist
|
|
208
|
+
- name: Validate package metadata
|
|
209
|
+
run: uvx twine check dist/*
|
|
210
|
+
- name: Upload distributions
|
|
211
|
+
uses: actions/upload-artifact@v4
|
|
212
|
+
with:
|
|
213
|
+
name: pydist
|
|
214
|
+
path: dist/*
|
|
215
|
+
|
|
216
|
+
pypi-publish:
|
|
217
|
+
name: publish to PyPI
|
|
218
|
+
needs: pydist
|
|
219
|
+
# Publishes only once you opt in (repo variable PUBLISH_PYPI=true) AND a PyPI
|
|
220
|
+
# Trusted Publisher is configured for this repo + workflow + environment
|
|
221
|
+
# "pypi". Until then the sdist/wheel are still built and attached to the
|
|
222
|
+
# GitHub Release by the `pydist`/`release` jobs.
|
|
223
|
+
if: vars.PUBLISH_PYPI == 'true'
|
|
224
|
+
runs-on: ubuntu-latest
|
|
225
|
+
environment:
|
|
226
|
+
name: pypi
|
|
227
|
+
url: https://pypi.org/p/purser
|
|
228
|
+
permissions:
|
|
229
|
+
id-token: write # PyPI Trusted Publishing (OIDC) — no API token
|
|
230
|
+
steps:
|
|
231
|
+
- name: Download distributions
|
|
232
|
+
uses: actions/download-artifact@v4
|
|
233
|
+
with:
|
|
234
|
+
name: pydist
|
|
235
|
+
path: dist
|
|
236
|
+
- name: Publish
|
|
237
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
238
|
+
with:
|
|
239
|
+
skip-existing: true # tolerate an already-uploaded placeholder version
|
|
240
|
+
|
|
241
|
+
release:
|
|
242
|
+
name: publish GitHub Release
|
|
243
|
+
needs: [images, chart, pydist]
|
|
244
|
+
runs-on: ubuntu-latest
|
|
245
|
+
permissions:
|
|
246
|
+
contents: write
|
|
247
|
+
steps:
|
|
248
|
+
- uses: actions/checkout@v4
|
|
249
|
+
- name: Collect SBOMs
|
|
250
|
+
uses: actions/download-artifact@v4
|
|
251
|
+
with:
|
|
252
|
+
pattern: sbom-*
|
|
253
|
+
path: sbom
|
|
254
|
+
merge-multiple: true
|
|
255
|
+
- name: Collect chart
|
|
256
|
+
uses: actions/download-artifact@v4
|
|
257
|
+
with:
|
|
258
|
+
name: chart
|
|
259
|
+
path: dist
|
|
260
|
+
- name: Collect PyPI distributions
|
|
261
|
+
uses: actions/download-artifact@v4
|
|
262
|
+
with:
|
|
263
|
+
name: pydist
|
|
264
|
+
path: dist
|
|
265
|
+
- name: Create release
|
|
266
|
+
uses: softprops/action-gh-release@v2
|
|
267
|
+
with:
|
|
268
|
+
generate_release_notes: true
|
|
269
|
+
files: |
|
|
270
|
+
sbom/*.cdx.json
|
|
271
|
+
THIRD_PARTY_LICENSES.md
|
|
272
|
+
dist/*.tgz
|
|
273
|
+
dist/*.whl
|
|
274
|
+
dist/*.tar.gz
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# Watches the Chainguard Wolfi base image. The Dockerfiles pin wolfi-base by
|
|
2
|
+
# digest for reproducibility; Chainguard rebuilds `:latest` frequently to pick
|
|
3
|
+
# up CVE fixes, so a static pin silently goes stale. This job compares the pin
|
|
4
|
+
# against the live index digest weekly and opens/updates an issue on drift.
|
|
5
|
+
name: Wolfi base drift
|
|
6
|
+
|
|
7
|
+
on:
|
|
8
|
+
schedule:
|
|
9
|
+
- cron: "0 6 * * 1" # Mondays 06:00 UTC
|
|
10
|
+
workflow_dispatch:
|
|
11
|
+
|
|
12
|
+
permissions:
|
|
13
|
+
contents: read
|
|
14
|
+
|
|
15
|
+
jobs:
|
|
16
|
+
check:
|
|
17
|
+
runs-on: ubuntu-latest
|
|
18
|
+
permissions:
|
|
19
|
+
contents: read
|
|
20
|
+
issues: write
|
|
21
|
+
steps:
|
|
22
|
+
- uses: actions/checkout@v4
|
|
23
|
+
- name: Compare pinned digest against live latest
|
|
24
|
+
id: check
|
|
25
|
+
run: |
|
|
26
|
+
set -euo pipefail
|
|
27
|
+
pinned=$(grep -oE 'sha256:[a-f0-9]{64}' Dockerfile | head -1)
|
|
28
|
+
token=$(curl -s "https://cgr.dev/token?scope=repository:chainguard/wolfi-base:pull" | jq -r .token)
|
|
29
|
+
live=$(curl -sI \
|
|
30
|
+
-H "Authorization: Bearer ${token}" \
|
|
31
|
+
-H "Accept: application/vnd.oci.image.index.v1+json" \
|
|
32
|
+
-H "Accept: application/vnd.docker.distribution.manifest.list.v2+json" \
|
|
33
|
+
"https://cgr.dev/v2/chainguard/wolfi-base/manifests/latest" \
|
|
34
|
+
| grep -i '^docker-content-digest:' | tr -d '\r' | awk '{print $2}')
|
|
35
|
+
echo "pinned=$pinned" >> "$GITHUB_OUTPUT"
|
|
36
|
+
echo "live=$live" >> "$GITHUB_OUTPUT"
|
|
37
|
+
echo "Pinned: $pinned"
|
|
38
|
+
echo "Live: $live"
|
|
39
|
+
if [ "$pinned" = "$live" ]; then
|
|
40
|
+
echo "drift=false" >> "$GITHUB_OUTPUT"
|
|
41
|
+
echo "Base image is current."
|
|
42
|
+
else
|
|
43
|
+
echo "drift=true" >> "$GITHUB_OUTPUT"
|
|
44
|
+
fi
|
|
45
|
+
|
|
46
|
+
- name: Open / update drift issue
|
|
47
|
+
if: steps.check.outputs.drift == 'true'
|
|
48
|
+
uses: actions/github-script@v7
|
|
49
|
+
with:
|
|
50
|
+
script: |
|
|
51
|
+
const pinned = "${{ steps.check.outputs.pinned }}";
|
|
52
|
+
const live = "${{ steps.check.outputs.live }}";
|
|
53
|
+
const title = "Wolfi base image is out of date";
|
|
54
|
+
const body = [
|
|
55
|
+
"The pinned `cgr.dev/chainguard/wolfi-base:latest` digest is stale.",
|
|
56
|
+
"",
|
|
57
|
+
"| | digest |",
|
|
58
|
+
"|---|---|",
|
|
59
|
+
"| pinned (Dockerfiles) | `" + pinned + "` |",
|
|
60
|
+
"| live `:latest` | `" + live + "` |",
|
|
61
|
+
"",
|
|
62
|
+
"Update the `ARG WOLFI=...@<digest>` line in `Dockerfile`, " +
|
|
63
|
+
"`Dockerfile.hf`, and `Dockerfile.deep` to the live digest " +
|
|
64
|
+
"(`make base-digest` prints it), then rebuild.",
|
|
65
|
+
].join("\n");
|
|
66
|
+
const existing = await github.rest.issues.listForRepo({
|
|
67
|
+
owner: context.repo.owner, repo: context.repo.repo,
|
|
68
|
+
state: "open", labels: "wolfi-base",
|
|
69
|
+
});
|
|
70
|
+
if (existing.data.length) {
|
|
71
|
+
await github.rest.issues.update({
|
|
72
|
+
owner: context.repo.owner, repo: context.repo.repo,
|
|
73
|
+
issue_number: existing.data[0].number, body,
|
|
74
|
+
});
|
|
75
|
+
} else {
|
|
76
|
+
await github.rest.issues.create({
|
|
77
|
+
owner: context.repo.owner, repo: context.repo.repo,
|
|
78
|
+
title, body, labels: ["wolfi-base", "security"],
|
|
79
|
+
});
|
|
80
|
+
}
|
purser-0.1.1/.gitignore
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# --- Python ---
|
|
2
|
+
.venv/
|
|
3
|
+
venv/
|
|
4
|
+
env/
|
|
5
|
+
__pycache__/
|
|
6
|
+
*.pyc
|
|
7
|
+
*.egg
|
|
8
|
+
*.egg-info/
|
|
9
|
+
build/
|
|
10
|
+
dist/
|
|
11
|
+
.ruff_cache/
|
|
12
|
+
uv.lock
|
|
13
|
+
.mypy_cache/
|
|
14
|
+
.pytest_cache/
|
|
15
|
+
.hypothesis/
|
|
16
|
+
.coverage
|
|
17
|
+
coverage.xml
|
|
18
|
+
htmlcov/
|
|
19
|
+
|
|
20
|
+
# --- OS / editors ---
|
|
21
|
+
.DS_Store
|
|
22
|
+
._*
|
|
23
|
+
Thumbs.db
|
|
24
|
+
.idea/
|
|
25
|
+
.vscode/
|
|
26
|
+
*.swp
|
|
27
|
+
*~
|
|
28
|
+
.claude/settings.local.json
|
|
29
|
+
|
|
30
|
+
# --- secrets / local config (never commit) ---
|
|
31
|
+
.env
|
|
32
|
+
.env.*
|
|
33
|
+
!.env.example
|
|
34
|
+
*.key
|
|
35
|
+
*.pem
|
|
36
|
+
*.sig
|
|
37
|
+
trust_store.yaml
|
|
38
|
+
|
|
39
|
+
# --- generated artifacts (reproducible) ---
|
|
40
|
+
sbom/
|
|
41
|
+
*.lock.bak
|
|
42
|
+
|
|
43
|
+
# --- local model store & scan outputs ---
|
|
44
|
+
models/
|
|
45
|
+
*.sarif
|
|
46
|
+
report*.json
|
|
47
|
+
|
|
48
|
+
# --- Helm ---
|
|
49
|
+
deploy/helm/**/charts/
|
|
50
|
+
deploy/helm/**/*.tgz
|
|
51
|
+
Chart.lock
|
|
52
|
+
|
|
53
|
+
# --- internal / not-for-repo docs ---
|
|
54
|
+
gap_analysis.md
|
|
55
|
+
MarketResearch.md
|
|
56
|
+
next-steps.md
|
|
57
|
+
foundation-strategy.md
|