Skip to content

Commit

Permalink
feat: refactor and add more properties in report
Browse files Browse the repository at this point in the history
  • Loading branch information
emmanuelgautier committed Oct 13, 2024
1 parent c1f7de2 commit 9a12263
Show file tree
Hide file tree
Showing 79 changed files with 1,631 additions and 811 deletions.
6 changes: 3 additions & 3 deletions api/curl.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ func (h *Handler) ScanURL(ctx *gin.Context) {
return
}

if reporter.HasVulnerability() {
analyticsx.TrackEvent(ctx, serverApiUrlTracer, "Vulnerability Found", nil)
if reporter.HasIssue() {
analyticsx.TrackEvent(ctx, serverApiUrlTracer, "Issue Found", nil)

Check warning on line 57 in api/curl.go

View check run for this annotation

Codecov / codecov/patch

api/curl.go#L56-L57

Added lines #L56 - L57 were not covered by tests
}

ctx.JSON(http.StatusOK, HTTPResponseReports{
Reports: reporter.GetReports(),
Reports: reporter.GetScanReports(),

Check warning on line 61 in api/curl.go

View check run for this annotation

Codecov / codecov/patch

api/curl.go#L61

Added line #L61 was not covered by tests
})
}
6 changes: 3 additions & 3 deletions api/graphql.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ func (h *Handler) ScanGraphQL(ctx *gin.Context) {
return
}

if reporter.HasVulnerability() {
analyticsx.TrackEvent(ctx, serverApiGraphQLTracer, "Vulnerability Found", nil)
if reporter.HasIssue() {
analyticsx.TrackEvent(ctx, serverApiGraphQLTracer, "Issue Found", nil)

Check warning on line 53 in api/graphql.go

View check run for this annotation

Codecov / codecov/patch

api/graphql.go#L52-L53

Added lines #L52 - L53 were not covered by tests
}

ctx.JSON(http.StatusOK, HTTPResponseReports{
Reports: reporter.GetReports(),
Reports: reporter.GetScanReports(),

Check warning on line 57 in api/graphql.go

View check run for this annotation

Codecov / codecov/patch

api/graphql.go#L57

Added line #L57 was not covered by tests
})
}
8 changes: 4 additions & 4 deletions api/openapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ type NewOpenAPIScanRequest struct {
Schema string `json:"schema" binding:"required"`
SecuritySchemes map[string]struct {
Value string `json:"value" binding:"required"`
} `json:"security_schemes"`
} `json:"securitySchemes"`

Opts *ScanOptions `json:"options"`
}
Expand Down Expand Up @@ -76,12 +76,12 @@ func (h *Handler) ScanOpenAPI(ctx *gin.Context) {
return
}

