Skip to content

Commit 5356100

Browse files
authored
Merge pull request github#14445 from owen-mc/go/automated-mad-coverage-report
Go: automated mad coverage report
2 parents 39bca2d + 2862713 commit 5356100

File tree

11 files changed

+133
-13
lines changed

11 files changed

+133
-13
lines changed

csharp/ql/src/meta/frameworks/Coverage.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* @name Framework coverage
3-
* @description The number of API endpoints covered by CSV models sorted by
3+
* @description The number of API endpoints covered by MaD models sorted by
44
* package and source-, sink-, and summary-kind.
55
* @kind table
66
* @id cs/meta/framework-coverage
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
package,source,summary,source:remote,summary:taint,summary:value
2+
,,2,,,2
3+
archive/tar,,5,,5,
4+
archive/zip,,6,,6,
5+
bufio,,17,,17,
6+
bytes,,43,,43,
7+
compress/bzip2,,1,,1,
8+
compress/flate,,4,,4,
9+
compress/gzip,,3,,3,
10+
compress/lzw,,1,,1,
11+
compress/zlib,,4,,4,
12+
container/heap,,5,,5,
13+
container/list,,20,,20,
14+
container/ring,,5,,5,
15+
context,,5,,5,
16+
crypto,,1,,1,
17+
crypto/cipher,,3,,3,
18+
crypto/rsa,,2,,2,
19+
crypto/tls,,3,,3,
20+
crypto/x509,,1,,1,
21+
database/sql,,7,,7,
22+
database/sql/driver,,4,,4,
23+
encoding,,4,,4,
24+
encoding/ascii85,,2,,2,
25+
encoding/asn1,,8,,8,
26+
encoding/base32,,3,,3,
27+
encoding/base64,,3,,3,
28+
encoding/binary,,2,,2,
29+
encoding/csv,,5,,5,
30+
encoding/gob,,7,,7,
31+
encoding/hex,,3,,3,
32+
encoding/json,,14,,14,
33+
encoding/pem,,3,,3,
34+
encoding/xml,,23,,23,
35+
errors,,3,,3,
36+
expvar,,6,,6,
37+
fmt,,5,,5,
38+
github.com/astaxie/beego,,7,,7,
39+
github.com/astaxie/beego/context,,1,,1,
40+
github.com/astaxie/beego/utils,,13,,13,
41+
github.com/beego/beego/core/utils,,13,,13,
42+
github.com/beego/beego/server/web,,7,,7,
43+
github.com/beego/beego/server/web/context,,1,,1,
44+
github.com/couchbase/gocb,,18,,18,
45+
github.com/couchbaselabs/gocb,,18,,18,
46+
github.com/elazarl/goproxy,,2,,2,
47+
github.com/evanphx/json-patch,,12,,12,
48+
github.com/gin-gonic/gin,,2,,2,
49+
github.com/go-pg/pg/$ANYVERSION/orm,,6,,6,
50+
github.com/golang/protobuf/$ANYVERSION/proto,,4,,4,
51+
github.com/json-iterator/go,,4,,4,
52+
github.com/labstack/echo,,2,,2,
53+
github.com/revel/revel,,10,,10,
54+
github.com/robfig/revel,,10,,10,
55+
github.com/sendgrid/sendgrid-go/$ANYVERSION/helpers/mail,,1,,1,
56+
go.uber.org/zap,,11,,11,
57+
golang.org/x/net/$ANYVERSION/html,,16,,16,
58+
golang.org/x/net/context,,5,,5,
59+
google.golang.org/protobuf/$ANYVERSION/internal/encoding/text,,1,,1,
60+
google.golang.org/protobuf/$ANYVERSION/internal/impl,,2,,2,
61+
google.golang.org/protobuf/$ANYVERSION/proto,,8,,8,
62+
google.golang.org/protobuf/$ANYVERSION/reflect/protoreflect,,1,,1,
63+
gopkg.in/couchbase/gocb,,18,,18,
64+
gopkg.in/macaron,,1,,1,
65+
gopkg.in/yaml,,9,,9,
66+
html,,2,,2,
67+
html/template,,6,,6,
68+
io,,19,,19,
69+
io/fs,,12,,12,
70+
io/ioutil,,2,,2,
71+
k8s.io/api/core,,10,,10,
72+
k8s.io/apimachinery/$ANYVERSION/pkg/runtime,,47,,47,
73+
log,,3,,3,
74+
mime,,5,,5,
75+
mime/multipart,,8,,8,
76+
mime/quotedprintable,,1,,1,
77+
net,,20,,20,
78+
net/http,8,22,8,22,
79+
net/http/httputil,,10,,10,
80+
net/mail,,6,,6,
81+
net/textproto,,19,,19,
82+
net/url,,23,,23,
83+
os,,4,,4,
84+
path,,5,,5,
85+
path/filepath,,13,,13,
86+
reflect,,37,,37,
87+
regexp,,20,,20,
88+
sort,,1,,1,
89+
strconv,,9,,9,
90+
strings,,34,,34,
91+
sync,,10,,10,
92+
sync/atomic,,24,,24,
93+
syscall,,8,,8,
94+
text/scanner,,3,,3,
95+
text/tabwriter,,1,,1,
96+
text/template,,6,,6,
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
Go framework & library support
2+
================================
3+
4+
.. csv-table::
5+
:header-rows: 1
6+
:class: fullWidthTable
7+
:widths: auto
8+
9+
Framework / library,Package,Flow sources,Taint & value steps,Sinks (total)
10+
Others,"````, ``archive/tar``, ``archive/zip``, ``bufio``, ``bytes``, ``compress/bzip2``, ``compress/flate``, ``compress/gzip``, ``compress/lzw``, ``compress/zlib``, ``container/heap``, ``container/list``, ``container/ring``, ``context``, ``crypto``, ``crypto/cipher``, ``crypto/rsa``, ``crypto/tls``, ``crypto/x509``, ``database/sql``, ``database/sql/driver``, ``encoding``, ``encoding/ascii85``, ``encoding/asn1``, ``encoding/base32``, ``encoding/base64``, ``encoding/binary``, ``encoding/csv``, ``encoding/gob``, ``encoding/hex``, ``encoding/json``, ``encoding/pem``, ``encoding/xml``, ``errors``, ``expvar``, ``fmt``, ``github.com/astaxie/beego``, ``github.com/astaxie/beego/context``, ``github.com/astaxie/beego/utils``, ``github.com/beego/beego/core/utils``, ``github.com/beego/beego/server/web``, ``github.com/beego/beego/server/web/context``, ``github.com/couchbase/gocb``, ``github.com/couchbaselabs/gocb``, ``github.com/elazarl/goproxy``, ``github.com/evanphx/json-patch``, ``github.com/gin-gonic/gin``, ``github.com/go-pg/pg/$ANYVERSION/orm``, ``github.com/golang/protobuf/$ANYVERSION/proto``, ``github.com/json-iterator/go``, ``github.com/labstack/echo``, ``github.com/revel/revel``, ``github.com/robfig/revel``, ``github.com/sendgrid/sendgrid-go/$ANYVERSION/helpers/mail``, ``go.uber.org/zap``, ``golang.org/x/net/$ANYVERSION/html``, ``golang.org/x/net/context``, ``google.golang.org/protobuf/$ANYVERSION/internal/encoding/text``, ``google.golang.org/protobuf/$ANYVERSION/internal/impl``, ``google.golang.org/protobuf/$ANYVERSION/proto``, ``google.golang.org/protobuf/$ANYVERSION/reflect/protoreflect``, ``gopkg.in/couchbase/gocb``, ``gopkg.in/macaron``, ``gopkg.in/yaml``, ``html``, ``html/template``, ``io``, ``io/fs``, ``io/ioutil``, ``k8s.io/api/core``, ``k8s.io/apimachinery/$ANYVERSION/pkg/runtime``, ``log``, ``mime``, ``mime/multipart``, ``mime/quotedprintable``, ``net``, ``net/http``, ``net/http/httputil``, ``net/mail``, ``net/textproto``, ``net/url``, ``os``, ``path``, ``path/filepath``, ``reflect``, ``regexp``, ``sort``, ``strconv``, ``strings``, ``sync``, ``sync/atomic``, ``syscall``, ``text/scanner``, ``text/tabwriter``, ``text/template``",8,826,
11+
Totals,,8,826,
12+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
CWE,Sink identifier,Label
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Framework name,URL,Package prefixes

