diff --git a/.github/workflows/dev-preflight.yml b/.github/workflows/dev-preflight.yml new file mode 100644 index 0000000..69bd049 --- /dev/null +++ b/.github/workflows/dev-preflight.yml @@ -0,0 +1,33 @@ +# This is a basic workflow to help you get started with Actions + +name: DEVCD-Checkov + +# Controls when the workflow will run +on: + # Triggers the workflow on push or pull request events but only for the main branch + push: + branches: [ main ] + pull_request: + branches: [ main ] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # This workflow contains a single job called "build" + build: + # The type of runner that the job will run on + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up Python 3.8 + uses: actions/setup-python@v1 + with: + python-version: 3.8 + - name: Test with Checkov + id: checkov + uses: bridgecrewio/checkov-action@master + with: + directory: kustomize/overlays/dev + framework: kustomize diff --git a/.github/workflows/prod-preflight.yml b/.github/workflows/prod-preflight.yml new file mode 100644 index 0000000..9bcdb2f --- /dev/null +++ b/.github/workflows/prod-preflight.yml @@ -0,0 +1,35 @@ +# This is a basic workflow to help you get started with Actions + +name: PRODCD-Checkov + +# Controls when the workflow will run +on: + # Triggers the workflow on push or pull request events but only for the main branch + push: + branches: [ main ] + paths: 'kustomize/overlays/prod/**' + pull_request: + branches: [ main ] + paths: 'kustomize/overlays/prod/**' + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # This workflow contains a single job called "build" + build: + # The type of runner that the job will run on + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up Python 3.8 + uses: actions/setup-python@v1 + with: + python-version: 3.8 + - name: Test with Checkov + id: checkov + uses: bridgecrewio/checkov-action@master + with: + directory: kustomize/overlays/prod + framework: kustomize diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..4f04cec --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,8 @@ +- repo: https://github.com/bridgecrewio/checkov.git + rev: '2.0.809' # change to tag or sha + hooks: + - id: checkov + entry: checkov -d kustomize/overlays/prod + verbose: true + files: \.yaml$ + args: ["--framework","kustomize"] diff --git a/kustomize/overlays/prod/deployment.yaml b/kustomize/overlays/prod/deployment.yaml index efacc0e..7105979 100644 --- a/kustomize/overlays/prod/deployment.yaml +++ b/kustomize/overlays/prod/deployment.yaml @@ -5,9 +5,6 @@ metadata: namespace: kustomizegoat spec: template: - metadata: - annotations: - seccomp.security.alpha.kubernetes.io/pod: "docker/default" spec: affinity: podAntiAffinity: @@ -59,6 +56,8 @@ spec: name: pid-volume automountServiceAccountToken: false securityContext: + seccompProfile: + type: RuntimeDefault runAsNonRoot: true runAsUser: 10014 runAsGroup: 10014