Skip to content

Commit d86868d

Browse files
authored
fix(core): add obligations X-Rewrap-Additional-Context to default CORS allowed headers (#2901)
### Proposed Changes * This header is required for obligations and should be defaulted. * Updates all example yamls with full list of default allowed headers. * DSPX-1938
1 parent dd6256e commit d86868d

File tree

7 files changed

+37
-12
lines changed

7 files changed

+37
-12
lines changed

opentdf-core-mode.yaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,16 @@ server:
3838
- OPTIONS
3939
# List of headers that are allowed in a request
4040
allowedheaders:
41-
- ACCEPT
41+
- Accept
42+
- Accept-Encoding
4243
- Authorization
4344
- Connect-Protocol-Version
45+
- Content-Length
4446
- Content-Type
47+
- Dpop
4548
- X-CSRF-Token
49+
- X-Requested-With
50+
- X-Rewrap-Additional-Context
4651
# List of response headers that browsers are allowed to access
4752
exposedheaders:
4853
- Link

opentdf-dev.yaml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,12 +134,16 @@ server:
134134
- OPTIONS
135135
# List of headers that are allowed in a request
136136
allowedheaders:
137-
- ACCEPT
137+
- Accept
138+
- Accept-Encoding
138139
- Authorization
139140
- Connect-Protocol-Version
141+
- Content-Length
140142
- Content-Type
143+
- Dpop
141144
- X-CSRF-Token
142-
- X-Request-ID
145+
- X-Requested-With
146+
- X-Rewrap-Additional-Context
143147
# List of response headers that browsers are allowed to access
144148
exposedheaders:
145149
- Link

opentdf-ers-mode.yaml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,16 @@ server:
7575
- OPTIONS
7676
# List of headers that are allowed in a request
7777
allowedheaders:
78-
- ACCEPT
78+
- Accept
79+
- Accept-Encoding
7980
- Authorization
8081
- Connect-Protocol-Version
82+
- Content-Length
8183
- Content-Type
84+
- Dpop
8285
- X-CSRF-Token
83-
- X-Request-ID
86+
- X-Requested-With
87+
- X-Rewrap-Additional-Context
8488
# List of response headers that browsers are allowed to access
8589
exposedheaders:
8690
- Link

opentdf-example.yaml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,16 @@ server:
9292
- OPTIONS
9393
# List of headers that are allowed in a request
9494
allowedheaders:
95-
- ACCEPT
95+
- Accept
96+
- Accept-Encoding
9697
- Authorization
9798
- Connect-Protocol-Version
99+
- Content-Length
98100
- Content-Type
101+
- Dpop
99102
- X-CSRF-Token
100-
- X-Request-ID
103+
- X-Requested-With
104+
- X-Rewrap-Additional-Context
101105
# List of response headers that browsers are allowed to access
102106
exposedheaders:
103107
- Link

opentdf-kas-mode.yaml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,16 @@ server:
8888
- OPTIONS
8989
# List of headers that are allowed in a request
9090
allowedheaders:
91-
- ACCEPT
91+
- Accept
92+
- Accept-Encoding
9293
- Authorization
9394
- Connect-Protocol-Version
95+
- Content-Length
9496
- Content-Type
97+
- Dpop
9598
- X-CSRF-Token
96-
- X-Request-ID
99+
- X-Requested-With
100+
- X-Rewrap-Additional-Context
97101
# List of response headers that browsers are allowed to access
98102
exposedheaders:
99103
- Link

service/internal/server/server.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ type CORSConfig struct {
124124
Enabled bool `mapstructure:"enabled" json:"enabled" default:"true"`
125125
AllowedOrigins []string `mapstructure:"allowedorigins" json:"allowedorigins"`
126126
AllowedMethods []string `mapstructure:"allowedmethods" json:"allowedmethods" default:"[\"GET\",\"POST\",\"PATCH\",\"DELETE\",\"OPTIONS\"]"`
127-
AllowedHeaders []string `mapstructure:"allowedheaders" json:"allowedheaders" default:"[\"Accept\",\"Content-Type\",\"Content-Length\",\"Accept-Encoding\",\"X-CSRF-Token\",\"Authorization\",\"X-Requested-With\",\"Dpop\",\"Connect-Protocol-Version\"]"`
127+
AllowedHeaders []string `mapstructure:"allowedheaders" json:"allowedheaders" default:"[\"Accept\",\"Accept-Encoding\",\"Authorization\",\"Connect-Protocol-Version\",\"Content-Length\",\"Content-Type\",\"Dpop\",\"X-CSRF-Token\",\"X-Requested-With\",\"X-Rewrap-Additional-Context\"]"`
128128
ExposedHeaders []string `mapstructure:"exposedheaders" json:"exposedheaders"`
129129
AllowCredentials bool `mapstructure:"allowcredentials" json:"allowcredentials" default:"true"`
130130
MaxAge int `mapstructure:"maxage" json:"maxage" default:"3600"`

service/pkg/server/testdata/all-no-config.yaml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,16 @@ server:
8181
- OPTIONS
8282
# List of headers that are allowed in a request
8383
allowedheaders:
84-
- ACCEPT
84+
- Accept
85+
- Accept-Encoding
8586
- Authorization
8687
- Connect-Protocol-Version
88+
- Content-Length
8789
- Content-Type
90+
- Dpop
8891
- X-CSRF-Token
89-
- X-Request-ID
92+
- X-Requested-With
93+
- X-Rewrap-Additional-Context
9094
# List of response headers that browsers are allowed to access
9195
exposedheaders:
9296
- Link

0 commit comments

Comments
 (0)