Revert "internal/cmd/config: allow explicit origin list w/implicit CORS toggle (#1247)" (#1248)

This reverts commit 579fc621ec.
This commit is contained in:
Jeff Mitchell authored and GitHub committed 2021-05-20 21:06:38 -04:00
1 parent 579fc621ec
commit 13545e3171
3 files changed
+1 -37

No files matched your search

-8
View File
@@ -4,14 +4,6 @@ Canonical reference for changes, improvements, and bugfixes for Boundary.
## Next
### Bug Fixes
* You can now omit `cors_enabled` to use its implicit setting of `true` when
specifying `cors_allowed_origins`. Previously, omitting `cors_enabled` would
cause an explicit `cors_allowed_origins` to be ignored, resetting this value
to the desktop origin only.
[PR](https://github.com/hashicorp/boundary/pull/1247)
## 0.2.2 (2021/05/17)
### New and Improved
+1 -1
View File
@@ -345,8 +345,8 @@ func Parse(d string) (*Config, error) {
if listener.CorsEnabled == nil {
listener.CorsEnabled = new(bool)
*listener.CorsEnabled = true
listener.CorsAllowedOrigins = []string{desktopCorsOrigin}
}
// If not the wildcard and they haven't disabled us auto-adding
// origin values, add the desktop client origin
if *listener.CorsEnabled &&
-28
View File
@@ -116,34 +116,6 @@ func TestDevController(t *testing.T) {
assert.Equal(t, []string{"*"}, l0.CorsAllowedOrigins)
assert.Nil(t, l0.CorsDisableDefaultAllowedOriginValues)
// Implicitly with explicit wildcard
conf = `
listener "tcp" {
purpose = "api"
cors_allowed_origins = ["*"]
}
`
actual, err = Parse(conf)
assert.NoError(t, err)
l0 = actual.Listeners[0]
assert.True(t, *l0.CorsEnabled)
assert.Equal(t, []string{"*"}, l0.CorsAllowedOrigins)
assert.Nil(t, l0.CorsDisableDefaultAllowedOriginValues)
// Implicitly with explicit non-wildcard
conf = `
listener "tcp" {
purpose = "api"
cors_allowed_origins = ["foobar"]
}
`
actual, err = Parse(conf)
assert.NoError(t, err)
l0 = actual.Listeners[0]
assert.True(t, *l0.CorsEnabled)
assert.Equal(t, []string{"foobar", desktopCorsOrigin}, l0.CorsAllowedOrigins)
assert.Nil(t, l0.CorsDisableDefaultAllowedOriginValues)
// Disabled, default behavior
conf = `
listener "tcp" {