53 lines
3.3 KiB
Markdown
53 lines
3.3 KiB
Markdown
# Startup Pricing Service: secure delivery (SSW 590, Chapter 6)
|
|
|
|
Course starter `Examples/dosSecureDelivery` (Flask + Gunicorn, stateless), delivered by
|
|
Jenkins on a trusted agent, published to the Gitea container registry, and deployed by
|
|
Ansible to two Compose projects on the team Droplet.
|
|
|
|
| Path | Purpose |
|
|
|---|---|
|
|
| `app/` | Application (`app.py`), unit tests, `requirements.in` (starter ranges), `requirements.txt` (exact, hash-locked), `Dockerfile` (base image pinned by digest) |
|
|
| `ansible/` | `deploy.yml` (starter, adapted), `templates/compose.yaml.j2`, `inventory.ini`, `known_hosts` (pinned host key), `requirements.yml` |
|
|
| `ansible.cfg` | Inventory and strict host-key checking |
|
|
| `releases/` | Release records (metadata only, no secrets); `release.example.yml` is the starter template |
|
|
| `ci/` | `write_release.py`, `smoke.sh`, `gitea_status.sh` used by the pipeline |
|
|
| `agent/` | Trusted Jenkins agent image and Compose file (`/opt/startup/delivery-agent`) |
|
|
| `Jenkinsfile` | Delivery pipeline (job `pricing-delivery`) |
|
|
| `RUNBOOK.md` | Release, failed deployment, rollback, cleanup |
|
|
|
|
## Locked build inputs
|
|
|
|
* Base image: `python:3.13-slim@sha256:e48f59cdba69a3cbd9ed2cf0f348d90d45a8d350d98134cf1070bc106ee9ed90`
|
|
(multi-arch index; the Droplet is linux/amd64). Selected 2026-11-12.
|
|
* Python dependencies: `requirements.txt` generated with
|
|
`pip-compile --generate-hashes --strip-extras requirements.in` (pip-tools 7.6.2, Python 3.13):
|
|
Flask 3.1.3, gunicorn 23.0.0, Werkzeug 3.1.9, Jinja2 3.1.6, MarkupSafe 3.0.4,
|
|
itsdangerous 2.2.0, click 8.5.1, blinker 1.9.0, packaging 26.3.
|
|
The Dockerfile installs with `--require-hashes`. Rebuild and rescan after any change.
|
|
* No version is claimed to be vulnerability-free; see the scan reports of each build.
|
|
|
|
## Agent toolchain (rebuilt from `agent/Dockerfile`)
|
|
|
|
`jenkins/inbound-agent:latest-jdk21@sha256:25a3704f…78ab`, Docker CLI 29.8.2 (+ buildx),
|
|
Trivy 0.69.3 (checksum-verified; known-safe release after the March 2026 Trivy
|
|
supply-chain incident, GHSA-69fq-xp46-6x23), ansible-core 2.19.15 with
|
|
community.docker 5.2.2 (venv `/opt/ansible-venv`), pip-audit 2.10.1 (`/opt/pip-audit-venv`).
|
|
|
|
## Security gate policy
|
|
|
|
| Gate | Tool | Blocks when |
|
|
|---|---|---|
|
|
| Unit tests | `python -m unittest` | any test fails |
|
|
| Dependency audit | pip-audit 2.10.1 (`--strict`, hash-locked) | any known vulnerability, or a package cannot be audited |
|
|
| Secret scan | Trivy `fs --scanners secret` (whole repository) | any detected secret |
|
|
| Image scan | Trivy `image --severity HIGH,CRITICAL` | any HIGH/CRITICAL not covered by an unexpired entry in `security/trivyignore.yaml` |
|
|
|
|
A scanner error or an unavailable vulnerability database exits non-zero and fails the build;
|
|
a failed scan is never treated as clean. Fixable findings are fixed (pin the fixed package or
|
|
remove the component) and rebuilt. Findings without a published fix may be accepted only as
|
|
time-limited exceptions in `security/trivyignore.yaml`, each with a statement and an
|
|
`expired_at` date; the gate output lists suppressed findings (`--show-suppressed`), and the
|
|
full all-severity report is archived as `reports/trivy-image-all.json`. False positives are
|
|
handled the same way, with the reason in the statement. Exceptions are reviewed in a pull
|
|
request and are pending instructor acceptance.
|