You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+77Lines changed: 77 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -61,6 +61,9 @@ Options:
61
61
#### Model Details
62
62
* [Models](#models)
63
63
* [Notes on Schemas](#notes-on-schemas)
64
+
#### Response Headers
65
+
* [CORS](#cors)
66
+
* [OWASP Secure Headers](#owasp)
64
67
65
68
### OpenAPI Mapping
66
69
@@ -729,6 +732,80 @@ You can automatically generate CORS response headers by setting `cors` at the fu
729
732
730
733
The generator will interpret your settings for CORS and automatically add the response headers. If for whatever reason you wish to override these, you can set them via the above `responseHeaders` setting and it'll apply your overrides.
731
734
735
+
##### OWASP
736
+
737
+
You can make use of the [OWASP Secure Headers](https://owasp.org/www-project-secure-headers/#x-permitted-cross-domain-policies) to generate response headers. These are a selection of response headers with default values that OWASP recommends returning with your response to help secure your application.
738
+
739
+
The OWASP Secure Headers Project contains a set of recommended headers to return with recommended values, when generating the documentation, the generator will attempt to get the latest version of this document and apply the latest recommendations. If you do not allow outside connections, it will default to a version of recommendations from **2023-05-26 12:22:30 UTC**.
740
+
741
+
Like CORS, if you have already set any of the OWASP Secure headers via `responseHeaders`, it will not overwrite them.
742
+
743
+
To make use of OWASP Secure Headers, you can use the following:
744
+
745
+
###### All OWASP Secure Headers
746
+
747
+
```yml
748
+
methodResponse:
749
+
- statusCode: 200
750
+
responseBody:
751
+
description: Success
752
+
responseModels:
753
+
application/json: "CreateResponse"
754
+
owasp: true
755
+
```
756
+
757
+
This will use the full set of OWASP Secure Headers and their recommended values. Some of these might not be appropriate for your application.
758
+
759
+
###### Subset of OWASP Secure Headers
760
+
761
+
```yml
762
+
methodResponse:
763
+
- statusCode: 200
764
+
responseBody:
765
+
description: Success
766
+
responseModels:
767
+
application/json: "CreateResponse"
768
+
owasp:
769
+
cacheControl: true
770
+
referrerPolicy: true
771
+
```
772
+
773
+
This will set only the `cacheControl` and `referrerPolicy` response header with the default recommendations.
774
+
775
+
The full list of OWASP Secure Headers you can set are:
0 commit comments