Complete Lab 9: Trivy, ZAP, and QuickNotes hardening#1401
Open
smairon wants to merge 8 commits into
Open
Conversation
Signed-off-by: smairon <man@smairon.ru>
Signed-off-by: man@smairon.ru <man@smairon.ru>
Signed-off-by: man@smairon.ru <man@smairon.ru>
Signed-off-by: man@smairon.ru <man@smairon.ru>
Signed-off-by: man@smairon.ru <man@smairon.ru>
Signed-off-by: man@smairon.ru <man@smairon.ru>
Signed-off-by: man@smairon.ru <man@smairon.ru>
Signed-off-by: man@smairon.ru <man@smairon.ru>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Goal
Complete Lab 9 for QuickNotes: run Trivy image/filesystem/config scans plus CycloneDX SBOM generation, run OWASP ZAP baseline against the running app, triage the findings, and fix at least one real finding in code.
Changes
Run pinned Trivy
image,fs, andconfigscans against QuickNotes and the repo, generate a CycloneDX SBOM, save all raw artifacts undersubmissions/lab9-artifacts/, and document per-finding triage plus design answers insubmissions/lab9.md.Run pinned ZAP baseline before and after the fix, save HTML/JSON/Markdown/text artifacts, triage the actual alerts, and document the before/after evidence in
submissions/lab9.md.Add router-level middleware in
app/handlers.gothat applies security and cache-control headers to all responses, including404s, and add tests inapp/handlers_test.gothat fail if the middleware is removed.Testing
go test ./...docker build -t quicknotes:lab6 ./appdocker run --rm -v /var/run/docker.sock:/var/run/docker.sock -v "$PWD:/work" -v "$HOME/.cache/trivy:/root/.cache" aquasec/trivy:0.59.1 image --severity HIGH,CRITICAL --format table -o /work/submissions/lab9-artifacts/trivy-image.txt quicknotes:lab6docker run --rm -v "$PWD:/work" -v "$HOME/.cache/trivy:/root/.cache" aquasec/trivy:0.59.1 fs --severity HIGH,CRITICAL --format table -o /work/submissions/lab9-artifacts/trivy-fs.txt /workdocker run --rm -v "$PWD:/work" -v "$HOME/.cache/trivy:/root/.cache" aquasec/trivy:0.59.1 config --skip-check-update --format table -o /work/submissions/lab9-artifacts/trivy-config.txt /workdocker run --rm -v /var/run/docker.sock:/var/run/docker.sock -v "$PWD:/work" -v "$HOME/.cache/trivy:/root/.cache" aquasec/trivy:0.59.1 image --format cyclonedx -o /work/submissions/lab9-artifacts/quicknotes-lab6.cdx.json quicknotes:lab6docker compose up -d --build quicknotesdocker run --rm --network devops-intro_default -v "$PWD:/zap/wrk:rw" ghcr.io/zaproxy/zaproxy:2.16.1 zap-baseline.py -t http://quicknotes:8080 -r submissions/lab9-artifacts/zap-pre.html -J submissions/lab9-artifacts/zap-pre.json -w submissions/lab9-artifacts/zap-pre.mdcurl -sSI http://localhost:8080/healthandcurl -sSI http://localhost:8080/to verify the middleware headers after rebuilddocker run --rm --network devops-intro_default -v "$PWD:/zap/wrk:rw" ghcr.io/zaproxy/zaproxy:2.16.1 zap-baseline.py -t http://quicknotes:8080 -r submissions/lab9-artifacts/zap-post.html -J submissions/lab9-artifacts/zap-post.json -w submissions/lab9-artifacts/zap-post.mdChecklist
git log --show-signature)submissions/lab9.mdupdated