Skip to content

Commit 49fb372

Browse files
committed
Add getSourceType declarations to existing remote flow sources
1 parent df6449c commit 49fb372

File tree

19 files changed

+66
-0
lines changed

19 files changed

+66
-0
lines changed

go/ql/lib/semmle/go/frameworks/AwsLambda.qll

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ private class LambdaInput extends RemoteFlowSource::Range {
1414
not p instanceof ReceiverVariable
1515
)
1616
}
17+
18+
override string getSourceType() { result = "AWS Lambda Input" }
1719
}
1820

1921
private class HandlerFunction extends FuncDef {

go/ql/lib/semmle/go/frameworks/Beego.qll

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ module Beego {
7171
}
7272

7373
predicate isSafeUrlSource() { methodName in ["URI", "URL"] }
74+
75+
override string getSourceType() { result = "Beego Input" }
7476
}
7577

7678
/** `BeegoInput` sources that are safe to use for redirection. */
@@ -100,6 +102,8 @@ module Beego {
100102
)
101103
)
102104
}
105+
106+
override string getSourceType() { result = "a Beego Controller" }
103107
}
104108

105109
/**
@@ -111,6 +115,8 @@ module Beego {
111115
frn.getField().hasQualifiedName(contextPackagePath(), "BeegoInput", "RequestBody")
112116
)
113117
}
118+
119+
override string getSourceType() { result = "Beego Input Request Body" }
114120
}
115121

116122
/**
@@ -122,6 +128,8 @@ module Beego {
122128
this = m.getACall().getResult()
123129
)
124130
}
131+
132+
override string getSourceType() { result = "a Beego cookie" }
125133
}
126134

127135
private class BeegoOutputInstance extends Http::ResponseWriter::Range {

go/ql/lib/semmle/go/frameworks/Chi.qll

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ private module Chi {
1515
UserControlledFunction() {
1616
this.getTarget().hasQualifiedName(packagePath(), ["URLParam", "URLParamFromCtx"])
1717
}
18+
19+
override string getSourceType() { result = "URL parameter" }
1820
}
1921

2022
/**
@@ -26,5 +28,7 @@ private module Chi {
2628
UserControlledRequestMethod() {
2729
this.getTarget().hasQualifiedName(packagePath(), "Context", "URLParam")
2830
}
31+
32+
override string getSourceType() { result = "URL parameter" }
2933
}
3034
}

go/ql/lib/semmle/go/frameworks/Echo.qll

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ private module Echo {
2424
this = call.getResult(0)
2525
)
2626
}
27+
28+
override string getSourceType() { result = "HTTP request context" }
2729
}
2830

2931
/**
@@ -50,6 +52,8 @@ private module Echo {
5052
this = FunctionOutput::parameter(0).getExitNode(call)
5153
)
5254
}
55+
56+
override string getSourceType() { result = "HTTP request data" }
5357
}
5458

5559
/**

go/ql/lib/semmle/go/frameworks/ElazarlGoproxy.qll

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ module ElazarlGoproxy {
106106
call.getTarget().hasQualifiedName(packagePath(), "ProxyCtx", "Charset")
107107
)
108108
}
109+
110+
override string getSourceType() { result = "HTTP request data" }
109111
}
110112

111113
private class ProxyLogFunction extends StringOps::Formatting::Range, Method {

go/ql/lib/semmle/go/frameworks/Fasthttp.qll

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,8 @@ module Fasthttp {
271271
this = m.getACall().getResult(0)
272272
)
273273
}
274+
275+
override string getSourceType() { result = "a component of a URI" }
274276
}
275277
}
276278

@@ -296,6 +298,8 @@ module Fasthttp {
296298
this = m.getACall().getResult(0)
297299
)
298300
}
301+
302+
override string getSourceType() { result = "URL Parameters" }
299303
}
300304
}
301305

@@ -421,6 +425,8 @@ module Fasthttp {
421425
this = m.getACall().getArgument(0)
422426
)
423427
}
428+
429+
override string getSourceType() { result = "HTTP request" }
424430
}
425431

426432
/**
@@ -499,6 +505,8 @@ module Fasthttp {
499505
this = m.getACall().getResult(0)
500506
)
501507
}
508+
509+
override string getSourceType() { result = "HTTP header" }
502510
}
503511
}
504512

@@ -529,6 +537,8 @@ module Fasthttp {
529537
this = m.getACall().getResult(0)
530538
)
531539
}
540+
541+
override string getSourceType() { result = "HTTP request header" }
532542
}
533543
}
534544
}

go/ql/lib/semmle/go/frameworks/Gin.qll

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ private module Gin {
3434
this = fld.getARead()
3535
)
3636
}
37+
38+
override string getSourceType() { result = "HTTP request context" }
3739
}
3840

3941
/**
@@ -53,6 +55,8 @@ private module Gin {
5355
this = FunctionOutput::parameter(0).getExitNode(call)
5456
)
5557
}
58+
59+
override string getSourceType() { result = "HTTP request data" }
5660
}
5761

5862
/**

go/ql/lib/semmle/go/frameworks/GoKit.qll

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ module GoKit {
3737

3838
private class EndpointRequest extends RemoteFlowSource::Range {
3939
EndpointRequest() { this = DataFlow::parameterNode(getAnEndpointFunction().getParameter(1)) }
40+
41+
override string getSourceType() { result = "Go Kit endpoint request" }
4042
}
4143
}
4244
}

go/ql/lib/semmle/go/frameworks/GoMicro.qll

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,5 +150,7 @@ module GoMicro {
150150
this.getType().(PointerType).getBaseType() instanceof ProtocMessageType
151151
)
152152
}
153+
154+
override string getSourceType() { result = "service handler request" }
153155
}
154156
}

go/ql/lib/semmle/go/frameworks/GoRestfulHttp.qll

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ private module GoRestfulHttp {
2929
*/
3030
private class GoRestfulSource extends RemoteFlowSource::Range {
3131
GoRestfulSource() { this = any(GoRestfulSourceMethod g).getACall() }
32+
33+
override string getSourceType() { result = "HTTP request" }
3234
}
3335

3436
/**
@@ -42,5 +44,7 @@ private module GoRestfulHttp {
4244
this = FunctionOutput::parameter(0).getExitNode(call)
4345
)
4446
}
47+
48+
override string getSourceType() { result = "HTTP request body" }
4549
}
4650
}

0 commit comments

Comments
 (0)