Fix bug causing CORS to accept all origins by default (#1134)
This commit is contained in:
1 parent
8332eb10c5
commit
7062bc70f0
3 files changed
+26
-3
No files matched your search
@@ -142,6 +142,13 @@ func TestHandler_CORS(t *testing.T) {
|
||||
code: http.StatusOK,
|
||||
listenerNum: 3,
|
||||
},
|
||||
{
|
||||
name: "enabled with allowed origins and desktop origin",
|
||||
method: http.MethodPost,
|
||||
origin: "serve://boundary",
|
||||
code: http.StatusOK,
|
||||
listenerNum: 3,
|
||||
},
|
||||
{
|
||||
name: "enabled with wildcard origins and no origin defined",
|
||||
method: http.MethodPost,
|
||||
|
||||
@@ -283,9 +283,7 @@ func wrapHandlerWithCors(h http.Handler, props HandlerProperties) http.Handler {
|
||||
case len(allowedOrigins) == 0:
|
||||
// not valid
|
||||
|
||||
case len(allowedOrigins) == 1 &&
|
||||
(allowedOrigins[0] == "*" ||
|
||||
allowedOrigins[0] == "serve://boundary"):
|
||||
case len(allowedOrigins) == 1 && allowedOrigins[0] == "*":
|
||||
valid = true
|
||||
|
||||
default:
|
||||
|
||||
Reference in new issue
Block a user