Compare commits

...
Author SHA1 Message Date
nkogut 9e96c83197 Merge branch 'main' into assignment8/secure-delivery
myfileagent-python-ci/pipeline/pr-main This commit looks good
2026-11-07 22:11:07 +00:00
Codex 35523ccd3c Add Assignment 8 continuation handoff and v2 preview
myfileagent-python-ci/pipeline/head This commit looks good
2026-11-07 21:49:23 +00:00
Codex 88f3bb0d0a Audit all pinned dependencies and preserve release evidence
myfileagent-python-ci/pipeline/head This commit looks good
2026-11-07 21:44:33 +00:00
nkogut 6ba31a3b44 Merge pull request 'Assignment 8 secure delivery foundation' (#17) from assignment8/secure-delivery into main
myfileagent-python-ci/pipeline/head This commit looks good
Team manual PDF / manual (push) Successful in 3m36s
Reviewed-on: #17
Reviewed-by: nkogut <nkogut@stevens.edu>
2026-11-07 21:38:39 +00:00
Codex c1cd3ad9af Document reproducible agent and current validation
myfileagent-python-ci/pipeline/pr-main This commit looks good
2026-11-07 21:32:11 +00:00
Codex 65e401172b Harden delivery checks and record test-gate evidence
myfileagent-python-ci/pipeline/pr-main This commit looks good
2026-11-07 21:23:35 +00:00
Codex b8a2529ce9 Record registry verification and protect release evidence
myfileagent-python-ci/pipeline/head This commit looks good
2026-11-04 20:48:46 +00:00
Codex b0e8cead18 Prepare target registry authentication
myfileagent-python-ci/pipeline/head This commit looks good
2026-11-04 20:42:16 +00:00
Codex 2bdb431ef2 Draft reviewed release pipeline and document proxy setup 2026-11-04 20:41:36 +00:00
Codex 4cc9a2c6ac Prepare Jenkins SSH credential verification
myfileagent-python-ci/pipeline/head This commit looks good
2026-11-04 20:23:14 +00:00
11 changed files with 358 additions and 5 deletions
+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.
@@ -0,0 +1,19 @@
pipeline {
agent { label 'assignment8-trusted' }
options { skipDefaultCheckout(); timeout(time: 5, unit: 'MINUTES') }
stages {
stage('Checkout') { steps { checkout scm } }
stage('Authenticate target registry reader') {
steps {
withCredentials([sshUserPrivateKey(credentialsId: 'assignment8-deploy-ssh', keyFileVariable: 'DEPLOY_KEY', usernameVariable: 'DEPLOY_USER'), usernamePassword(credentialsId: 'assignment8-registry-read', usernameVariable: 'REG_USER', passwordVariable: 'REG_TOKEN')]) {
sh '''#!/bin/sh
set +x
set -eu
case "$REG_USER" in *[!a-zA-Z0-9_.-]*|'') echo 'Invalid registry username' >&2; exit 1;; esac
printf '%s' "$REG_TOKEN" | ssh -o BatchMode=yes -o StrictHostKeyChecking=yes -o UserKnownHostsFile="$WORKSPACE/secure-delivery/ansible/known_hosts" -i "$DEPLOY_KEY" "$DEPLOY_USER@172.20.0.1" "sudo -n docker login myfileagent.tech --username $REG_USER --password-stdin"
'''
}
}
}
}
}
+119
View File
@@ -0,0 +1,119 @@
pipeline {
agent { label 'assignment8-trusted' }
options { disableConcurrentBuilds(); skipDefaultCheckout(); timeout(time: 45, unit: 'MINUTES'); timestamps() }
environment { IMAGE_REPO = 'myfileagent.tech/myfileagent/pricing' }
stages {
stage('Checkout reviewed source') {
steps {
deleteDir()
checkout scm
sh '''set -eu
# Only source already present in protected main can be released.
git fetch origin main
git merge-base --is-ancestor HEAD origin/main
mkdir -p reports releases/generated
'''
script {
env.SOURCE_COMMIT = sh(script: 'git rev-parse HEAD', returnStdout: true).trim()
env.RELEASE_VERSION = sh(script: "python3 -c 'import json; print(json.load(open(\"secure-delivery/release-intent.json\"))[\"version\"])'", returnStdout: true).trim()
if (!(env.RELEASE_VERSION in ['v1', 'v2'])) { error('Unknown release version') }
env.EXPECTED_TOTAL = env.RELEASE_VERSION == 'v1' ? '30' : '36'
def configured = sh(script: "python3 -c 'import json; print(json.load(open(\"secure-delivery/release-intent.json\"))[\"quantity3_total\"])'", returnStdout: true).trim()
if (configured != env.EXPECTED_TOTAL) { error('Release intent total does not match the version') }
}
}
}
stage('Tests and dependency audit') {
steps { dir('secure-delivery/v1') { sh '''set -eu
python3 -m venv .test-venv
.test-venv/bin/pip install -r requirements.txt pip-audit==2.10.1
.test-venv/bin/python -m unittest -v
.test-venv/bin/pip-audit --disable-pip --no-deps -r requirements.txt -f json -o "$WORKSPACE/reports/dependency-audit.json"
''' } }
}
stage('Repository secret scan') { steps { sh 'sh secure-delivery/scan-secrets.sh' } }
stage('Ansible syntax') { steps { dir('secure-delivery') { sh 'ansible-playbook -i ansible/inventory.ini ansible/deploy.yml --syntax-check' } } }
stage('Build once') { steps { sh 'docker build --build-arg APP_COMMIT="$SOURCE_COMMIT" -t "$IMAGE_REPO:$SOURCE_COMMIT" secure-delivery/v1' } }
stage('Image security scan') {
steps { sh '''set -eu
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock -v /home/codex/myfileagent-gitea/evidence/assignment8/trivy-cache:/root/.cache/ aquasec/trivy@sha256:1c78ed1ef824ab8bb05b04359d186e4c1229d0b3e67005faacb54a7d71974f73 image --quiet --scanners vuln --severity HIGH,CRITICAL --exit-code 1 --format json "$IMAGE_REPO:$SOURCE_COMMIT" > reports/image-scan.json
''' }
}
stage('Publish immutable image') {
steps {
withCredentials([usernamePassword(credentialsId: 'assignment8-registry-write', usernameVariable: 'REG_USER', passwordVariable: 'REG_TOKEN')]) {
sh '''#!/bin/sh
set +x
set -eu
export DOCKER_CONFIG=$(mktemp -d)
trap 'rm -rf "$DOCKER_CONFIG"' EXIT
printf '%s' "$REG_TOKEN" | docker login myfileagent.tech --username "$REG_USER" --password-stdin
docker push "$IMAGE_REPO:$SOURCE_COMMIT"
docker pull "$IMAGE_REPO:$SOURCE_COMMIT"
docker image inspect "$IMAGE_REPO:$SOURCE_COMMIT" --format '{{index .RepoDigests 0}}' > reports/image-digest.txt
'''
}
script {
env.RELEASE_IMAGE = readFile('reports/image-digest.txt').trim()
if (!(env.RELEASE_IMAGE ==~ /myfileagent\.tech\/myfileagent\/pricing@sha256:[0-9a-f]{64}/)) { error('Registry digest is missing or unexpected') }
}
}
}
stage('Pull published digest on target') {
steps {
withCredentials([sshUserPrivateKey(credentialsId: 'assignment8-deploy-ssh', keyFileVariable: 'DEPLOY_KEY', usernameVariable: 'DEPLOY_USER')]) {
sh '''#!/bin/sh
set +x
set -eu
ssh -o BatchMode=yes -o StrictHostKeyChecking=yes -o UserKnownHostsFile="$WORKSPACE/secure-delivery/ansible/known_hosts" -i "$DEPLOY_KEY" "$DEPLOY_USER@172.20.0.1" sudo -n docker pull "$RELEASE_IMAGE" > reports/target-pull.txt
cat reports/target-pull.txt
'''
}
}
}
stage('Deploy staging') {
steps {
script { writeFile file: "releases/generated/${env.RELEASE_VERSION}-staging.yml", text: "target_env: staging\nrelease_image: ${env.RELEASE_IMAGE}\nexpected_version: ${env.RELEASE_VERSION}\nexpected_commit: ${env.SOURCE_COMMIT}\nconfiguration_commit: ${env.SOURCE_COMMIT}\nbuild_url: ${env.BUILD_URL}\nexpected_total: ${env.EXPECTED_TOTAL}\npublic_url: https://staging.myfileagent.tech\nproxy_network: myfileagent-gitea_gitea-private\n" }
withCredentials([sshUserPrivateKey(credentialsId: 'assignment8-deploy-ssh', keyFileVariable: 'DEPLOY_KEY')]) {
sh '''set +x
export ANSIBLE_SSH_ARGS="-o StrictHostKeyChecking=yes -o UserKnownHostsFile=$WORKSPACE/secure-delivery/ansible/known_hosts"
ansible-playbook -i secure-delivery/ansible/inventory.ini secure-delivery/ansible/deploy.yml --private-key "$DEPLOY_KEY" -e @releases/generated/$RELEASE_VERSION-staging.yml
'''
}
}
}
stage('Confirm staging idempotence') {
steps {
withCredentials([sshUserPrivateKey(credentialsId: 'assignment8-deploy-ssh', keyFileVariable: 'DEPLOY_KEY')]) {
sh '''set +x
set -eu
export ANSIBLE_SSH_ARGS="-o StrictHostKeyChecking=yes -o UserKnownHostsFile=$WORKSPACE/secure-delivery/ansible/known_hosts"
ansible-playbook -i secure-delivery/ansible/inventory.ini secure-delivery/ansible/deploy.yml --private-key "$DEPLOY_KEY" -e @releases/generated/$RELEASE_VERSION-staging.yml > reports/staging-second-run.txt
cat reports/staging-second-run.txt
grep -Eq 'startup[[:space:]]*:.*changed=0[[:space:]]+unreachable=0[[:space:]]+failed=0' reports/staging-second-run.txt
'''
}
}
}
stage('Production approval') {
steps {
script {
def approver = timeout(time: 30, unit: 'MINUTES') { input message: "Source/configuration: ${env.SOURCE_COMMIT}\nImage: ${env.RELEASE_IMAGE}\nSecurity gates: passed\nStaging checks and unchanged rerun: passed\nEvidence: ${env.BUILD_URL}\nApprove production promotion?", ok: 'Promote', submitter: 'ssw590', submitterParameter: 'APPROVER' }
writeFile file: 'reports/approval.txt', text: "Approver: ${approver}\nDecision: approved\nTime (UTC): ${sh(script: 'date -u +%FT%TZ', returnStdout: true).trim()}\nBuild: ${env.BUILD_URL}\nSource and configuration commit: ${env.SOURCE_COMMIT}\nImage: ${env.RELEASE_IMAGE}\nVersion: ${env.RELEASE_VERSION}\nExpected total for 3: ${env.EXPECTED_TOTAL}\nStaging and scans: passed\n"
}
}
}
stage('Deploy production') {
steps {
script { writeFile file: "releases/generated/${env.RELEASE_VERSION}-production.yml", text: "target_env: production\nrelease_image: ${env.RELEASE_IMAGE}\nexpected_version: ${env.RELEASE_VERSION}\nexpected_commit: ${env.SOURCE_COMMIT}\nconfiguration_commit: ${env.SOURCE_COMMIT}\nbuild_url: ${env.BUILD_URL}\nexpected_total: ${env.EXPECTED_TOTAL}\npublic_url: https://app.myfileagent.tech\nproxy_network: myfileagent-gitea_gitea-private\n" }
withCredentials([sshUserPrivateKey(credentialsId: 'assignment8-deploy-ssh', keyFileVariable: 'DEPLOY_KEY')]) {
sh '''set +x
export ANSIBLE_SSH_ARGS="-o StrictHostKeyChecking=yes -o UserKnownHostsFile=$WORKSPACE/secure-delivery/ansible/known_hosts"
ansible-playbook -i secure-delivery/ansible/inventory.ini secure-delivery/ansible/deploy.yml --private-key "$DEPLOY_KEY" -e @releases/generated/$RELEASE_VERSION-production.yml
'''
}
}
}
}
post { always { archiveArtifacts artifacts: 'reports/*,releases/generated/*', allowEmptyArchive: true } }
}
+2 -2
View File
@@ -2,13 +2,13 @@ pipeline {
agent { label 'assignment8-trusted' } agent { label 'assignment8-trusted' }
options { disableConcurrentBuilds(); timeout(time: 20, unit: 'MINUTES'); timestamps(); skipDefaultCheckout() } options { disableConcurrentBuilds(); timeout(time: 20, unit: 'MINUTES'); timestamps(); skipDefaultCheckout() }
stages { stages {
stage('Checkout') { steps { checkout scm } } stage('Checkout') { steps { deleteDir(); checkout scm; sh 'mkdir -p reports' } }
stage('Unit tests and dependency audit') { stage('Unit tests and dependency audit') {
steps { dir('secure-delivery/v1') { sh '''set -eu steps { dir('secure-delivery/v1') { sh '''set -eu
python3 -m venv .test-venv python3 -m venv .test-venv
.test-venv/bin/pip install -r requirements.txt pip-audit==2.10.1 .test-venv/bin/pip install -r requirements.txt pip-audit==2.10.1
.test-venv/bin/python -m unittest -v .test-venv/bin/python -m unittest -v
.test-venv/bin/pip-audit -r requirements.txt .test-venv/bin/pip-audit --disable-pip --no-deps -r requirements.txt -f json -o "$WORKSPACE/reports/dependency-audit.json"
''' } } ''' } }
} }
stage('Secret scan') { steps { sh 'sh secure-delivery/scan-secrets.sh' } } stage('Secret scan') { steps { sh 'sh secure-delivery/scan-secrets.sh' } }
+17
View File
@@ -0,0 +1,17 @@
pipeline {
agent { label 'assignment8-trusted' }
options { timeout(time: 5, unit: 'MINUTES'); skipDefaultCheckout() }
stages {
stage('Checkout') { steps { checkout scm } }
stage('Verify deployment connection') {
steps {
withCredentials([sshUserPrivateKey(credentialsId: 'assignment8-deploy-ssh', keyFileVariable: 'DEPLOY_KEY', usernameVariable: 'DEPLOY_USER')]) {
sh '''set +x
set -eu
ssh -o BatchMode=yes -o StrictHostKeyChecking=yes -o UserKnownHostsFile="$WORKSPACE/secure-delivery/ansible/known_hosts" -i "$DEPLOY_KEY" "$DEPLOY_USER@172.20.0.1" 'id; sudo -n id'
'''
}
}
}
}
}
@@ -0,0 +1,26 @@
pipeline {
agent { label 'assignment8-trusted' }
options { timeout(time: 10, unit: 'MINUTES') }
stages {
stage('Checkout v1') {
steps { git branch: 'assignment8/secure-delivery', url: 'https://myfileagent.tech/myfileagent/myfileagent-pipeline.git' }
}
stage('Controlled failing test') {
steps {
dir('secure-delivery/v1') {
sh '''#!/bin/sh
set -eu
python3 -m venv .test-venv
.test-venv/bin/pip install -r requirements.txt
trap 'git checkout -- test_app.py' EXIT
python3 -c 'from pathlib import Path; p=Path("test_app.py"); s=p.read_text(); old="self.assertEqual(total_price(3), 30)"; assert old in s; p.write_text(s.replace(old,"self.assertEqual(total_price(3), 31)",1))'
.test-venv/bin/python -m unittest -v
'''
}
}
}
stage('Delivery would proceed') {
steps { echo 'This stage must be skipped when tests fail.' }
}
}
}
+44
View File
@@ -52,3 +52,47 @@
## Deployment access and DNS verification ## Deployment access and DNS verification
- On 2026-11-04, a8deploy account existed. Both staging.myfileagent.tech and app.myfileagent.tech resolved to 142.93.193.110 via Droplet resolver. From assignment8-trusted, SSH using the dedicated private key and pinned host key returned uid 1001; sudo -n id returned root. The test key was removed from the agent after verification. Passwordless sudo grants host-administrator access. No Jenkins SSH credential configured yet. - On 2026-11-04, a8deploy account existed. Both staging.myfileagent.tech and app.myfileagent.tech resolved to 142.93.193.110 via Droplet resolver. From assignment8-trusted, SSH using the dedicated private key and pinned host key returned uid 1001; sudo -n id returned root. The test key was removed from the agent after verification. Passwordless sudo grants host-administrator access. No Jenkins SSH credential configured yet.
- Prepared Caddy route and v1 release-record templates; neither route nor application deployment has been applied. Registry endpoint requires authentication; no registry package-write or package-read credential has been verified. - Prepared Caddy route and v1 release-record templates; neither route nor application deployment has been applied. Registry endpoint requires authentication; no registry package-write or package-read credential has been verified.
## Jenkins deployment credential
- With explicit team approval for Global scope, created Jenkins credential assignment8-deploy-ssh for a8deploy. It permits host-administrator access through the deployment account. A temporary key copy on the controller was removed after credential creation; credential binding still needs a Jenkins job verification.
- Jenkins assignment8-validation #4 successfully bound the approved assignment8-deploy-ssh credential on assignment8-trusted, verified pinned SSH host key, connected as a8deploy, and confirmed noninteractive root sudo. Evidence: https://ci.myfileagent.tech/job/assignment8-validation/4/console . Job currently points to Jenkinsfile.ssh-check; restore security validation before further security runs. Registry endpoint requires authentication and no Jenkins package-specific credential was found.
## Registry authentication
- Jenkins assignment8-registry-check #1 authenticated to myfileagent.tech using assignment8-registry-write, with a temporary Docker config removed at job exit. Evidence: https://ci.myfileagent.tech/job/assignment8-registry-check/1/console . Login alone does not prove permission to publish to the myfileagent organization or target-host pull access.
- Restored assignment8-validation job configuration to Jenkinsfile.security after SSH check. Registry login #1 succeeded using a temporary Docker config, which the job removed. The glovely credential can authenticate, but organization package write and target-host read remain unverified.
## Proxy preparation
- Validated and reloaded existing Caddy configuration with staging.myfileagent.tech -> pricing-staging:8000 and app.myfileagent.tech -> pricing-production:8000. Saved previous configuration at /home/codex/myfileagent-gitea/Caddyfile.before-assignment8. Gitea, Jenkins and Grafana HTTPS login routes returned 200 with certificate validation. New staging and app HTTPS endpoints returned 502 with certificate validation successful, expected before app containers exist. One initial staging DNS lookup timed out; retry reached HTTPS.
- Jenkinsfile.release.draft is untested and not enabled. It requires reviewed source on protected main, package publication rights, target registry authentication, scan and deployment validation before operational use.
- Prepared Jenkinsfile.registry-read-setup to configure root Docker registry authentication using a separate read-only Jenkins credential over pinned SSH. Draft only; not run. Root Docker configuration will hold authentication material and must be protected and removed after assessment.
## Registry reader and release guard
- Jenkins assignment8-validation #5 authenticated the Droplet root Docker client with assignment8-registry-read; login succeeded. Docker warned that its root configuration stores credentials without encryption; restrict access and remove after assessment. Actual image pull has not yet been proven. Evidence: https://ci.myfileagent.tech/job/assignment8-validation/5/console .
- Draft release pipeline parsed and Jenkins build #6 stopped at the protected-main ancestry guard for the unmerged feature commit; image publication and deployment stages were skipped. Evidence: https://ci.myfileagent.tech/job/assignment8-validation/6/console . Added a workspace clean before checkout to prevent old reports being archived in future runs; that revision remains untested.
- Build #6 used a reused workspace and its post step archived pre-existing reports; those artifacts are stale and must not be presented as build #6 scan evidence. The draft now deletes the workspace before checkout to prevent recurrence; that correction is not yet verified.
## 2026-11-07 release draft review
- Verified branch b8a2529 on Gitea, shared services healthy and pricing routes still return 502 while application is absent. Jenkins guard build #7 rejected unmerged source before image publication; no files were archived. https://ci.myfileagent.tech/job/assignment8-validation/7/console
- Extended the local release draft to explicitly pull the published digest on the target and read a reviewed version/expected-total intent for v1 and v2. Jenkins Groovy 2.4 parser accepted syntax only; stages after the source guard, registry publication, promotion, and recovery remain untested. The v2 source is not yet applied.
- Hardened the secret scan to fail if the source archive fails, then directly tested it on the trusted agent: zero findings and exit 0. No claim is made about a new Jenkins pipeline run.
- Registry permission-only check #4 returned token scope write:package; this does not prove glovely can publish to the organization. https://ci.myfileagent.tech/job/assignment8-registry-check/4/console
- Jenkins assignment8-test-gate-demo #1 deliberately changed one pricing assertion in its own workspace; the test failed (30 versus 31), and its following demonstration delivery stage was skipped. The trap restored the test, git diff confirmed no test change, and all three tests subsequently passed directly on the agent. https://ci.myfileagent.tech/job/assignment8-test-gate-demo/1/console
- Supplied v2 starter was tested separately on the trusted agent: all three tests passed. It has not been applied to the reviewed v1 source, committed as v2, built, published, or deployed.
- Prepared reproducible agent Compose configuration and validated it with docker compose config; it documents the currently used Docker socket group and private network but has not replaced the running container.
- Prepared isolated v2 preview commit 2147b21 on local branch assignment8/v2-preview based on the v1 feature branch. It changes the application/tests and release intent; all three tests passed on the trusted agent. It is not yet reviewed, published, built as a release or deployed, and must be based on the final reviewed v1 state before promotion.
- Jenkins security validation #8 passed on Gitea commit 65e401172b0e4ec40116df0d07876484020ce454, including three unit tests, dependency audit, repository secret scan, Ansible syntax, image build and HIGH/CRITICAL image scan. The scan report was archived: https://ci.myfileagent.tech/job/assignment8-validation/8/console . This is validation of that commit, not an approved release.
- Agent Compose draft was checked against the running image, socket group, memory and restart policy and passed docker compose config. It has not been used to recreate the agent.
## PR-head validation and report corrections
- PR #17 was checked at c1cd3ad9af12e11af7c08c398c5fc93649cfd556; Gitea reported its existing PR Jenkins check successful. Jenkins assignment8-validation #9 ran the separate security pipeline on that head.
- During #9, a separate direct test of the revised secret-scan summary wrote a summary file into the shared validation workspace shortly before artifact archiving. That summary is independent test output, not generated by build #9, and must not be presented as #9 evidence. The build log and its own image-scan report remain distinct. Future validation now starts with a clean workspace; the updated pipeline and scan summary remain unvalidated in a full Jenkins run.
- Follow-up audit review found the prior pip-audit resolved report listed eight of nine pinned packages and omitted packaging==26.3; earlier green dependency-audit results should not be characterized as covering every pinned input. Tested pip-audit --disable-pip --no-deps against the exact pinned requirements: all nine listed, zero known vulnerabilities on 2026-11-07. Updated local security and release pipeline drafts to use this mode; the updated Jenkins pipeline has not yet been run.
- Revised secret scanner produces a redacted JSON summary and independently detected one disposable key with exit 1; its clean-source test reported zero findings. Both revised Jenkinsfiles passed Groovy parsing, but parsing alone does not establish end-to-end behavior.
- Read-only inspection of Gitea organization membership showed glovely in the myfileagent Owners team. Together with the token scope check this supports, but does not prove, package publication access; an actual registry push is still required.
+21
View File
@@ -0,0 +1,21 @@
# Run only after reviewing host paths, Docker socket group and privileges.
services:
assignment8-agent:
image: assignment8-jenkins-agent:2
build: .
container_name: assignment8-jenkins-agent
restart: unless-stopped
mem_limit: 256m
group_add:
- "987" # Current Docker socket group; verify on the target host.
networks:
- private
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /home/codex/myfileagent-gitea/secrets/assignment8-agent-secret:/run/secrets/agent-secret:ro
entrypoint: ["java"]
command: ["-jar", "/usr/share/jenkins/agent.jar", "-url", "http://myfileagent-jenkins:8080/", "-webSocket", "-secret", "@/run/secrets/agent-secret", "-name", "assignment8-trusted", "-workDir", "/home/jenkins/agent"]
networks:
private:
external: true
name: myfileagent-gitea_gitea-private
+1
View File
@@ -0,0 +1 @@
{"version": "v1", "quantity3_total": 30}
+6 -3
View File
@@ -1,13 +1,16 @@
#!/bin/sh #!/bin/sh
set -eu set -eu
scanner="a8-secret-${BUILD_NUMBER}" scanner="a8-secret-${BUILD_NUMBER}"
trap 'docker rm -f "$scanner" >/dev/null 2>&1 || true; rm -f secret-report.json' EXIT archive=$(mktemp)
trap 'docker rm -f "$scanner" >/dev/null 2>&1 || true; rm -f secret-report.json "$archive"' EXIT
docker create --name "$scanner" aquasec/trivy@sha256:1c78ed1ef824ab8bb05b04359d186e4c1229d0b3e67005faacb54a7d71974f73 fs --quiet --scanners secret --exit-code 1 --format json /repo >/dev/null docker create --name "$scanner" aquasec/trivy@sha256:1c78ed1ef824ab8bb05b04359d186e4c1229d0b3e67005faacb54a7d71974f73 fs --quiet --scanners secret --exit-code 1 --format json /repo >/dev/null
tar --exclude=./.git --exclude=./secure-delivery/v1/.test-venv --exclude='*/__pycache__' --exclude=./reports --transform='s,^\.,repo,' -cf - . | docker cp - "$scanner":/ tar --exclude=./.git --exclude=./secure-delivery/v1/.test-venv --exclude='*/__pycache__' --exclude=./reports --transform='s,^\.,repo,' -cf "$archive" .
docker cp - "$scanner":/ < "$archive"
set +e set +e
docker start -a "$scanner" > secret-report.json docker start -a "$scanner" > secret-report.json
result=$? result=$?
set -e set -e
python3 -c 'import json; p=json.load(open("secret-report.json")); print("Secret findings:",sum(len(r.get("Secrets",[])) for r in p.get("Results",[])))' mkdir -p reports
SCAN_EXIT="$result" python3 -c 'import datetime,json,os; p=json.load(open("secret-report.json")); n=sum(len(r.get("Secrets",[])) for r in p.get("Results",[])); summary={"scanner":"Trivy 0.69.1", "scope":"checked-out repository excluding Git metadata, temporary test environment and generated reports", "findings":n, "exit_code":int(os.environ["SCAN_EXIT"]), "timestamp_utc":datetime.datetime.now(datetime.timezone.utc).isoformat()}; json.dump(summary,open("reports/secret-scan-summary.json","w"),indent=2); print("Secret findings:",n)'
echo "Secret scanner exit status: $result" echo "Secret scanner exit status: $result"
exit "$result" exit "$result"
+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