Skip to content

Commit

Permalink
tfsec to Trivy scanning (#7905)
Browse files Browse the repository at this point in the history
* deleted tf sec and replaced it with trivy

* added a User to Dockerfile and gave user permissions to complete actions

* updated to run trivy on a push to main
  • Loading branch information
shanice-skylight authored Jul 29, 2024
1 parent 885d2b7 commit 274169b
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 29 deletions.
28 changes: 0 additions & 28 deletions .github/workflows/tfsec.yml

This file was deleted.

32 changes: 32 additions & 0 deletions .github/workflows/trivy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: trivy

on:
push:
branches:
- main
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
trivy:
name: trivy
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4


- name: Run Trivy vulnerability scanner
uses: aquasecurity/[email protected]
with:
scan-type: 'fs'
scan-ref: 'ops/'
scanners: 'vuln,secret,misconfig'
exit-code: '1'
ignore-unfixed: false
format: 'table'
severity: 'CRITICAL,HIGH'
16 changes: 15 additions & 1 deletion ops/services/container_instances/db_client/image/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,24 @@
FROM alpine:3.20
RUN apk --no-cache add postgresql14-client
RUN apk add --no-cache bash
ARG UID=10001
RUN adduser \
--disabled-password \
--gecos "" \
--home "/nonexistent" \
--shell "/sbin/nologin" \
--no-create-home \
--uid "${UID}" \
dockeruser
RUN echo 'dockeruser ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers sudo
RUN unset HISTFILE
RUN bash -ic 'unset HISTFILE'
RUN bash -ic 'set +o history'
RUN echo 'unset HISTFILE' >> /etc/profile.d/disable.history.sh
USER dockeruser
WORKDIR /home/dockeruser
RUN echo $(psql --version) >> /tmp/psql_version
ENV PSQL_HISTORY=/export/.psql_history
ENTRYPOINT ["tail", "-f", "/dev/null"]
ENTRYPOINT ["tail", "-f", "/dev/null"]


0 comments on commit 274169b

Please sign in to comment.