if reporter.HasVulnerability() {
analyticsx.TrackEvent(ctx, serverApiOpenAPITracer, "Vulnerability Found", nil)
if reporter.HasIssue() {
analyticsx.TrackEvent(ctx, serverApiOpenAPITracer, "Issue Found", nil)

Check warning on line 80 in api/openapi.go

View check run for this annotation

Codecov / codecov/patch

api/openapi.go#L79-L80

Added lines #L79 - L80 were not covered by tests
}

response := HTTPResponseReports{
Reports: reporter.GetReports(),
Reports: reporter.GetScanReports(),

Check warning on line 84 in api/openapi.go

View check run for this annotation

Codecov / codecov/patch

api/openapi.go#L84

Added line #L84 was not covered by tests
}
_, err = json.Marshal(response)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion api/response.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ import (
)

type HTTPResponseReports struct {
Reports []*report.Report `json:"reports"`
Reports []*report.ScanReport `json:"reports"`
}
2 changes: 1 addition & 1 deletion api/response_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func TestMarshalHTTPResponseReports(t *testing.T) {
sr.EndTime = time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC)

hrr := api.HTTPResponseReports{
Reports: []*report.Report{sr},
Reports: []*report.ScanReport{sr},
}

b, err := json.Marshal(hrr)
Expand Down
2 changes: 1 addition & 1 deletion cmd/scan/curl.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func NewCURLScanCmd() (scanCmd *cobra.Command) {
}

internalCmd.TrackScanReport(ctx, tracer, reporter)
err = internalCmd.PrintOrExportReport(internalCmd.GetOutputFormat(), internalCmd.GetOutputTransport(), reporter)
err = internalCmd.PrintOrExportReport(internalCmd.GetReportFormat(), internalCmd.GetReportTransport(), reporter)

Check warning on line 71 in cmd/scan/curl.go

View check run for this annotation

Codecov / codecov/patch

cmd/scan/curl.go#L71

Added line #L71 was not covered by tests
if err != nil {
analyticsx.TrackError(ctx, tracer, err)
log.Fatal(err)
Expand Down
2 changes: 1 addition & 1 deletion cmd/scan/graphql.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func NewGraphQLScanCmd() (scanCmd *cobra.Command) {
}

internalCmd.TrackScanReport(ctx, tracer, reporter)
err = internalCmd.PrintOrExportReport(internalCmd.GetOutputFormat(), internalCmd.GetOutputTransport(), reporter)
err = internalCmd.PrintOrExportReport(internalCmd.GetReportFormat(), internalCmd.GetReportTransport(), reporter)

Check warning on line 63 in cmd/scan/graphql.go

View check run for this annotation

Codecov / codecov/patch

cmd/scan/graphql.go#L63

Added line #L63 was not covered by tests
if err != nil {
analyticsx.TrackError(ctx, tracer, err)
log.Fatal(err)
Expand Down
2 changes: 1 addition & 1 deletion cmd/scan/openapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ func NewOpenAPIScanCmd() (scanCmd *cobra.Command) {
}

internalCmd.TrackScanReport(ctx, tracer, reporter)
if err = internalCmd.PrintOrExportReport(internalCmd.GetOutputFormat(), internalCmd.GetOutputTransport(), reporter); err != nil {
if err = internalCmd.PrintOrExportReport(internalCmd.GetReportFormat(), internalCmd.GetReportTransport(), reporter); err != nil {

Check warning on line 105 in cmd/scan/openapi.go

View check run for this annotation

Codecov / codecov/patch

cmd/scan/openapi.go#L105

Added line #L105 was not covered by tests
analyticsx.TrackError(ctx, tracer, err)
log.Fatal(err)
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ require (
go.opentelemetry.io/otel/sdk v1.31.0
go.opentelemetry.io/otel/trace v1.31.0
go.uber.org/ratelimit v0.3.1
golang.org/x/text v0.19.0
gopkg.in/yaml.v3 v3.0.1
)

Expand Down Expand Up @@ -73,7 +74,6 @@ require (
golang.org/x/net v0.30.0 // indirect
golang.org/x/sys v0.26.0 // indirect
golang.org/x/term v0.25.0 // indirect
golang.org/x/text v0.19.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20241007155032-5fefd90f89a9 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20241007155032-5fefd90f89a9 // indirect
google.golang.org/grpc v1.67.1 // indirect
Expand Down
40 changes: 2 additions & 38 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/gabriel-vasile/mimetype v1.4.5 h1:J7wGKdGu33ocBOhGy0z653k/lFKLFDPJMG8Gql0kxn4=
github.com/gabriel-vasile/mimetype v1.4.5/go.mod h1:ibHel+/kbxn9x2407k1izTA1S81ku1z/DlgOW2QE0M4=
github.com/getkin/kin-openapi v0.127.0 h1:Mghqi3Dhryf3F8vR370nN67pAERW+3a95vomb3MAREY=
github.com/getkin/kin-openapi v0.127.0/go.mod h1:OZrfXzUfGrNbsKj+xmFBx6E5c6yH3At/tAKSc2UszXM=
github.com/getkin/kin-openapi v0.128.0 h1:jqq3D9vC9pPq1dGcOCv7yOp1DaEe7c/T1vzcLbITSp4=
github.com/getkin/kin-openapi v0.128.0/go.mod h1:OZrfXzUfGrNbsKj+xmFBx6E5c6yH3At/tAKSc2UszXM=
github.com/gin-contrib/requestid v1.0.3 h1:NB6SF0Te4Ikn8mW2K4tegpm2WGuB3bWj4wnWaM4oSAA=
Expand Down Expand Up @@ -109,18 +107,14 @@ github.com/perimeterx/marshmallow v1.1.5 h1:a2LALqQ1BlHM8PZblsDdidgv1mWi1DgC2UmX
github.com/perimeterx/marshmallow v1.1.5/go.mod h1:dsXbUu8CRzfYP5a87xpp0xq9S3u0Vchtcl8we9tYaXw=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/projectdiscovery/wappalyzergo v0.1.21 h1:IBzws+/YyXctWMZOjADRIG3ghv076rT54jbO548/+q4=
github.com/projectdiscovery/wappalyzergo v0.1.21/go.mod h1:wnvmbC10pQTOoCKnCTmWKP20rpEtqrMJZvzuTuleeyw=
github.com/projectdiscovery/wappalyzergo v0.1.23 h1:YqZPKTD/NC9xb/lByfMDPWwBNl/5/CevjP5elRAzi5k=
github.com/projectdiscovery/wappalyzergo v0.1.23/go.mod h1:wnvmbC10pQTOoCKnCTmWKP20rpEtqrMJZvzuTuleeyw=
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ=
github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8=
github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4=
github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII=
github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/schollz/progressbar/v3 v3.16.0 h1:+MbBim/cE9DqDb8UXRfLJ6RZdyDkXG1BDy/sWc5s0Mc=
github.com/schollz/progressbar/v3 v3.16.0/go.mod h1:lLiKjKJ9/yzc9Q8jk+sVLfxWxgXKsktvUf6TO+4Y2nw=
github.com/schollz/progressbar/v3 v3.16.1 h1:RnF1neWZFzLCoGx8yp1yF7SDl4AzNDI5y4I0aUJRrZQ=
github.com/schollz/progressbar/v3 v3.16.1/go.mod h1:I2ILR76gz5VXqYMIY/LdLecvMHDPVcQm3W/MSKi1TME=
github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM=
Expand All @@ -147,28 +141,16 @@ go.opentelemetry.io/contrib/instrumentation/github.com/gin-gonic/gin/otelgin v0.
go.opentelemetry.io/contrib/instrumentation/github.com/gin-gonic/gin/otelgin v0.55.0/go.mod h1:8aCCTMjP225r98yevEMM5NYDb3ianWLoeIzZ1rPyxHU=
go.opentelemetry.io/contrib/propagators/b3 v1.30.0 h1:vumy4r1KMyaoQRltX7cJ37p3nluzALX9nugCjNNefuY=
go.opentelemetry.io/contrib/propagators/b3 v1.30.0/go.mod h1:fRbvRsaeVZ82LIl3u0rIvusIel2UUf+JcaaIpy5taho=
go.opentelemetry.io/otel v1.30.0 h1:F2t8sK4qf1fAmY9ua4ohFS/K+FUuOPemHUIXHtktrts=
go.opentelemetry.io/otel v1.30.0/go.mod h1:tFw4Br9b7fOS+uEao81PJjVMjW/5fvNCbpsDIXqP0pc=
go.opentelemetry.io/otel v1.31.0 h1:NsJcKPIW0D0H3NgzPDHmo0WW6SptzPdqg/L1zsIm2hY=
go.opentelemetry.io/otel v1.31.0/go.mod h1:O0C14Yl9FgkjqcCZAsE053C13OaddMYr/hz6clDkEJE=
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.30.0 h1:lsInsfvhVIfOI6qHVyysXMNDnjO9Npvl7tlDPJFBVd4=
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.30.0/go.mod h1:KQsVNh4OjgjTG0G6EiNi1jVpnaeeKsKMRwbLN+f1+8M=
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.31.0 h1:K0XaT3DwHAcV4nKLzcQvwAgSyisUghWoY20I7huthMk=
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.31.0/go.mod h1:B5Ki776z/MBnVha1Nzwp5arlzBbE3+1jk+pGmaP5HME=
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.30.0 h1:umZgi92IyxfXd/l4kaDhnKgY8rnN/cZcF1LKc6I8OQ8=
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.30.0/go.mod h1:4lVs6obhSVRb1EW5FhOuBTyiQhtRtAnnva9vD3yRfq8=
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.31.0 h1:lUsI2TYsQw2r1IASwoROaCnjdj2cvC2+Jbxvk6nHnWU=
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.31.0/go.mod h1:2HpZxxQurfGxJlJDblybejHB6RX6pmExPNe517hREw4=
go.opentelemetry.io/otel/metric v1.30.0 h1:4xNulvn9gjzo4hjg+wzIKG7iNFEaBMX00Qd4QIZs7+w=
go.opentelemetry.io/otel/metric v1.30.0/go.mod h1:aXTfST94tswhWEb+5QjlSqG+cZlmyXy/u8jFpor3WqQ=
go.opentelemetry.io/otel/metric v1.31.0 h1:FSErL0ATQAmYHUIzSezZibnyVlft1ybhy4ozRPcF2fE=
go.opentelemetry.io/otel/metric v1.31.0/go.mod h1:C3dEloVbLuYoX41KpmAhOqNriGbA+qqH6PQ5E5mUfnY=
go.opentelemetry.io/otel/sdk v1.30.0 h1:cHdik6irO49R5IysVhdn8oaiR9m8XluDaJAs4DfOrYE=
go.opentelemetry.io/otel/sdk v1.30.0/go.mod h1:p14X4Ok8S+sygzblytT1nqG98QG2KYKv++HE0LY/mhg=
go.opentelemetry.io/otel/sdk v1.31.0 h1:xLY3abVHYZ5HSfOg3l2E5LUj2Cwva5Y7yGxnSW9H5Gk=
go.opentelemetry.io/otel/sdk v1.31.0/go.mod h1:TfRbMdhvxIIr/B2N2LQW2S5v9m3gOQ/08KsbbO5BPT0=
go.opentelemetry.io/otel/trace v1.30.0 h1:7UBkkYzeg3C7kQX8VAidWh2biiQbtAKjyIML8dQ9wmc=
go.opentelemetry.io/otel/trace v1.30.0/go.mod h1:5EyKqTzzmyqB9bwtCCq6pDLktPK6fmGf/Dph+8VI02o=
go.opentelemetry.io/otel/trace v1.31.0 h1:ffjsj1aRouKewfr85U2aGagJ46+MvodynlQ1HYdmJys=
go.opentelemetry.io/otel/trace v1.31.0/go.mod h1:TXZkRk7SM2ZQLtR6eoAWQFIHPvzQ06FJAsO1tJg480A=
go.opentelemetry.io/proto/otlp v1.3.1 h1:TrMUixzpM0yuc/znrFTP9MMRh8trP93mkCiDVeXrui0=
Expand All @@ -179,42 +161,24 @@ go.uber.org/ratelimit v0.3.1 h1:K4qVE+byfv/B3tC+4nYWP7v/6SimcO7HzHekoMNBma0=
go.uber.org/ratelimit v0.3.1/go.mod h1:6euWsTB6U/Nb3X++xEUXA8ciPJvr19Q/0h1+oDcJhRk=
golang.org/x/arch v0.10.0 h1:S3huipmSclq3PJMNe76NGwkBR504WFkQ5dhzWzP8ZW8=
golang.org/x/arch v0.10.0/go.mod h1:FEVrYAQjsQXMVJ1nsMoVVXPZg6p2JE2mx8psSWTDQys=
golang.org/x/crypto v0.27.0 h1:GXm2NjJrPaiv/h1tb2UH8QfgC/hOf/+z0p6PT8o1w7A=
golang.org/x/crypto v0.27.0/go.mod h1:1Xngt8kV6Dvbssa53Ziq6Eqn0HqbZi5Z6R0ZpwQzt70=
golang.org/x/crypto v0.28.0 h1:GBDwsMXVQi34v5CCYUm2jkJvu4cbtru2U4TN2PSyQnw=
golang.org/x/crypto v0.28.0/go.mod h1:rmgy+3RHxRZMyY0jjAJShp2zgEdOqj2AO7U0pYmeQ7U=
golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo=
golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0=
golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4=
golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34=
golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo=
golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.24.0 h1:Mh5cbb+Zk2hqqXNO7S1iTjEphVL+jb8ZWaqh/g+JWkM=
golang.org/x/term v0.24.0/go.mod h1:lOBK/LVxemqiMij05LGJ0tzNr8xlmwBRJ81PX6wVLH8=
golang.org/x/term v0.25.0 h1:WtHI/ltw4NvSUig5KARz9h521QvRC8RmF/cuYqifU24=
golang.org/x/term v0.25.0/go.mod h1:RPyXicDX+6vLxogjjRxjgD2TKtmAO6NZBsBRfrOLu7M=
golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224=
golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY=
golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM=
golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY=
google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1 h1:hjSy6tcFQZ171igDaN5QHOw2n6vx40juYbC/x67CEhc=
google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1/go.mod h1:qpvKtACPCQhAdu3PyQgV4l3LMXZEtft7y8QcarRsp9I=
google.golang.org/genproto/googleapis/api v0.0.0-20241007155032-5fefd90f89a9 h1:T6rh4haD3GVYsgEfWExoCZA2o2FmbNyKpTuAxbEFPTg=
google.golang.org/genproto/googleapis/api v0.0.0-20241007155032-5fefd90f89a9/go.mod h1:wp2WsuBYj6j8wUdo3ToZsdxxixbvQNAHqVJrTgi5E5M=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 h1:pPJltXNxVzT4pK9yD8vR9X75DaWYYmLGMsEvBfFQZzQ=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU=
google.golang.org/genproto/googleapis/rpc v0.0.0-20241007155032-5fefd90f89a9 h1:QCqS/PdaHTSWGvupk2F/ehwHtGc0/GYkT+3GAcR1CCc=
google.golang.org/genproto/googleapis/rpc v0.0.0-20241007155032-5fefd90f89a9/go.mod h1:GX3210XPVPUjJbTUbvwI8f2IpZDMZuPJWDzDuebbviI=
google.golang.org/grpc v1.66.1 h1:hO5qAXR19+/Z44hmvIM4dQFMSYX9XcWsByfoxutBpAM=
google.golang.org/grpc v1.66.1/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y=
google.golang.org/grpc v1.67.1 h1:zWnc1Vrcno+lHZCOofnIMvycFcc0QRGIzm9dhnDX68E=
google.golang.org/grpc v1.67.1/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA=
google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg=
google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw=
google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA=
google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
Expand Down
6 changes: 3 additions & 3 deletions internal/cmd/analytics.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (

func TrackScanReport(ctx context.Context, tracer trace.Tracer, reporter *report.Reporter) {
analyticsx.TrackEvent(ctx, tracer, "Scan Report", []attribute.KeyValue{
attribute.Int("vulnerabilityCount", len(reporter.GetVulnerabilityReports())),
attribute.Bool("hasVulnerability", reporter.HasVulnerability()),
attribute.Bool("hasHighRiskSeverityVulnerability", reporter.HasHighRiskOrHigherSeverityVulnerability()),
attribute.Int("issuesCount", len(reporter.GetIssueReports())),
attribute.Bool("hasIssue", reporter.HasIssue()),
attribute.Bool("hasHighRiskSeverityIssue", reporter.HasHighRiskOrHigherSeverityIssue()),

Check warning on line 16 in internal/cmd/analytics.go

View check run for this annotation

Codecov / codecov/patch

internal/cmd/analytics.go#L14-L16

Added lines #L14 - L16 were not covered by tests
})
}
24 changes: 12 additions & 12 deletions internal/cmd/args.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ var (
includeScans []string
excludeScans []string

outputFormat string
outputTransport string
outputPath string
outputURL string
reportFormat string
reportTransport string
reportFile string
reportURL string

noProgress bool
severityThreshold float64
Expand All @@ -34,10 +34,10 @@ func AddCommonArgs(cmd *cobra.Command) {
cmd.Flags().StringArrayVarP(&includeScans, "scans", "", includeScans, "Include specific scans")
cmd.Flags().StringArrayVarP(&excludeScans, "exclude-scans", "e", excludeScans, "Exclude specific scans")

cmd.Flags().StringVarP(&outputFormat, "format", "", "table", "Output format (table, json, yaml)")
cmd.Flags().StringVarP(&outputTransport, "output-transport", "", "file", "The transport to use for output (e.g. file, http)")
cmd.Flags().StringVarP(&outputPath, "output-path", "", "", "The file to write the output to")
cmd.Flags().StringVarP(&outputURL, "output-url", "", "", "The URL to send the output to")
cmd.Flags().StringVarP(&reportFormat, "report-format", "", "table", "Report format (table, json, yaml)")
cmd.Flags().StringVarP(&reportTransport, "report-transport", "", "file", "The transport to use for report (e.g. file, http)")
cmd.Flags().StringVarP(&reportFile, "report-file", "", "", "The file to write the report to")
cmd.Flags().StringVarP(&reportURL, "report-url", "", "", "The URL to send the report to")

cmd.Flags().BoolVarP(&noProgress, "no-progress", "", false, "Disable progress output")
cmd.Flags().Float64VarP(&severityThreshold, "severity-threshold", "", 1, "Threshold to trigger stderr output if at least one vulnerability CVSS is higher")
Expand Down Expand Up @@ -89,12 +89,12 @@ func GetExcludeScans() []string {
return filteredScans
}

func GetOutputFormat() string {
return outputFormat
func GetReportFormat() string {
return reportFormat
}

func GetOutputTransport() string {
return outputTransport
func GetReportTransport() string {
return reportTransport
}

func GetNoProgress() bool {
Expand Down
12 changes: 6 additions & 6 deletions internal/cmd/args_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ func TestAddCommonArgs(t *testing.T) {
"--cookie=sessionid=12345",
"--scans=scan1",
"--scans=scan2",
"--format=json",
"--output-transport=http",
"--output-path=/tmp/output",
"--output-url=http://example.com/output",
"--report-format=json",
"--report-transport=http",
"--report-file=/tmp/output",
"--report-url=http://example.com/output",
"--no-progress",
"--severity-threshold=5",
},
Expand Down Expand Up @@ -117,8 +117,8 @@ func TestAddCommonArgs(t *testing.T) {
assert.Equal(t, tt.expected.cookies, cmd.GetCookies())
assert.Equal(t, tt.expected.includeScans, cmd.GetIncludeScans())
assert.Equal(t, tt.expected.excludeScans, cmd.GetExcludeScans())
assert.Equal(t, tt.expected.outputFormat, cmd.GetOutputFormat())
assert.Equal(t, tt.expected.outputTransport, cmd.GetOutputTransport())
assert.Equal(t, tt.expected.outputFormat, cmd.GetReportFormat())
assert.Equal(t, tt.expected.outputTransport, cmd.GetReportTransport())
assert.Equal(t, tt.expected.noProgress, cmd.GetNoProgress())
assert.Equal(t, tt.expected.severityThreshold, cmd.GetSeverityThreshold())
})
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/printtable/fingerprint_table.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
)

func FingerprintScanReport(reporter *report.Reporter) {
report := reporter.GetReportByID(fingerprint.DiscoverFingerPrintScanID)
report := reporter.GetScanReportByID(fingerprint.DiscoverFingerPrintScanID)

Check warning on line 12 in internal/cmd/printtable/fingerprint_table.go

View check run for this annotation

Codecov / codecov/patch

internal/cmd/printtable/fingerprint_table.go#L12

Added line #L12 was not covered by tests
if report == nil || !report.HasData() {
return
}
Expand Down
Loading

0 comments on commit 9a12263

Please sign in to comment.