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

Scan with govulncheck and upload SARIF report #9474

Closed
wants to merge 7 commits into from
Closed
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
50 changes: 50 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -187,12 +187,62 @@ jobs:
ingress-controller/controller-chroot:1.0.0-dev \
| pigz > docker.tar.gz

# pigz needs write permission to zip the scannable binary
sudo chown -R $USER:$USER /home/runner/work/ingress-nginx
pigz rootfs/bin/amd64/scannable-nginx-ingress-controller

- name: cache
uses: actions/upload-artifact@83fd05a356d7e2593de66fc9913b3002723633cb # v3.1.1
with:
name: docker.tar.gz
path: docker.tar.gz

- name: Upload scannable binary
uses: actions/upload-artifact@83fd05a356d7e2593de66fc9913b3002723633cb # v3.1.1
with:
name: scannable-nginx-ingress-controller.gz
path: rootfs/bin/amd64/scannable-nginx-ingress-controller.gz

govulncheck:
name: govulncheck
runs-on: ubuntu-latest
needs:
- changes
- build

steps:
- name: Checkout
uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b # v3.2.0

- name: Download binary
uses: actions/download-artifact@9782bd6a9848b53b110e712e20e42d89988822b7 # v3.0.1
with:
name: scannable-nginx-ingress-controller.gz

- name: Unzip binary
run: |
echo "loading ingress binary file..."
pigz -d scannable-nginx-ingress-controller.gz

- name: Scan for Vulnerabilities in Code
uses: Templum/[email protected]
with:
go-version: 1.19
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we have updated the go tool chain to v1.20

vulncheck-version: latest
skip-upload: true
package: scannable-nginx-ingress-controller
fail-on-vuln: false

- uses: geekyeggo/delete-artifact@54ab544f12cdb7b71613a16a2b5a37a9ade990af # v2.0.0
with:
name: scannable-nginx-ingress-controller.gz
failOnError: false

- name: Upload SARIF report
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: govulncheck-report.sarif

helm:
name: Helm chart
runs-on: ubuntu-latest
Expand Down
10 changes: 10 additions & 0 deletions build/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,16 @@ ${GO_BUILD_CMD} \
-buildvcs=false \
-o "${TARGETS_DIR}/nginx-ingress-controller" "${PKG}/cmd/nginx"

echo "Building ${PKG}/cmd/nginx with Go's symbol table"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whats the difference between scannable-nginx-ingress-controller and nginx-ingress-controller build options?


${GO_BUILD_CMD} \
-trimpath -ldflags="-buildid= -w \
-X ${PKG}/version.RELEASE=${TAG} \
-X ${PKG}/version.COMMIT=${COMMIT_SHA} \
-X ${PKG}/version.REPO=${REPO_INFO}" \
-buildvcs=false \
-o "${TARGETS_DIR}/scannable-nginx-ingress-controller" "${PKG}/cmd/nginx"

echo "Building ${PKG}/cmd/dbg"

${GO_BUILD_CMD} \
Expand Down