Skip to content

Commit 849361c

Browse files
Add modeling for gin
1 parent 779768d commit 849361c

File tree

1 file changed

+24
-0
lines changed
  • go/ql/lib/semmle/go/frameworks

1 file changed

+24
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/**
2+
* Provides classes for modeling the `github.com/gin-gonic/gin` package.
3+
*/
4+
5+
import go
6+
import semmle.go.concepts.HTTP
7+
8+
/** Provides models for the `gin-gonic/gin` package. */
9+
module Gin {
10+
/** Gets the package name `github.com/gin-gonic/gin`. */
11+
string packagePath() { result = package("github.com/gin-gonic/gin", "") }
12+
13+
private class GinCookieWrite extends Http::CookieWrite::Range, DataFlow::MethodCallNode {
14+
GinCookieWrite() { this.getTarget().hasQualifiedName(packagePath(), "Context", "SetCookie") }
15+
16+
override DataFlow::Node getName() { result = this.getArgument(0) }
17+
18+
override DataFlow::Node getValue() { result = this.getArgument(1) }
19+
20+
override DataFlow::Node getSecure() { result = this.getArgument(5) }
21+
22+
override DataFlow::Node getHttpOnly() { result = this.getArgument(6) }
23+
}
24+
}

0 commit comments

Comments
 (0)