Skip to content

Commit 6e32c62

Browse files
committed
Update security headers
1 parent 29d0ccb commit 6e32c62

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

server/SecurityHeadersDefinitions.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,17 @@
22

33
public static class SecurityHeadersDefinitions
44
{
5+
private static HeaderPolicyCollection? policy;
6+
57
public static HeaderPolicyCollection GetHeaderPolicyCollection(bool isDev, string? idpHost)
68
{
79
ArgumentNullException.ThrowIfNull(idpHost);
810

9-
var policy = new HeaderPolicyCollection()
11+
// Avoid building a new HeaderPolicyCollection on every request for performance reasons.
12+
// Where possible, cache and reuse HeaderPolicyCollection instances.
13+
if (policy != null) return policy;
14+
15+
policy = new HeaderPolicyCollection()
1016
.AddFrameOptionsDeny()
1117
.AddContentTypeOptionsNoSniff()
1218
.AddReferrerPolicyStrictOriginWhenCrossOrigin()

ui/.vscode/settings.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,9 @@
1919
"editor.defaultFormatter": "esbenp.prettier-vscode"
2020
},
2121
"editor.codeActionsOnSave": {
22-
"source.organizeImports": true,
23-
"source.fixAll.eslint": true
22+
"source.organizeImports": "explicit",
23+
"source.fixAll.eslint": "explicit"
2424
},
2525
"editor.formatOnSave": true,
26-
"editor.formatOnPaste": true,
27-
26+
"editor.formatOnPaste": true
2827
}

0 commit comments

Comments
 (0)