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

introduce Snyk security scans for V2 images #4575

Merged
merged 1 commit into from
Jan 12, 2023
Merged
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
189 changes: 189 additions & 0 deletions .github/workflows/security_tests_v2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,189 @@
name: V2 Security Tests

on:
push:
branches: [ v2 ]
workflow_dispatch:
inputs:
docker-tag:
description: 'Docker tag for scan'
default: 'latest'
required: false

jobs:
security-operator:
runs-on: ubuntu-latest
container: snyk/snyk:golang
steps:
- uses: actions/checkout@v2
- name: security-golang
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
run: |
make -C operator fmt
snyk test --file=operator/go.mod --fail-on=upgradable --severity-threshold=high

security-scheduler:
runs-on: ubuntu-latest
container: snyk/snyk:golang
steps:
- uses: actions/checkout@v2
- name: security-golang
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
run: |
make -C scheduler lint
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you know why need to run the linter here, instead of using Snyk's GH action?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In all other tasks there was make -C <directory> fmt but scheduler did not have fmt but lint command. Not sure exactly why it is there. I first assumed it was for Go to pull modules but that does not make sense actually... I may try without it.

But to why these are here: it's because these were present in V1 tasks.

snyk test --file=scheduler/go.mod --fail-on=upgradable --severity-threshold=high

security-image-operator:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set default docker tag for builds from v2 branch
id: docker-tag
run: |
USER_INPUT="${{ github.event.inputs.docker-tag }}"
echo ::set-output name=value::${USER_INPUT:-"latest"}
Copy link
Contributor

Choose a reason for hiding this comment

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

Oh wow - is this wizardry to default to latest if no tag is present?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, that's to use default for input usually coming as parameter to "on_dispatch" in workflows running "on_push". There may be more elegant way (though I doubt, unless some new features were added) but that is what I found when working on SCv2 release workflow.

- name: security-docker-image
uses: snyk/actions/docker@master
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
with:
image: seldonio/seldonv2-controller:${{ steps.docker-tag.outputs.value }}
args: --fail-on=upgradable --severity-threshold=high --file=operator/Dockerfile

security-image-scheduler:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set default docker tag for builds from v2 branch
id: docker-tag
run: |
USER_INPUT="${{ github.event.inputs.docker-tag }}"
echo ::set-output name=value::${USER_INPUT:-"latest"}
- name: security-docker-image
uses: snyk/actions/docker@master
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
with:
image: seldonio/seldon-scheduler:${{ steps.docker-tag.outputs.value }}
args: --fail-on=upgradable --severity-threshold=high --file=scheduler/Dockerfile.scheduler

security-image-data-flow-engine:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set default docker tag for builds from v2 branch
id: docker-tag
run: |
USER_INPUT="${{ github.event.inputs.docker-tag }}"
echo ::set-output name=value::${USER_INPUT:-"latest"}
- name: security-docker-image
uses: snyk/actions/docker@master
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
with:
image: seldonio/seldon-dataflow-engine:${{ steps.docker-tag.outputs.value }}
args: --fail-on=upgradable --severity-threshold=high --file=scheduler/Dockerfile.dataflow

security-image-envoy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set default docker tag for builds from v2 branch
id: docker-tag
run: |
USER_INPUT="${{ github.event.inputs.docker-tag }}"
echo ::set-output name=value::${USER_INPUT:-"latest"}
- name: security-docker-image
uses: snyk/actions/docker@master
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
with:
image: seldonio/seldon-envoy:${{ steps.docker-tag.outputs.value }}
args: --fail-on=upgradable --severity-threshold=high --file=scheduler/Dockerfile.envoy

security-image-modelgateway:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set default docker tag for builds from v2 branch
id: docker-tag
run: |
USER_INPUT="${{ github.event.inputs.docker-tag }}"
echo ::set-output name=value::${USER_INPUT:-"latest"}
- name: security-docker-image
uses: snyk/actions/docker@master
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
with:
image: seldonio/seldon-modelgateway:${{ steps.docker-tag.outputs.value }}
args: --fail-on=upgradable --severity-threshold=high --file=scheduler/Dockerfile.modelgateway

security-image-pipelinegateway:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set default docker tag for builds from v2 branch
id: docker-tag
run: |
USER_INPUT="${{ github.event.inputs.docker-tag }}"
echo ::set-output name=value::${USER_INPUT:-"latest"}
- name: security-docker-image
uses: snyk/actions/docker@master
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
with:
image: seldonio/seldon-pipelinegateway:${{ steps.docker-tag.outputs.value }}
args: --fail-on=upgradable --severity-threshold=high --file=scheduler/Dockerfile.pipelinegateway

security-image-agent:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set default docker tag for builds from v2 branch
id: docker-tag
run: |
USER_INPUT="${{ github.event.inputs.docker-tag }}"
echo ::set-output name=value::${USER_INPUT:-"latest"}
- name: security-docker-image
uses: snyk/actions/docker@master
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
with:
image: seldonio/seldon-agent:${{ steps.docker-tag.outputs.value }}
args: --fail-on=upgradable --severity-threshold=high --file=scheduler/Dockerfile.agent

security-image-rclone:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set default docker tag for builds from v2 branch
id: docker-tag
run: |
USER_INPUT="${{ github.event.inputs.docker-tag }}"
echo ::set-output name=value::${USER_INPUT:-"latest"}
- name: security-docker-image
uses: snyk/actions/docker@master
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
with:
image: seldonio/seldon-rclone:${{ steps.docker-tag.outputs.value }}
args: --fail-on=upgradable --severity-threshold=high --file=scheduler/Dockerfile.rclone

security-image-hodometer:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set default docker tag for builds from v2 branch
id: docker-tag
run: |
USER_INPUT="${{ github.event.inputs.docker-tag }}"
echo ::set-output name=value::${USER_INPUT:-"latest"}
- name: security-docker-image
uses: snyk/actions/docker@master
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
with:
image: seldonio/seldon-hodometer:${{ steps.docker-tag.outputs.value }}
args: --fail-on=upgradable --severity-threshold=high --file=hodometer/Dockerfile.hodometer