Skip to content

Commit fc86a58

Browse files
author
Daniel Jimenez
committed
Add AsyncAPI doc and generation script
1 parent e77b0c9 commit fc86a58

File tree

10 files changed

+293
-5
lines changed

10 files changed

+293
-5
lines changed

README.md

+6
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ cd db && source flyway-migrate.sh && cd -
1313
vulnerability-db-consumer -c _resources/config/local.toml
1414
```
1515

16+
## How to generate AsyncAPI documentation
17+
Generated [AsyncAPI documentation](https://www.asyncapi.com/) can be found in `./docs` directory.
18+
```
19+
cd pkg/asyncapi/_gen && ./gen.sh && cd -
20+
```
21+
1622
## How to run the Vulnerability DB in development mode
1723

1824
You can test the Vulnerability DB Consumer locally in your machine.

docs/asyncapi.yaml

+141
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
asyncapi: 2.4.0
2+
info:
3+
title: Vulnerability DB
4+
version: v0.0.1
5+
servers:
6+
production:
7+
url: broker.example.com
8+
description: Dummy server
9+
protocol: kafka
10+
channels:
11+
findings:
12+
subscribe:
13+
message:
14+
$ref: '#/components/messages/FindingPayload'
15+
components:
16+
schemas:
17+
FindingPayload:
18+
properties:
19+
affected_resource:
20+
type: string
21+
current_exposure:
22+
type: integer
23+
details:
24+
type: string
25+
id:
26+
type: string
27+
impact_details:
28+
type: string
29+
issue:
30+
$ref: '#/components/schemas/StoreIssueLabels'
31+
resources:
32+
$ref: '#/components/schemas/StoreResources'
33+
score:
34+
type: number
35+
source:
36+
$ref: '#/components/schemas/StoreSource'
37+
status:
38+
type: string
39+
target:
40+
$ref: '#/components/schemas/StoreTargetTeams'
41+
total_exposure:
42+
type: integer
43+
type: object
44+
PqStringArray:
45+
items:
46+
type: string
47+
type:
48+
- array
49+
- "null"
50+
StoreIssueLabels:
51+
properties:
52+
cwe_id:
53+
minimum: 0
54+
type: integer
55+
description:
56+
type: string
57+
id:
58+
type: string
59+
labels:
60+
items:
61+
type: string
62+
type:
63+
- array
64+
- "null"
65+
recommendations:
66+
$ref: '#/components/schemas/PqStringArray'
67+
reference_links:
68+
$ref: '#/components/schemas/PqStringArray'
69+
summary:
70+
type: string
71+
type: object
72+
StoreResourceGroup:
73+
properties:
74+
attributes:
75+
items:
76+
type: string
77+
type:
78+
- array
79+
- "null"
80+
name:
81+
type: string
82+
resources:
83+
items:
84+
additionalProperties:
85+
type: string
86+
type: object
87+
type:
88+
- array
89+
- "null"
90+
type: object
91+
StoreResources:
92+
items:
93+
$ref: '#/components/schemas/StoreResourceGroup'
94+
type:
95+
- array
96+
- "null"
97+
StoreSource:
98+
properties:
99+
component:
100+
type: string
101+
id:
102+
type: string
103+
instance:
104+
type: string
105+
name:
106+
type: string
107+
options:
108+
type: string
109+
time:
110+
format: date-time
111+
type: string
112+
type: object
113+
StoreTargetTeams:
114+
properties:
115+
id:
116+
type: string
117+
identifier:
118+
type: string
119+
teams:
120+
items:
121+
type: string
122+
type:
123+
- array
124+
- "null"
125+
type: object
126+
messages:
127+
FindingPayload:
128+
contentType: application/json
129+
headers:
130+
properties:
131+
version:
132+
description: schema version header
133+
type: string
134+
required:
135+
- version
136+
type: object
137+
payload:
138+
$ref: '#/components/schemas/FindingPayload'
139+
summary: Events generated from Vulnerability DB findings state changes
140+
name: Finding
141+
title: Findings state

go.mod

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ require (
1515

1616
require (
1717
github.com/jmespath/go-jmespath v0.4.0 // indirect
18+
github.com/stretchr/testify v1.8.0 // indirect
1819
golang.org/x/sys v0.0.0-20220913175220-63ea55921009 // indirect
1920
gopkg.in/yaml.v2 v2.4.0 // indirect
2021
)

go.sum

+5-2
Original file line numberDiff line numberDiff line change
@@ -128,13 +128,15 @@ github.com/santhosh-tekuri/jsonschema/v5 v5.0.0/go.mod h1:FKdcjfQW6rpZSnxxUvEA5H
128128
github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE=
129129
github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
130130
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
131+
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
131132
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
132133
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
133134
github.com/stretchr/testify v1.3.1-0.20190311161405-34c6fa2dc709/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
134135
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
135136
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
136-
github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY=
137137
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
138+
github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk=
139+
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
138140
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
139141
go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI=
140142
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
@@ -244,7 +246,8 @@ gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
244246
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
245247
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
246248
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
247-
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo=
248249
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
250+
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
251+
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
249252
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
250253
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=

pkg/asyncapi/_gen/gen.go

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
package main
2+
3+
import (
4+
"os"
5+
6+
"github.com/adevinta/vulnerability-db/pkg/notify"
7+
8+
"github.com/swaggest/go-asyncapi/reflector/asyncapi-2.4.0"
9+
"github.com/swaggest/go-asyncapi/spec-2.4.0"
10+
)
11+
12+
type FindingPayload struct {
13+
notify.FindingNotification
14+
Version string `header:"version" description:"schema version header" required:"true"`
15+
}
16+
17+
func main() {
18+
asyncAPI := spec.AsyncAPI{}
19+
asyncAPI.Info.Version = notify.Version
20+
asyncAPI.Info.Title = "Vulnerability DB"
21+
22+
asyncAPI.AddServer("production", spec.Server{
23+
URL: "broker.example.com",
24+
Description: "Dummy server",
25+
Protocol: "kafka",
26+
})
27+
28+
reflector := asyncapi.Reflector{}
29+
reflector.Schema = &asyncAPI
30+
31+
mustNotFail(reflector.AddChannel(asyncapi.ChannelInfo{
32+
Name: "findings",
33+
Subscribe: &asyncapi.MessageSample{
34+
MessageEntity: spec.MessageEntity{
35+
Name: "Finding",
36+
Title: "Findings state",
37+
Summary: "Events generated from Vulnerability DB findings state changes",
38+
ContentType: "application/json",
39+
},
40+
MessageSample: new(FindingPayload),
41+
},
42+
}))
43+
44+
yaml, err := reflector.Schema.MarshalYAML()
45+
mustNotFail(err)
46+
mustNotFail(os.WriteFile("../../../docs/asyncapi.yaml", yaml, 0o600))
47+
}
48+
49+
func mustNotFail(err error) {
50+
if err != nil {
51+
panic(err)
52+
}
53+
}

pkg/asyncapi/_gen/gen.sh

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
3+
# Copyright 2022 Adevinta
4+
5+
set -eu
6+
7+
go run gen.go

pkg/asyncapi/_gen/go.mod

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
module github.com/adevinta/vulnerability-db/pkg/asyncapi/_gen
2+
3+
go 1.19
4+
5+
require (
6+
github.com/adevinta/vulnerability-db v1.1.5
7+
github.com/swaggest/go-asyncapi v0.8.0
8+
)
9+
10+
require (
11+
github.com/aws/aws-sdk-go v1.44.98 // indirect
12+
github.com/jmespath/go-jmespath v0.4.0 // indirect
13+
github.com/jmoiron/sqlx v1.3.4 // indirect
14+
github.com/lib/pq v1.10.3 // indirect
15+
github.com/sirupsen/logrus v1.8.1 // indirect
16+
github.com/swaggest/jsonschema-go v0.3.39 // indirect
17+
github.com/swaggest/refl v1.1.0 // indirect
18+
golang.org/x/sys v0.0.0-20220913175220-63ea55921009 // indirect
19+
gopkg.in/yaml.v2 v2.4.0 // indirect
20+
)
21+
22+
replace github.com/adevinta/vulnerability-db => ../../../

pkg/asyncapi/_gen/go.sum

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
github.com/aws/aws-sdk-go v1.44.98 h1:fX+NxebSdO/9T6DTNOLhpC+Vv6RNkKRfsMg0a7o/yBo=
2+
github.com/aws/aws-sdk-go v1.44.98/go.mod h1:y4AeaBuwd2Lk+GepC1E9v0qOiTws0MIWAX4oIKwKHZo=
3+
github.com/bool64/dev v0.2.20 h1:9eIRGdcg2kQW2NGza++QbOKidNNaK+KfWuUXcZFDejE=
4+
github.com/bool64/shared v0.1.5 h1:fp3eUhBsrSjNCQPcSdQqZxxh9bBwrYiZ+zOKFkM0/2E=
5+
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
6+
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
7+
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
8+
github.com/go-sql-driver/mysql v1.5.0 h1:ozyZYNQW3x3HtqT1jira07DN2PArx2v7/mN66gGcHOs=
9+
github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
10+
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
11+
github.com/iancoleman/orderedmap v0.2.0 h1:sq1N/TFpYH++aViPcaKjys3bDClUEU7s5B+z6jq8pNA=
12+
github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg=
13+
github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo=
14+
github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8=
15+
github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U=
16+
github.com/jmoiron/sqlx v1.3.4 h1:wv+0IJZfL5z0uZoUjlpKgHkgaFSYD+r9CfrXjEXsO7w=
17+
github.com/jmoiron/sqlx v1.3.4/go.mod h1:2BljVx/86SuTyjE+aPYlHCTNvZrnJXghYGpNiXLBMCQ=
18+
github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
19+
github.com/lib/pq v1.10.3 h1:v9QZf2Sn6AmjXtQeFpdoq/eaNtYP6IN+7lcrygsIAtg=
20+
github.com/lib/pq v1.10.3/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
21+
github.com/mattn/go-sqlite3 v1.14.6 h1:dNPt6NO46WmLVt2DLNpwczCmdV5boIZ6g/tlDrlRUbg=
22+
github.com/mattn/go-sqlite3 v1.14.6/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
23+
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
24+
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
25+
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
26+
github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ=
27+
github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE=
28+
github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
29+
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
30+
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
31+
github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk=
32+
github.com/swaggest/assertjson v1.7.0 h1:SKw5Rn0LQs6UvmGrIdaKQbMR1R3ncXm5KNon+QJ7jtw=
33+
github.com/swaggest/go-asyncapi v0.8.0 h1:aze7YL3o/4fkxx9ZL8ubKdyYCqFJy+9+JHpwLyF10H4=
34+
github.com/swaggest/go-asyncapi v0.8.0/go.mod h1:s1urrZuYPcNPJrRUU/kF1eOnIBU02O4JfXCDS09wONI=
35+
github.com/swaggest/jsonschema-go v0.3.39 h1:qX+a/LiK44xppnwUTZqJWNFcICxdWKeT27aFh4RvkEk=
36+
github.com/swaggest/jsonschema-go v0.3.39/go.mod h1:ipIOmoFP64QyRUgyPyU/P9tayq2m2TlvUhyZHrhe3S4=
37+
github.com/swaggest/refl v1.1.0 h1:a+9a75Kv6ciMozPjVbOfcVTEQe81t2R3emvaD9oGQGc=
38+
github.com/swaggest/refl v1.1.0/go.mod h1:g3Qa6ki0A/L2yxiuUpT+cuBURuRaltF5SDQpg1kMZSY=
39+
github.com/yudai/gojsondiff v1.0.0 h1:27cbfqXLVEJ1o8I6v3y9lg8Ydm53EKqHXAOMxEGlCOA=
40+
github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82 h1:BHyfKlQyqbsFN5p3IfnEUduWvb9is428/nNb5L3U01M=
41+
golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
42+
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
43+
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
44+
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
45+
golang.org/x/sys v0.0.0-20220913175220-63ea55921009 h1:PuvuRMeLWqsf/ZdT1UUZz0syhioyv1mzuFZsXs4fvhw=
46+
golang.org/x/sys v0.0.0-20220913175220-63ea55921009/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
47+
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
48+
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
49+
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
50+
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
51+
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
52+
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
53+
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
54+
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
55+
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=

pkg/notify/kafka.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
)
1212

1313
const (
14-
version = "v0.0.1" // Defines the notification schema version
14+
Version = "v0.0.1" // Defines the notification schema version
1515
)
1616

1717
// EventStreamClient represent a client of an event stream system, like Kafka
@@ -48,7 +48,7 @@ func (k *KafkaNotifier) PushFinding(f FindingNotification) error {
4848
return err
4949
}
5050
meta := map[string][]byte{
51-
"version": []byte(version),
51+
"version": []byte(Version),
5252
}
5353
return k.c.Push(f.ID, payload, meta)
5454
}

pkg/notify/kafka_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ func TestKafka_PushFinding(t *testing.T) {
210210
}
211211
`)),
212212
metadata: map[string][]byte{
213-
"version": []byte(version),
213+
"version": []byte(Version),
214214
},
215215
},
216216
},

0 commit comments

Comments
 (0)