go/ql/lib/semmle/go/dataflow/ExternalFlow.qll

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -82,14 +82,6 @@ private import internal.AccessPathSyntax
8282
private import FlowSummary
8383
private import codeql.mad.ModelValidation as SharedModelVal
8484

85-
/**
86-
* A module importing the frameworks that provide external flow data,
87-
* ensuring that they are visible to the taint tracking / data flow library.
88-
*/
89-
private module Frameworks {
90-
private import semmle.go.frameworks.Stdlib
91-
}
92-
9385
/** Holds if a source model exists for the given parameters. */
9486
predicate sourceModel = Extensions::sourceModel/9;
9587

go/ql/src/meta/frameworks/Coverage.ql

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/**
2+
* @name Framework coverage
3+
* @description The number of API endpoints covered by MaD models sorted by
4+
* package and source-, sink-, and summary-kind.
5+
* @kind table
6+
* @id go/meta/framework-coverage
7+
*/
8+
9+
import go
10+
import semmle.go.dataflow.ExternalFlow
11+
12+
from string package, int pkgs, string kind, string part, int n
13+
where modelCoverage(package, pkgs, kind, part, n)
14+
select package, pkgs, kind, part, n

java/ql/src/meta/frameworks/Coverage.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* @name Framework coverage
3-
* @description The number of API endpoints covered by CSV models sorted by
3+
* @description The number of API endpoints covered by MaD models sorted by
44
* package and source-, sink-, and summary-kind.
55
* @kind table
66
* @id java/meta/framework-coverage

