-
Notifications
You must be signed in to change notification settings - Fork 191
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Creates docker image for osv scanner to allow it to run as a github action, and the appropriate action.yml. The current implementation is not particularly useful, only printing out the found vulnerabilities to the logs. It should be running under this PR. TODO: Decide what the goal of the github action will be.
- Loading branch information
1 parent
1c70592
commit a2314c3
Showing
4 changed files
with
88 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Copyright 2022 Google LLC | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
name: osv-scanner | ||
|
||
on: [pull_request] | ||
|
||
jobs: | ||
osv-scanner: | ||
name: Scan for vulnerabilities | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: osv scan step | ||
id: osv-scanning | ||
uses: ./tools/osv-scanner/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Copyright 2022 Google LLC | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
FROM golang:alpine | ||
|
||
RUN mkdir /src | ||
WORKDIR /src | ||
|
||
COPY ./go.mod /src/go.mod | ||
COPY ./go.sum /src/go.sum | ||
RUN go mod download | ||
|
||
COPY ./ /src/ | ||
RUN go build -o osv-scanner ./cmd/osv-scanner/ | ||
|
||
FROM alpine:latest | ||
RUN apk --no-cache add \ | ||
ca-certificates \ | ||
git | ||
|
||
# Allow git to run on mounted directories | ||
RUN git config --global --add safe.directory '*' | ||
|
||
WORKDIR /root/ | ||
COPY --from=0 /src/osv-scanner ./ | ||
|
||
ENTRYPOINT ["/root/osv-scanner"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
name: 'osv-scanner' | ||
description: 'Scans your directory against the OSV database' | ||
inputs: | ||
to-scan: | ||
description: 'Directory to scan' | ||
required: true | ||
default: '/github/workspace' | ||
runs: | ||
using: 'docker' | ||
image: 'Dockerfile' | ||
args: | ||
- '--skip-git' | ||
- ${{ inputs.to-scan }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters