Skip to content

Commit ec88152

Browse files
committed
Fix Trivy action ref and tighten CI security documentation.
Use aquasecurity/trivy-action v0.36.0 (SHA-pinned); tags require a v prefix. Clarify docs and workflow comments without internal tracker refs.
1 parent 3ad97a2 commit ec88152

2 files changed

Lines changed: 35 additions & 38 deletions

File tree

.github/workflows/ci.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# CI for helm-watch.
2-
# Security scans (gitleaks, Semgrep, Trivy image) run in report-only mode until ARM-6 enables gates.
3-
# See docs/ci-security.md.
2+
# Optional security jobs (gitleaks, Semgrep, Trivy) run in report-only mode; see docs/ci-security.md.
43

54
name: CI
65

@@ -101,7 +100,7 @@ jobs:
101100
path: dist/helm-watch-image.tar
102101

103102
security-static:
104-
name: Security — secrets & SAST (report-only)
103+
name: Security — secrets (report-only)
105104
runs-on: ubuntu-latest
106105

107106
steps:
@@ -147,15 +146,15 @@ jobs:
147146
run: docker load -i dist/helm-watch-image.tar
148147

149148
- name: Trivy image scan (table)
150-
uses: aquasecurity/trivy-action@0.28.0
149+
uses: aquasecurity/trivy-action@a9c7b0f06e461e9d4b4d1711f154ee024b8d7ab8 # v0.36.0
151150
with:
152151
image-ref: helm-watch:ci
153152
format: table
154153
severity: CRITICAL,HIGH,MEDIUM,LOW,UNKNOWN
155154
exit-code: "0"
156155

157156
- name: Trivy image scan (SARIF report)
158-
uses: aquasecurity/trivy-action@0.28.0
157+
uses: aquasecurity/trivy-action@a9c7b0f06e461e9d4b4d1711f154ee024b8d7ab8 # v0.36.0
159158
with:
160159
image-ref: helm-watch:ci
161160
format: sarif

docs/ci-security.md

Lines changed: 31 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,56 @@
11
# CI security scans (report-only)
22