misc/scripts/library-coverage/generate-report.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,9 @@ def add_package_stats_to_row(row, sorted_cwes, collect):
114114
utils.LanguageConfig(
115115
"java", "Java", ".java", query_prefix + "java/ql/src/meta/frameworks/Coverage.ql"),
116116
utils.LanguageConfig(
117-
"csharp", "C#", ".cs", query_prefix + "csharp/ql/src/meta/frameworks/Coverage.ql")
117+
"csharp", "C#", ".cs", query_prefix + "csharp/ql/src/meta/frameworks/Coverage.ql"),
118+
utils.LanguageConfig(
119+
"go", "Go", ".go", query_prefix + "go/ql/src/meta/frameworks/Coverage.ql")
118120
]
119121

120122
# The names of input and output files. The placeholder {language} is replaced with the language name.

misc/scripts/library-coverage/generate-timeseries.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,9 @@ def get_packages(config, search_path):
7474
utils.LanguageConfig(
7575
"java", "Java", ".java", "java/ql/src/meta/frameworks/Coverage.ql", ["java/ql/lib/config/semmlecode.dbscheme", "java/ql/src/config/semmlecode.dbscheme"]),
7676
utils.LanguageConfig(
77-
"csharp", "C#", ".cs", "csharp/ql/src/meta/frameworks/Coverage.ql", ["csharp/ql/lib/semmlecode.csharp.dbscheme", "csharp/ql/src/semmlecode.csharp.dbscheme"])
77+
"csharp", "C#", ".cs", "csharp/ql/src/meta/frameworks/Coverage.ql", ["csharp/ql/lib/semmlecode.csharp.dbscheme", "csharp/ql/src/semmlecode.csharp.dbscheme"]),
78+
utils.LanguageConfig(
79+
"go", "Go", ".go", "go/ql/src/meta/frameworks/Coverage.ql", ["go/ql/lib/go.dbscheme", "go/ql/src/go.dbscheme"])
7880
]
7981

8082
output_prefix = "framework-coverage-timeseries-"

0 commit comments

Comments
 (0)