Assignment 8: audit coverage and release evidence #18

Merged
nkogut merged 3 commits from assignment8/secure-delivery into main 2026-11-07 22:15:36 +00:00
2 changed files with 103 additions and 0 deletions
Showing only changes of commit 35523ccd3c - Show all commits
+42
View File
@@ -0,0 +1,42 @@
# Assignment 8 handoff — 7 November 2026
This is a continuation guide for the team and its Codex session. The assignment is **not complete**. The instructor source is `dosManual-V1.43.pdf`, Chapter 6, and the provided `Examples/dosSecureDelivery` starter. The deliverable is one updated team IT manual PDF plus accessible reviewed source and evidence.
## Read this first: branch and review state
- Repository: https://myfileagent.tech/myfileagent/myfileagent-pipeline
- PR [#17](https://myfileagent.tech/myfileagent/myfileagent-pipeline/pulls/17) was approved by `nkogut` for head `c1cd3ad9af12e11af7c08c398c5fc93649cfd556` and merged to `main` as `6ba31a3b44906b5c19faa7ccba601e69798b142a`. Check the **merge parents**, not the PR's moving head, when reconstructing what was reviewed.
- Commit `88f3bb0d0aeffe3fe122ea3f5f797817e8c5523f` was pushed to `assignment8/secure-delivery` **after** PR #17 merged. It is not in that merge or in main as of this handoff. It fixes dependency-audit coverage and evidence handling. This handoff and the accompanying v2 preview patch are additional branch changes. Open a new PR against main for these changes, run checks against its exact head, and obtain the required independent review; do not treat PR #17's approval as approval of later commits.
- On the Droplet, the v1 worktree is `/home/codex/myfileagent-gitea/assignment8-secure-delivery`. The local v2 preview worktree is `/home/codex/myfileagent-gitea/assignment8-v2-preview`, branch `assignment8/v2-preview`, commit `2147b21640a3a644e9ab156bca9e7b5a82af4011`. That preview has **not** been pushed or reviewed. `v2-preview.patch` alongside this file preserves that commit for a partner who only has Gitea access. Apply it to a new branch based on the final reviewed v1 state, inspect it, and test it; do not include it in the v1 release.
## Verified foundation
- Existing Gitea, Jenkins, Caddy, Prometheus, Grafana, Blackbox Exporter, and Node Exporter were running at the last check. Continue to preserve their configurations and data.
- Jenkins has a dedicated `assignment8-trusted` agent. Its image definition and validated Compose recreation template are in `agent/`. The running container was created separately and has not been recreated with that template. The Docker socket group is currently 987; verify before any recreation. Docker socket access and the `a8deploy` account's passwordless root sudo are effectively host-administrator access. Restrict use to reviewed code and authorized jobs. Agent SSH host key is pinned in `ansible/known_hosts`; inventory uses the private gateway `172.20.0.1`. The gateway can change if the network is recreated: verify before use.
- With explicit team approval, Jenkins stores `assignment8-deploy-ssh` as a **Global** credential for `a8deploy`. Jenkins build [#4](https://ci.myfileagent.tech/job/assignment8-validation/4/console) verified SSH and sudo. Jenkins credentials `assignment8-registry-write` and `assignment8-registry-read` are configured separately; never put secret values in Git, prompts, logs or the manual. The root Docker client authenticated with the read credential in [build #5](https://ci.myfileagent.tech/job/assignment8-validation/5/console). Docker warned the credential is stored unencrypted in `/root/.docker/config.json`; limit access and remove it after assessment. A successful login is not proof of an actual image push or pull.
- `staging.myfileagent.tech` and `app.myfileagent.tech` were configured in DNS and Caddy. Both returned valid TLS and HTTP 502 before application containers existed. Gitea, Jenkins and Grafana HTTPS returned 200 after the proxy reload. The saved previous proxy config is `/home/codex/myfileagent-gitea/Caddyfile.before-assignment8`.
- The v1 app is under `secure-delivery/v1`, with pinned direct/transitive requirements and a pinned Python Alpine base image. Three unit tests passed. A test image passed an isolated health/version/price check and a HIGH/CRITICAL image scan; it used a placeholder source identity and is not a release.
- The supplied v2 starter and the isolated v2 preview each passed three unit tests. No v2 release image exists yet.
## Evidence and limitations
- Jenkins validation [#8](https://ci.myfileagent.tech/job/assignment8-validation/8/console) passed for commit `65e4011`; validation [#9](https://ci.myfileagent.tech/job/assignment8-validation/9/console) passed for `c1cd3ad`, including tests, the then-current dependency audit, secret scan, Ansible syntax, image build and image scan. Gitea reported its own PR check successful for `c1cd3ad`.
- **Dependency audit correction:** the prior resolved pip-audit report listed eight of nine pinned packages and omitted `packaging`. A separate stricter audit using `--disable-pip --no-deps` listed all nine and found no known vulnerabilities on 7 November. Commit `88f3bb0` updates the pipelines to use that mode; it needs review and a complete Jenkins run on the final commit. Findings can change with the database.
- **Artifact caution:** during build #9, a separate direct test wrote `secret-scan-summary.json` into the shared workspace shortly before archiving. That summary is independent test output, not build #9 evidence. Its image scan report and build log are separate. Guard-test #6 also archived stale reports; do not use those as #6 evidence. Guard-test [#7](https://ci.myfileagent.tech/job/assignment8-validation/7/console) blocked the unmerged branch before publication and archived no files.
- A controlled unit-test failure in [test-gate build #1](https://ci.myfileagent.tech/job/assignment8-test-gate-demo/1/console) skipped the following demonstration delivery stage. The test was restored and all three tests passed afterward. A disposable key triggered the secret scanner and blocked [secret-gate build #4](https://ci.myfileagent.tech/job/assignment8-secret-gate-demo/4/console); the fixture was removed. The updated redacted summary was also tested directly with clean input and a disposable-key fixture, but not yet in a full updated pipeline.
- Detailed chronological notes are in `WORK_LOG.md`. Raw scan and exercise evidence is under `/home/codex/myfileagent-gitea/evidence/assignment8` on the Droplet; examine and redact before copying anything into the repository or manual. Do not publish real keys or tokens.
## Continue in this order
1. Fetch `main` and the latest `assignment8/secure-delivery` branch. Review the delta after the PR #17 merge, especially `88f3bb0`, `Jenkinsfile.release.draft`, `Jenkinsfile.security`, `scan-secrets.sh`, the agent configuration and this handoff. Open a new PR for the unmerged fixes; run the updated security pipeline on its exact head and obtain the required independent review. Preserve branch protection.
2. The release pipeline is a **draft**, not an end-to-end verified production pipeline. Review its Groovy, credentials, source/config identity, report capture, restricted `ssw590` approval, idempotence check, registry digest selection and target pull. The source guard intentionally blocks a branch head not already in protected main. Groovy parsing and that guard were tested; later release stages have not been exercised. Configure the release job to use the reviewed main revision only after the changes are approved and merged.
3. Recheck Gitea organization package-write permission for `glovely` and read access for the target with an actual release push and authenticated pull. The registry login worked, the token reported `write:package`, and read-only database inspection showed `glovely` on the organization Owners team; publication itself has not been proven. Build once from the reviewed commit, scan the actual image, publish it, and record the immutable registry digest. Do not substitute a local image ID.
4. Deploy v1 to staging using Ansible and its release record. Verify HTTPS health, version, full baked source commit, and quantity-3 total 30. Repeat the unchanged playbook and capture `changed=0`. After a real restricted human Jenkins approval, promote the **same digest** to production and verify the same behavior. Record actual approver, times, build, source/config commits, scans, URLs and image digest. Never approve the human gate on the user's behalf.
5. After v1 is verified and preserved, create a separately reviewed v2 commit using the preview patch as reference, update `release-intent.json` to v2/36, and run the complete build, scan, staging, approval and production flow. Retain the v1 image and matching configuration.
6. Perform both required exercises: (a) roll healthy production v2 back to v1 image **and matching configuration**, verify v1/30 and measure interruption; (b) staging only, use the instructor's Gunicorn 8001 mismatch while the image healthcheck remains on 8000, show the Jenkins failure, restore the previous reviewed config and verify recovery. Preserve timestamps and evidence; do not stop shared services, delete volumes or claim zero downtime.
7. Add the production health probe to the existing Blackbox/Grafana monitoring, retain the earlier probes and metrics, and correlate actual observations with release and rollback times. Complete the release, failure, rollback and cleanup runbooks; describe single-Droplet and stateful-migration limitations.
8. Update the existing team IT manual (Assignment 7 v1.9.2 baseline) with a chapter titled **Secure Delivery and Rollback**, actual architecture, versions, traceability table, redacted evidence, runbooks, history and AI log. Build and visually verify one final PDF and include grader access instructions. Do not claim work that was not performed.
## Access and handling
The user has repeatedly run `/home/codex/myfileagent-gitea/push-assignment8-private.py` as `codex` to authenticate feature-branch pushes. Do not ask them to paste credentials into chat. Jenkins' existing `assignment8-validation` job should point to `secure-delivery/Jenkinsfile.security`; it was temporarily changed for SSH and guard checks and then restored. Recheck its configuration and exact job revision before relying on a result. Existing users must make the required review and production approval decisions themselves.
+61
View File
@@ -0,0 +1,61 @@
From 2147b21640a3a644e9ab156bca9e7b5a82af4011 Mon Sep 17 00:00:00 2001
From: Codex <codex@localhost>
Date: Sat, 7 Nov 2026 21:29:14 +0000
Subject: [PATCH] Prepare v2 pricing behavior and release intent
---
secure-delivery/release-intent.json | 2 +-
secure-delivery/v1/app.py | 4 ++--
secure-delivery/v1/test_app.py | 6 +++---
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/secure-delivery/release-intent.json b/secure-delivery/release-intent.json
index 1afb9db..910e70c 100644
--- a/secure-delivery/release-intent.json
+++ b/secure-delivery/release-intent.json
@@ -1 +1 @@
-{"version": "v1", "quantity3_total": 30}
+{"version": "v2", "quantity3_total": 36}
diff --git a/secure-delivery/v1/app.py b/secure-delivery/v1/app.py
index 1ea1194..a6dd3f0 100644
--- a/secure-delivery/v1/app.py
+++ b/secure-delivery/v1/app.py
@@ -2,8 +2,8 @@ import os
from flask import Flask, jsonify, request
app = Flask(__name__)
-VERSION = "v1"
-UNIT_PRICE = 10
+VERSION = "v2"
+UNIT_PRICE = 12
COMMIT = os.environ.get("APP_COMMIT", "development")
diff --git a/secure-delivery/v1/test_app.py b/secure-delivery/v1/test_app.py
index 40b4207..669294b 100644
--- a/secure-delivery/v1/test_app.py
+++ b/secure-delivery/v1/test_app.py
@@ -7,17 +7,17 @@ class PricingTests(unittest.TestCase):
self.client = app.test_client()
def test_price(self):
- self.assertEqual(total_price(3), 30)
+ self.assertEqual(total_price(3), 36)
response = self.client.get("/price?quantity=3")
self.assertEqual(response.status_code, 200)
- self.assertEqual(response.json["total"], 30)
+ self.assertEqual(response.json["total"], 36)
def test_invalid_quantity(self):
for value in ["0", "-1", "1001", "abc", "1.5"]:
self.assertEqual(self.client.get("/price?quantity=" + value).status_code, 400)
def test_release_identity(self):
- self.assertEqual(self.client.get("/").json["version"], "v1")
+ self.assertEqual(self.client.get("/").json["version"], "v2")
self.assertEqual(self.client.get("/health").json["status"], "ok")
--
2.43.0