Audit all pinned dependencies and preserve release evidence
myfileagent-python-ci/pipeline/head This commit looks good
myfileagent-python-ci/pipeline/head This commit looks good
This commit is contained in:
@@ -28,7 +28,7 @@ mkdir -p reports releases/generated
|
|||||||
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('Repository secret scan') { steps { sh 'sh secure-delivery/scan-secrets.sh' } }
|
stage('Repository secret scan') { steps { sh 'sh secure-delivery/scan-secrets.sh' } }
|
||||||
@@ -73,7 +73,7 @@ cat reports/target-pull.txt
|
|||||||
}
|
}
|
||||||
stage('Deploy staging') {
|
stage('Deploy staging') {
|
||||||
steps {
|
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}\nexpected_total: ${env.EXPECTED_TOTAL}\npublic_url: https://staging.myfileagent.tech\nproxy_network: myfileagent-gitea_gitea-private\n" }
|
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')]) {
|
withCredentials([sshUserPrivateKey(credentialsId: 'assignment8-deploy-ssh', keyFileVariable: 'DEPLOY_KEY')]) {
|
||||||
sh '''set +x
|
sh '''set +x
|
||||||
export ANSIBLE_SSH_ARGS="-o StrictHostKeyChecking=yes -o UserKnownHostsFile=$WORKSPACE/secure-delivery/ansible/known_hosts"
|
export ANSIBLE_SSH_ARGS="-o StrictHostKeyChecking=yes -o UserKnownHostsFile=$WORKSPACE/secure-delivery/ansible/known_hosts"
|
||||||
@@ -98,14 +98,14 @@ grep -Eq 'startup[[:space:]]*:.*changed=0[[:space:]]+unreachable=0[[:space:]]+fa
|
|||||||
stage('Production approval') {
|
stage('Production approval') {
|
||||||
steps {
|
steps {
|
||||||
script {
|
script {
|
||||||
def approver = timeout(time: 30, unit: 'MINUTES') { input message: "Promote ${env.SOURCE_COMMIT} / ${env.RELEASE_IMAGE} after successful staging and scans?", ok: 'Promote', submitter: 'ssw590', submitterParameter: 'APPROVER' }
|
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}\nBuild: ${env.BUILD_URL}\nSource: ${env.SOURCE_COMMIT}\nImage: ${env.RELEASE_IMAGE}\n"
|
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') {
|
stage('Deploy production') {
|
||||||
steps {
|
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}\nexpected_total: ${env.EXPECTED_TOTAL}\npublic_url: https://app.myfileagent.tech\nproxy_network: myfileagent-gitea_gitea-private\n" }
|
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')]) {
|
withCredentials([sshUserPrivateKey(credentialsId: 'assignment8-deploy-ssh', keyFileVariable: 'DEPLOY_KEY')]) {
|
||||||
sh '''set +x
|
sh '''set +x
|
||||||
export ANSIBLE_SSH_ARGS="-o StrictHostKeyChecking=yes -o UserKnownHostsFile=$WORKSPACE/secure-delivery/ansible/known_hosts"
|
export ANSIBLE_SSH_ARGS="-o StrictHostKeyChecking=yes -o UserKnownHostsFile=$WORKSPACE/secure-delivery/ansible/known_hosts"
|
||||||
|
|||||||
@@ -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' } }
|
||||||
|
|||||||
@@ -88,3 +88,11 @@
|
|||||||
|
|
||||||
- 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.
|
- 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.
|
- 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.
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ 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"
|
||||||
|
|||||||
Reference in New Issue
Block a user