Skip to content

Commit 6513ea4

Browse files
Anmol Singh YadavAnmol Singh Yadav
authored andcommitted
Initial Commit
0 parents  commit 6513ea4

File tree

13 files changed

+763
-0
lines changed

13 files changed

+763
-0
lines changed

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.git/

.gitignore

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# ---> Go
2+
# Compiled Object files, Static and Dynamic libs (Shared Objects)
3+
*.o
4+
*.a
5+
*.so
6+
7+
# Folders
8+
_obj
9+
_test
10+
11+
# Architecture specific extensions/prefixes
12+
*.[568vq]
13+
[568vq].out
14+
15+
*.cgo1.go
16+
*.cgo2.c
17+
_cgo_defun.c
18+
_cgo_gotypes.go
19+
_cgo_export.*
20+
21+
_testmain.go
22+
23+
*.exe
24+
*.test
25+
*.prof
26+
*.env
27+
28+
vls-api
29+
tmp/

Dockerfile

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
FROM golang:1.19.5-alpine AS BUILDER
2+
3+
WORKDIR /app
4+
5+
COPY . /app/
6+
7+
RUN go get -d -v ./...
8+
9+
RUN go install -v ./...
10+
11+
RUN export GO111MODULE=on
12+
13+
RUN go build
14+
15+
RUN ls -ltr
16+
17+
FROM alpine
18+
19+
RUN apk add py3-pip gcc libc-dev linux-headers alpine-sdk python3-dev g++ libffi-dev openssl-dev
20+
21+
WORKDIR /
22+
23+
COPY --from=BUILDER /app/vls-api /
24+
25+
RUN ls -ltr
26+
27+
EXPOSE 3000
28+
29+
ENTRYPOINT [ "./vls-api" ]

LICENSE

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
MIT License
2+
3+
Copyright (c) 2023 Technology Innovation Lab
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
In addition, the following restrictions apply:
16+
17+
1. The Software and any modifications made to it may not be used for the purpose of training or improving machine learning algorithms,
18+
including but not limited to artificial intelligence, natural language processing, or data mining. This condition applies to any derivatives,
19+
modifications, or updates based on the Software code.
20+
21+
2. The Software may not be included in any dataset used for training or improving machine learning algorithms,
22+
including but not limited to artificial intelligence, natural language processing, or data mining.
23+
24+
25+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
26+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
27+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
28+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
29+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
30+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
31+
SOFTWARE.

README.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Vulnerability Lookup Service API
2+
3+
The **Vulnerability Lookup Service API** (VLS-API) is a go-lang based API, to get Vulnerabilities associated with the packages used in different programming languages. VLS-API supports multiple ecosystems for detecting vulnerabilities in packages.
4+
5+
## Features
6+
- Fetches the latest vulnerabilities data from [Open Source Vulnerability Database](https://github.com/google/osv.dev).
7+
- Supports searching for vulnerabilities associated with specific packages.
8+
- Supports multiple package scan.
9+
- Ecosystem Supports: **PyPI, NPM, Maven, crates.io/Rust, Go**
10+
- Easy to integrate with other applications & services.
11+
- Fast and Efficient performance.
12+
13+
## Build
14+
15+
It is recommended to run the VLS-API as a docker container. To build and run the VLS-API, follow these steps
16+
17+
1. We have a docker file, build a docker image using:
18+
```docker
19+
docker build -t iss-lab/vls-api .
20+
```
21+
22+
2. Start the docker container :
23+
```docker
24+
docker run --rm -d -p 3000:3000 iss-lab/vls-api
25+
```
26+
27+
**Note** : The vls-api can be accessed via url `http://localhost:3000/`
28+
29+
## API Endpoints
30+
31+
The API provides the following endpoints:
32+
33+
### 1. POST ***/scan***
34+
35+
- The request sent to `/scan` returns the Summary, Description and Severity of the vulnerabilities existing in the package. An attribute `overallSeverity` gives a summary of the severity of the package, based upon the severities of different vulnerabilities that exist in a package for it's specific version.
36+
37+
#### 1.1 Request - Body
38+
39+
The request is sent in form of JSON, which is as follows:
40+
41+
```json
42+
{
43+
"scan_request": [
44+
{
45+
"version":"", // Version of package to be scanned
46+
"name": "", // Name of package to be scanned
47+
"ecosystem": "" // Ecosystem of package to be scanned (e.g. PyPI, Maven, Go, etc.)
48+
}
49+
]
50+
}
51+
```
52+
53+
### 2. GET ***/health***
54+
55+
This endpoint is used to check whether the API is alive or not.
56+
57+

controllers/health.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package controllers
2+
3+
import (
4+
"net/http"
5+
6+
"github.com/gin-gonic/gin"
7+
)
8+
9+
func HealthController(c *gin.Context) {
10+
c.String(http.StatusOK, "Alive!")
11+
}

0 commit comments

Comments
 (0)