Skip to content

Snyk #24

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

Merged
merged 2 commits into from
May 13, 2024
Merged

Snyk #24

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
17 changes: 17 additions & 0 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,20 @@ jobs:
- name: Tag Docker image
run: docker tag algorithm-exercises-csharp:latest algorithm-exercises-csharp:${{ github.sha }}

- name: Run Snyk to check Docker image for vulnerabilities
# Snyk can be used to break the build when it detects vulnerabilities.
# In this case we want to upload the issues to GitHub Code Scanning
continue-on-error: true
uses: snyk/actions/docker@master
env:
# In order to use the Snyk Action you will need to have a Snyk API token.
# See https://docs.snyk.io/integrations/ci-cd-integrations/github-actions-integration#getting-your-snyk-token
# or you can sign up for free at https://snyk.io/login
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
with:
image: algorithm-exercises-csharp:latest
args: --file=Dockerfile
# - name: Upload result to GitHub Code Scanning
# uses: github/codeql-action/upload-sarif@v2
# with:
# sarif_file: snyk.sarif
27 changes: 27 additions & 0 deletions .github/workflows/dotnet-snyk.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net

name: .NET Snyk Code analysis

on:
push:
branches: [ main, develop, feature/* ]
pull_request:
branches: [ main ]

jobs:
security:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: snyk/actions/setup@master
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Restore dependencies
run: dotnet restore algorithm-exercises-csharp.sln
- name: Run Snyk to check for vulnerabilities
run: snyk test algorithm-exercises-csharp/ algorithm-exercises-csharp-test/
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
9 changes: 8 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,14 @@ FROM mcr.microsoft.com/dotnet/sdk:8.0.204-alpine3.19-amd64 AS base
ENV WORKDIR=/app
WORKDIR ${WORKDIR}

FROM node:20.2.0-alpine3.16 AS lint
FROM node:22.1.0-alpine3.19 AS lint

ENV WORKDIR=/app
WORKDIR ${WORKDIR}

COPY ./docs ${WORKDIR}/docs
RUN apk add --update --no-cache make
RUN npm install -g markdownlint-cli

ENV WORKDIR=/app
WORKDIR ${WORKDIR}
Expand Down
Loading