-
Notifications
You must be signed in to change notification settings - Fork 2k
Expand file tree
/
Copy pathGoKit.qll
More file actions
42 lines (36 loc) · 1.5 KB
/
GoKit.qll
File metadata and controls
42 lines (36 loc) · 1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/**
* Provides classes for working with concepts relating to the [github.com/go-kit/kit](https://pkg.go.dev/github.com/go-kit/kit) package.
*/
import go
/**
* Provides classes for working with concepts relating to the [github.com/go-kit/kit](https://pkg.go.dev/github.com/go-kit/kit) package.
*/
module GoKit {
/** Gets the package name. */
string packagePath() { result = package("github.com/go-kit/kit", "") }
/**
* Provides classes for working with concepts relating to the `endpoint` package of the
* [github.com/go-kit/kit](https://pkg.go.dev/github.com/go-kit/kit) package.
*/
module Endpoint {
/** Gets the package name. */
string endpointPackagePath() { result = package("github.com/go-kit/kit", "endpoint") }
// gets a function that returns an endpoint
private DataFlow::Node getAnEndpointFactoryResult() {
exists(Function mkFn, FunctionOutput res |
mkFn.getResultType(0).hasQualifiedName(endpointPackagePath(), "Endpoint") and
result = res.getEntryNode(mkFn.getFuncDecl()).getAPredecessor*()
)
}
private FuncDef getAnEndpointFunction() {
exists(Function endpointFn | endpointFn.getFuncDecl() = result |
endpointFn.getARead() = getAnEndpointFactoryResult()
)
or
DataFlow::exprNode(result.(FuncLit)) = getAnEndpointFactoryResult()
}
private class EndpointRequest extends RemoteFlowSource::Range {
EndpointRequest() { this = DataFlow::parameterNode(getAnEndpointFunction().getParameter(1)) }
}
}
}