Skip to content

Commit c5faddc

Browse files
committed
remove fasthttp in favor or fasthttp framework
1 parent 9f9c9e0 commit c5faddc

File tree

1 file changed

+2
-38
lines changed

1 file changed

+2
-38
lines changed

go/ql/lib/semmle/go/security/FileSystemAccess.qll

Lines changed: 2 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,5 @@
11
import go
22

3-
/**
4-
* The File system access sinks of [fasthttp](https://github.com/valyala/fasthttp) web framework
5-
*/
6-
class FastHttpFileSystemAccess extends FileSystemAccess::Range, DataFlow::CallNode {
7-
int pathArg;
8-
9-
FastHttpFileSystemAccess() {
10-
exists(Method m |
11-
(
12-
m.hasQualifiedName(package("github.com/valyala/fasthttp", ""), "RequestCtx",
13-
["SendFileBytes", "SendFile"])
14-
or
15-
m.hasQualifiedName(package("github.com/valyala/fasthttp", ""), "Response", "SendFile")
16-
) and
17-
this = m.getACall() and
18-
pathArg = 0
19-
)
20-
or
21-
exists(Function f |
22-
f.hasQualifiedName(package("github.com/valyala/fasthttp", ""),
23-
[
24-
"ServeFile", "ServeFileUncompressed", "ServeFileBytes", "ServeFileBytesUncompressed",
25-
"SaveMultipartFile"
26-
]) and
27-
this = f.getACall() and
28-
pathArg = 1
29-
)
30-
}
31-
32-
override DataFlow::Node getAPathArgument() { result = this.getArgument(pathArg) }
33-
}
343

354
/**
365
* The File system access sinks of `net/http` package
@@ -158,12 +127,7 @@ class FiberSystemAccess extends FileSystemAccess::Range, DataFlow::CallNode {
158127
override DataFlow::Node getAPathArgument() { result = this.getArgument(pathArg) }
159128
}
160129

161-
predicate test(Function f) {
162-
f.hasQualifiedName("github.com/valyala/fasthttp",
163-
["WriteReader", "SafeWriteReader", "WriteFile", "ReadFile", "ReadDir"])
164-
165-
}
166-
string aferoPackage() { result = "github.com/valyala/fasthttp" }
130+
string aferoPackage() { result = "github.com/spf13/afero" }
167131

168132
/**
169133
* Provide File system access sinks of [afero](https://github.com/spf13/afero) filesystem framework
@@ -175,7 +139,7 @@ class AferoSystemAccess extends FileSystemAccess::Range, DataFlow::CallNode {
175139
AferoSystemAccess() {
176140
// utility functions
177141
exists(Function f |
178-
f.hasQualifiedName("github.com/valyala/fasthttp",
142+
f.hasQualifiedName(package(aferoPackage(), ""),
179143
["WriteReader", "SafeWriteReader", "WriteFile", "ReadFile", "ReadDir"]) and
180144
this = f.getACall() and
181145
pathArg = 1

0 commit comments

Comments
 (0)