Skip to content

Commit

Permalink
Init
Browse files Browse the repository at this point in the history
  • Loading branch information
debug-ing committed Dec 17, 2024
0 parents commit 849f51d
Show file tree
Hide file tree
Showing 7 changed files with 103 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/go-vuln-scan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Go Vulnerability Scan

on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
check-go-version:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Run Go Vulnerability Scanner
uses: ./
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"cSpell.words": [
"govulncheck"
]
}
13 changes: 13 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM golang:1.23

WORKDIR /app

RUN go install golang.org/x/vuln/cmd/govulncheck@latest

COPY . .

RUN go build -o main main.go

RUN ls -l /app

ENTRYPOINT ["/app/main"]
33 changes: 33 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Go Vulnerability Scanner GitHub Action 🚀

Easily scan your Go projects for known vulnerabilities using the govulncheck tool provided by golang.org/x/vuln. This GitHub Action integrates seamlessly into your CI/CD pipeline, ensuring your dependencies are up-to-date and free from security risks.


## Usage
Add the following workflow file to your project:

.github/workflows/go-vuln-scan.yml:

```
name: Go Vulnerability Scan
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
vuln-scan:
name: Run Go Vulnerability Scanner
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Run Go Vulnerability Scanner
uses: debug-ing/[email protected]
```
11 changes: 11 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: "Go Vulnerability Scanner"
description: "Scans Go dependencies for security vulnerabilities using govulncheck"
author: "Mahdi Mohammadi"

runs:
using: "docker"
image: "Dockerfile"

branding:
icon: "shield"
color: "red"
3 changes: 3 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module github.com/debug-ing/go-vuln-scanner

go 1.22.3
19 changes: 19 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package main

import (
"fmt"
"os"
"os/exec"
)

func main() {
fmt.Println("Starting Go Dependency Vulnerability Scan...")
cmd := exec.Command("govulncheck", "./...")
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
if err := cmd.Run(); err != nil {
fmt.Println("Error during vulnerability scan:", err)
os.Exit(1)
}
fmt.Println("Vulnerability scan completed successfully!")
}

0 comments on commit 849f51d

Please sign in to comment.