3-
Helm Watch PR/push CI includes three **report-only** security jobs (Linear [ARM-5](https://linear.app/armanfeyzi/issue/ARM-5)). They run on every workflow but do **not** fail the build yet. Follow-up [ARM-6](https://linear.app/armanfeyzi/issue/ARM-6) turns on hard gates for secrets and critical image CVEs.
3+
Pull request and push workflows include optional security jobs that **report findings without failing CI**. This lets maintainers review noise levels before enabling enforcement gates.
44

55
Workflow: [`.github/workflows/ci.yml`](../.github/workflows/ci.yml)
66

77
## Jobs overview
88

99
| Job | Tools | What it checks |
1010
|-----|-------|----------------|
11-
| `security-static` | gitleaks | Git secrets |
12-
| `semgrep` | Semgrep (`semgrep/semgrep` image) | Go/Kubernetes SAST rules |
13-
| `container-security` | Trivy | CVEs and misconfig in the `helm-watch:ci` image |
14-
| `test-and-build` | gosec (existing) | Go-specific high-confidence SAST |
11+
| `security-static` | gitleaks | Secrets in git history |
12+
| `semgrep` | Semgrep (`semgrep/semgrep` image) | Go and security-audit SAST rules |
13+
| `container-security` | Trivy | CVEs in the `helm-watch:ci` image |
14+
| `test-and-build` | gosec (existing) | Go high-confidence SAST (enforced) |
1515

16-
`container-security` depends on `test-and-build` and reuses the saved Docker image tarball.
16+
`container-security` depends on `test-and-build` and scans the Docker image artifact produced in that job.
1717

1818
## gitleaks (secrets)
1919

20-
- **Why:** Catches API keys, tokens, and passwords committed to git — before they reach a public OSS repo or GHCR.
21-
- **How:** Scans full git history (`fetch-depth: 0`). Uses the default gitleaks ruleset.
22-
- **Report-only:** `continue-on-error: true` — findings appear in the job log; CI stays green.
23-
- **Later (ARM-6):** Remove `continue-on-error` so any leak fails the workflow.
20+
- **Purpose:** Detect API keys, tokens, and passwords in commits before they are published.
21+
- **Configuration:** Full git history (`fetch-depth: 0`), default gitleaks ruleset.
22+
- **Current behavior:** `continue-on-error: true` — findings are logged; the job does not fail CI.
23+
- **Planned enforcement:** Fail the workflow when any secret is detected.
2424

2525
## Semgrep (SAST)
2626

27-
- **Why:** Broader static analysis than gosec alone (logic bugs, unsafe patterns, security anti-patterns in Go and YAML-adjacent rules).
28-
- **How:** Dedicated job using the official [`semgrep/semgrep`](https://hub.docker.com/r/semgrep/semgrep) container and `semgrep scan --config p/golang --config p/security-audit`. The legacy `semgrep/semgrep-action@v1` wrapper is deprecated and its `returntocorp/semgrep-agent` image is no longer pullable.
29-
- **Report-only:** `continue-on-error: true` (findings may still exit non-zero).
30-
- **Later (ARM-10):** Enable Semgrep `--error` / fail on ERROR severity after tuning false positives.
27+
- **Purpose:** Complement gosec with broader static rules for Go and common security anti-patterns.
28+
- **Configuration:** Job runs in the [`semgrep/semgrep`](https://hub.docker.com/r/semgrep/semgrep) container with `semgrep scan --config p/golang --config p/security-audit`.
29+
- **Current behavior:** `continue-on-error: true`.
30+
- **Planned enforcement:** Fail on ERROR-severity findings after false positives are triaged.
3131

3232
## Trivy (container image)
3333

34-
- **Why:** The runtime image can include vulnerable OS packages or dependencies not visible in `go test`.
35-
- **How:** After `docker build`, the image is saved as an artifact, loaded in `container-security`, and scanned with `aquasecurity/trivy-action`. Table output goes to the log; SARIF is uploaded as `trivy-image-sarif` for optional review in GitHub / external tools.
36-
- **Report-only:** `exit-code: "0"`never fails the job regardless of severity.
37-
- **Later (ARM-6):** Fail on CRITICAL and HIGH; use `.trivyignore` only for documented exceptions.
34+
- **Purpose:** Scan the runtime image for OS and dependency CVEs not covered by unit tests.
35+
- **Configuration:** [`aquasecurity/trivy-action`](https://github.com/aquasecurity/trivy-action) (pinned to a release SHA). Table output in logs; SARIF uploaded as `trivy-image-sarif`.
36+
- **Current behavior:** `exit-code: "0"`results are informational only.
37+
- **Planned enforcement:** Fail on CRITICAL and HIGH severities, with `.trivyignore` for documented exceptions only.
3838

39-
## What stays unchanged
39+
## Unchanged checks
4040

41-
- **gosec** remains in `test-and-build` and already fails on high-severity Go issues.
42-
- **golangci-lint**, tests, Helm lint, and image build behavior are unchanged.
41+
- **gosec** in `test-and-build` continues to fail on high-severity Go issues.
42+
- Tests, golangci-lint, Helm lint, and image build steps are unchanged.
4343

44-
## Reading results in GitHub Actions
44+
## Viewing results in GitHub Actions
4545

46-
1. Open the CI run for your PR or push.
47-
2. Open **Security — secrets & SAST** or **Security — container image**.
48-
3. Expand the failing-looking steps — with report-only mode the job is still green; read the log for `leak`, `finding`, or Trivy `TOTAL`.
46+
1. Open the CI run for the branch or pull request.
47+
2. Inspect **Security — secrets**, **Security — SAST**, or **Security — container image**.
48+
3. Review step logs for gitleaks leaks, Semgrep rule IDs, or Trivy severity counts (jobs may show warnings while report-only mode is enabled).
4949

50-
## Rollout plan (from practice lab)
50+
## Enforcement roadmap
5151

52-
| Week | Change |
53-
|------|--------|
54-
| 1 (now) | Report-only: gitleaks, Semgrep, Trivy image |
55-
| 2 | Fail on gitleaks + Trivy CRITICAL/HIGH; add govulncheck (ARM-7) |
56-
| 3 | Semgrep error gate (ARM-10) |
57-
58-
Training notes: see Notion page under **Practice · Lab CI/CD (GitHub Actions)** (helm-watch Week 1 implementation).
52+
| Phase | Change |
53+
|-------|--------|
54+
| Current | Report-only gitleaks, Semgrep, and Trivy image scans |
55+
| Next | Fail CI on secret leaks and Trivy CRITICAL/HIGH |
56+
| Later | Dependency scanning (govulncheck); Semgrep ERROR gate |

0 commit comments

Comments
 (0)