@@ -14,12 +14,12 @@ import (
14
14
func vunlnerable () {
15
15
router := gin .Default ()
16
16
// CORS for https://foo.com and null
17
- // - GET and POST methods
17
+ // - PUT and PATCH methods
18
18
// - Origin header
19
19
// - Credentials share
20
20
// - Preflight requests cached for 12 hours
21
21
config_vulnerable := cors.Config {
22
- AllowMethods : []string {"GET " , "POST " },
22
+ AllowMethods : []string {"PUT " , "PATCH " },
23
23
AllowHeaders : []string {"Origin" },
24
24
ExposeHeaders : []string {"Content-Length" },
25
25
AllowCredentials : true ,
@@ -39,12 +39,12 @@ func vunlnerable() {
39
39
func safe () {
40
40
router := gin .Default ()
41
41
// CORS for https://foo.com origin, allowing:
42
- // - GET and POST methods
42
+ // - PUT and PATCH methods
43
43
// - Origin header
44
44
// - Credentials share
45
45
// - Preflight requests cached for 12 hours
46
46
config_safe := cors.Config {
47
- AllowMethods : []string {"GET " , "POST " },
47
+ AllowMethods : []string {"PUT " , "PATCH " },
48
48
AllowHeaders : []string {"Origin" },
49
49
ExposeHeaders : []string {"Content-Length" },
50
50
AllowCredentials : true ,
@@ -63,13 +63,13 @@ func safe() {
63
63
*/
64
64
func AllowAllTrue () {
65
65
router := gin .Default ()
66
- // CORS for https://foo.com origin, allowing:
66
+ // CORS for "*" origin, allowing:
67
67
// - PUT and PATCH methods
68
68
// - Origin header
69
69
// - Credentials share
70
70
// - Preflight requests cached for 12 hours
71
71
config_allowall := cors.Config {
72
- AllowMethods : []string {"GET " , "POST " },
72
+ AllowMethods : []string {"PUT " , "PATCH " },
73
73
AllowHeaders : []string {"Origin" },
74
74
ExposeHeaders : []string {"Content-Length" },
75
75
AllowCredentials : true ,
0 commit comments