File tree Expand file tree Collapse file tree 4 files changed +101
-10
lines changed Expand file tree Collapse file tree 4 files changed +101
-10
lines changed Original file line number Diff line number Diff line change 2
2
lockVersion : 1.0.0
3
3
dependencies :
4
4
codeql/dataflow :
5
- version : 1.1.8
5
+ version : 2.0.4
6
6
codeql/go-all :
7
- version : 3.0.1
7
+ version : 4.2.2
8
8
codeql/mad :
9
- version : 1.0.14
9
+ version : 1.0.20
10
10
codeql/ssa :
11
- version : 1.0.14
11
+ version : 1.0.20
12
12
codeql/threat-models :
13
- version : 1.0.14
13
+ version : 1.0.20
14
14
codeql/tutorial :
15
- version : 1.0.14
15
+ version : 1.0.20
16
16
codeql/typetracking :
17
- version : 1 .0.14
17
+ version : 2 .0.4
18
18
codeql/util :
19
- version : 2.0.1
19
+ version : 2.0.7
20
20
compiled : false
Original file line number Diff line number Diff line change
1
+ import go
2
+ import ghsl.Utils
3
+ import ghsl.LocalSources
4
+ import ghsl.Sinks
Original file line number Diff line number Diff line change
1
+ private import go
2
+ private import semmle.go.dataflow.DataFlow
3
+ private import semmle.go.security.CommandInjectionCustomizations
4
+ private import semmle.go.security.OpenUrlRedirectCustomizations
5
+ private import semmle.go.security.ReflectedXssCustomizations
6
+ private import semmle.go.security.RequestForgeryCustomizations
7
+ private import semmle.go.security.SqlInjectionCustomizations
8
+ private import semmle.go.security.UnsafeUnzipSymlinkCustomizations
9
+ private import semmle.go.security.XPathInjectionCustomizations
10
+ private import semmle.go.security.ZipSlipCustomizations
11
+
12
+ /**
13
+ * List of all the sinks that we want to check.
14
+ */
15
+ class AllSinks extends DataFlow:: Node {
16
+ private string sink ;
17
+
18
+ AllSinks ( ) {
19
+ this instanceof CommandInjection:: Sink and
20
+ sink = "command-injection"
21
+ or
22
+ this instanceof OpenUrlRedirect:: Sink and
23
+ sink = "open-url-redirect"
24
+ or
25
+ this instanceof ReflectedXss:: Sink and
26
+ sink = "reflected-xss"
27
+ or
28
+ this instanceof RequestForgery:: Sink and
29
+ sink = "request-forgery"
30
+ or
31
+ this instanceof SqlInjection:: Sink and
32
+ sink = "sql-injection"
33
+ or
34
+ this instanceof UnsafeUnzipSymlink:: EvalSymlinksSink and
35
+ sink = "unsafe-unzip"
36
+ or
37
+ this instanceof XPathInjection:: Sink and
38
+ sink = "xpath-injection"
39
+ or
40
+ this instanceof ZipSlip:: Sink and
41
+ sink = "zip-slip"
42
+ }
43
+
44
+ /**
45
+ * Gets the sink sink type.
46
+ */
47
+ string sinkType ( ) { result = sink }
48
+ }
Original file line number Diff line number Diff line change 1
- import go
2
- import semmle.go.frameworks.stdlib.Fmt
1
+ private import go
2
+ private import semmle.go.dataflow.DataFlow
3
+ private import semmle.go.dataflow.TaintTracking
4
+ private import semmle.go.frameworks.stdlib.Fmt
5
+
6
+ /**
7
+ * Find Node at Location
8
+ */
9
+ predicate filterByLocation ( DataFlow:: Node node , string relative_path , int linenumber ) {
10
+ node .getLocation ( ) .getFile ( ) .getRelativePath ( ) = relative_path and
11
+ node .getLocation ( ) .getStartLine ( ) = linenumber
12
+ }
13
+
14
+ /**
15
+ * List of all the souces
16
+ */
17
+ class AllSources extends DataFlow:: Node {
18
+ private string threatmodel ;
19
+
20
+ AllSources ( ) {
21
+ this instanceof RemoteFlowSource:: Range and
22
+ threatmodel = "remote"
23
+ or
24
+ this instanceof LocalSources and
25
+ threatmodel = "local"
26
+ }
27
+
28
+ /**
29
+ * Gets the source threat model.
30
+ */
31
+ string getThreatModel ( ) { result = threatmodel }
32
+ }
33
+
34
+ /**
35
+ * Local sources
36
+ */
37
+ class LocalSources extends DataFlow:: Node {
38
+ LocalSources ( ) {
39
+ this .( SourceNode ) .getThreatModel ( ) = "local"
40
+ }
41
+ }
3
42
4
43
class DynamicStrings extends DataFlow:: Node {
5
44
DynamicStrings ( ) {
You can’t perform that action at this time.
0 commit comments