Add trivy scan, fix trivy errors for Dockerfile

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2023-06-12 23:35:54 +02:00
parent 34fa7bed17
commit 5d0f1acbf2
Signed by: luzifer
GPG key ID: D91C3E91E4CAD6F5
3 changed files with 23 additions and 4 deletions

View file

@ -42,6 +42,7 @@ jobs:
nodejs-lts-fermium \ nodejs-lts-fermium \
npm \ npm \
tar \ tar \
trivy \
unzip \ unzip \
which \ which \
zip zip
@ -63,6 +64,9 @@ jobs:
NO_TESTS: 'true' NO_TESTS: 'true'
PACKAGES: '.' PACKAGES: '.'
- name: Execute Trivy scan
run: make trivy
- name: Extract changelog - name: Extract changelog
run: 'awk "/^#/ && ++c==2{exit}; /^#/f" "History.md" | tail -n +2 >release_changelog.md' run: 'awk "/^#/ && ++c==2{exit}; /^#/f" "History.md" | tail -n +2 >release_changelog.md'

View file

@ -4,8 +4,7 @@ COPY . /go/src/github.com/Luzifer/twitch-bot
WORKDIR /go/src/github.com/Luzifer/twitch-bot WORKDIR /go/src/github.com/Luzifer/twitch-bot
ENV CGO_ENABLED=0 \ ENV CGO_ENABLED=0 \
GOPATH=/go \ GOPATH=/go
NODE_ENV=production
RUN set -ex \ RUN set -ex \
&& pacman -Syy --noconfirm \ && pacman -Syy --noconfirm \
@ -28,7 +27,7 @@ FROM alpine:latest
LABEL maintainer "Knut Ahlers <knut@ahlers.me>" LABEL maintainer "Knut Ahlers <knut@ahlers.me>"
ENV CONFIG=/data/config.yaml \ ENV CONFIG=/data/config.yaml \
STORAGE_FILE=/data/store.json.gz STORAGE_CONN_STRING=/data/store.db
RUN set -ex \ RUN set -ex \
&& apk --no-cache add \ && apk --no-cache add \
@ -36,10 +35,13 @@ RUN set -ex \
ca-certificates \ ca-certificates \
curl \ curl \
jq \ jq \
tzdata tzdata \
&& mkdir /data \
&& chown 1000:1000 /data
COPY --from=builder /go/bin/twitch-bot /usr/local/bin/twitch-bot COPY --from=builder /go/bin/twitch-bot /usr/local/bin/twitch-bot
USER 1000:1000
VOLUME ["/data"] VOLUME ["/data"]
ENTRYPOINT ["/usr/local/bin/twitch-bot"] ENTRYPOINT ["/usr/local/bin/twitch-bot"]

View file

@ -40,3 +40,16 @@ push_wiki:
update_ua_list: update_ua_list:
# User-Agents provided by https://www.useragents.me/ # User-Agents provided by https://www.useragents.me/
curl -sSf https://www.useragents.me/api | jq -r '.data[].ua' | grep -v 'Trident' >internal/linkcheck/user-agents.txt curl -sSf https://www.useragents.me/api | jq -r '.data[].ua' | grep -v 'Trident' >internal/linkcheck/user-agents.txt
# -- Vulnerability scanning --
trivy:
trivy fs . \
--dependency-tree \
--exit-code 1 \
--format table \
--ignore-unfixed \
--quiet \
--scanners config,license,secret,vuln \
--severity HIGH,CRITICAL \
--skip-dirs docs