Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: first pass trivy scan manager/ui images #174

Merged
merged 4 commits into from
Sep 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 33 additions & 2 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ jobs:
echo "GOTESTSUM_VERSION=$GOTESTSUM_VERSION" >> "$GITHUB_ENV"
echo "HELM_VERSION=$HELM_VERSION" >> "$GITHUB_ENV"

- name: store short hash
run: |
echo "COMMIT_HASH=$(git describe --always --abbrev=8)" >> "$GITHUB_ENV"

- name: set up go
uses: actions/setup-go@v5
with:
Expand Down Expand Up @@ -53,14 +57,41 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: <not on main> build images, don't push
if: github.ref_name != 'main'
- name: build images
run: |
devspace run build --skip-push

- name: run trivy - manager
uses: aquasecurity/[email protected]
with:
image-ref: ghcr.io/srl-labs/clabernetes/clabernetes-manager:${{ env.COMMIT_HASH }}
format: github
output: clabernetes-manager.sbom.json
exit-code: 1
ignore-unfixed: true
vuln-type: os,library
severity: CRITICAL,HIGH
github-pat: ${{ secrets.GITHUB_TOKEN }}

# note: the launcher is beyond hope for so many reasons, so...
# we'll skip running this on that guy and just hit the manager/ui :)

- name: run trivy - ui
uses: aquasecurity/[email protected]
with:
image-ref: ghcr.io/srl-labs/clabernetes/clabernetes-ui:${{ env.COMMIT_HASH }}
format: github
output: clabernetes-ui.sbom.json
exit-code: 1
ignore-unfixed: true
vuln-type: os,library
severity: CRITICAL,HIGH
github-pat: ${{ secrets.GITHUB_TOKEN }}

- name: <on main> build and push images and helm chart
if: github.ref_name == 'main'
run: |
# we already built but everything will be cached so just re-run to let devspace push them
devspace run build

helm registry login -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }} ghcr.io
Expand Down
15 changes: 14 additions & 1 deletion .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,18 @@ jobs:
https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh |
sh -s -- -b $(go env GOPATH)/bin ${{ env.GOLANGCI_LINT_VERSION }}

- name: run the linter
- name: run the linters
run: make lint

- name: run trivy - fs
uses: aquasecurity/[email protected]
with:
scan-type: fs
exit-code: 1
ignore-unfixed: true
vuln-type: os,library
severity: CRITICAL,HIGH
scanners: config
skip-dirs: ui/.next,charts,e2e
# we know launcher/dev/clabverter are using root user, its fine for now!
skip-files: build/clabverter.Dockerfile,build/launcher.Dockerfile,.develop/dev.Dockerfile
1 change: 1 addition & 0 deletions build/ui.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,6 @@ WORKDIR /clabernetes

COPY --from=builder --chown=nonroot:nonroot /clabernetes/.next/standalone ./
COPY --from=builder --chown=nonroot:nonroot /clabernetes/.next/static ./.next/static
USER nonroot:nonroot

CMD ["server.js"]