File tree Expand file tree Collapse file tree 2 files changed +7
-4
lines changed
test/experimental/CWE-942 Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ module GinCors {
1212 string packagePath ( ) { result = package ( "github.com/gin-contrib/cors" , "" ) }
1313
1414 /**
15- * New function create a new gin Handler that passed to gin as middleware
15+ * A new function create a new gin Handler that passed to gin as middleware
1616 */
1717 class New extends Function {
1818 New ( ) { exists ( Function f | f .hasQualifiedName ( packagePath ( ) , "New" ) | this = f ) }
@@ -107,6 +107,9 @@ module GinCors {
107107 exists ( Type t | t .hasQualifiedName ( packagePath ( ) , "Config" ) | v .getType ( ) = t )
108108 }
109109
110+ /**
111+ * Get variable declaration of GinConfig
112+ */
110113 SsaWithFields getV ( ) { result = v }
111114 }
112115}
Original file line number Diff line number Diff line change @@ -191,9 +191,9 @@ func main() {
191191 // })
192192 http .HandleFunc ("/" , func (w http.ResponseWriter , req * http.Request ) {
193193 // OK-ish: the input origin header is validated against a whitelist.
194- if origin := req .Header .Get ("Origin" ); cors [origin ] {
194+ if origin := req .Header .Get ("Origin" ); cors_map [origin ] {
195195 w .Header ().Set ("Access-Control-Allow-Origin" , origin )
196- } else if len (origin ) > 0 && cors ["*" ] {
196+ } else if len (origin ) > 0 && cors_map ["*" ] {
197197 w .Header ().Set ("Access-Control-Allow-Origin" , origin )
198198 }
199199
@@ -219,7 +219,7 @@ func main() {
219219}
220220
221221var (
222- cors = map [string ]bool {"*" : true }
222+ cors_map = map [string ]bool {"*" : true }
223223)
224224
225225func GetAllowOrigin () []string {
You can’t perform that action at this time.
0 commit comments