# Chapter 6 — Secure Delivery Security Policy ## Purpose This policy defines the security requirements for the Startup Pricing Service CI/CD pipeline. The pipeline must fail closed when a required security check fails, cannot execute, or produces an invalid result. ## Trusted Execution - Pull requests and feature branches may run tests and security checks. - Untrusted builds must not receive deployment or registry-write credentials. - Only reviewed changes on protected main may enter the release pipeline. - Privileged deployment stages must run on an approved trusted Jenkins agent. - Production deployment requires an authorized human approval with a timeout. ## Dependency Scanning - Scan resolved Python dependencies before release. - Record the scanner name, version, vulnerability database information, execution time, report, and exit status. - Block releases containing unapproved high or critical vulnerabilities. - Scanner failures or unavailable vulnerability data must block release. - Any exception requires documented instructor approval, scope, justification, and expiration. ## Secret Scanning - Scan application source and relevant repository content for secrets. - Block releases when supported secret-detection rules identify credentials. - Use only synthetic, nonfunctional test fixtures for blocked-gate evidence. - Never commit real passwords, API tokens, private keys, or SSH credentials. ## Container Image Scanning - Scan the exact image that will be published and deployed. - Block unapproved high or critical vulnerabilities. - Record the image reference, scanner version, database information, timestamp, results, and exit status. - Do not bypass failed scans to produce a successful build. ## Registry and Deployment Credentials - Store credentials in Jenkins credentials, not in Git. - Use docker login with --password-stdin. - Separate registry-write and registry-read permissions. - Verify and pin the deployment server's SSH host key. - Restrict deployment credentials to authorized trusted jobs. ## Release Integrity - Record the source commit and immutable image repository digest. - Deploy the same approved digest to staging and production. - Do not rebuild the image between environments. - Verify application version, source commit, health, and pricing over HTTPS. ## Required Evidence Sergio must capture: 1. Successful dependency, secret, and image scan results. 2. A blocked pipeline caused by a safe synthetic test fixture. 3. Successful pipeline execution after removing the fixture. 4. Scanner versions, database details, timestamps, and exit codes. 5. Jenkins credential and approval configuration without exposing secrets. 6. The immutable image digest used for staging and production. ## Status Policy prepared. Enforcement and validation are pending implementation and verification in Jenkins.