Skip to content

Commit e9a5516

Browse files
committed
charts/nginz: fix fail-open behaviour in CORS configuration.
The previous commits adding CORS configuration set the access control header to unconditionally return the Origin header sent with the request. This would cause fail-open behaviour, where any Origin sent by a client would be allowed. Instead, the $cors_header variable is used, as this is specifically set based on the request Origin header so that only origins which are explicitly in the Helm chart's allow list configuration may make cross-origin requests to nginz API endpoints.
1 parent 7d8f07e commit e9a5516

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

charts/nginz/templates/conf/_nginx.conf.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ http {
295295
more_set_headers 'Access-Control-Allow-Credentials: true';
296296
{{ end -}}
297297

298-
more_set_headers 'Access-Control-Allow-Origin: $http_origin';
298+
more_set_headers 'Access-Control-Allow-Origin: $cors_header';
299299

300300
more_set_headers 'Access-Control-Expose-Headers: Request-Id, Location';
301301
more_set_headers 'Request-Id: $request_id';

0 commit comments

Comments
 (0)