Skip to content

Commit

Permalink
Update security headers
Browse files Browse the repository at this point in the history
  • Loading branch information
damienbod committed Oct 17, 2024
1 parent 29d0ccb commit 6e32c62
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
8 changes: 7 additions & 1 deletion server/SecurityHeadersDefinitions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,17 @@

public static class SecurityHeadersDefinitions
{
private static HeaderPolicyCollection? policy;

public static HeaderPolicyCollection GetHeaderPolicyCollection(bool isDev, string? idpHost)
{
ArgumentNullException.ThrowIfNull(idpHost);

var policy = new HeaderPolicyCollection()
// Avoid building a new HeaderPolicyCollection on every request for performance reasons.
// Where possible, cache and reuse HeaderPolicyCollection instances.
if (policy != null) return policy;

policy = new HeaderPolicyCollection()
.AddFrameOptionsDeny()
.AddContentTypeOptionsNoSniff()
.AddReferrerPolicyStrictOriginWhenCrossOrigin()
Expand Down
7 changes: 3 additions & 4 deletions ui/.vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,9 @@
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"editor.codeActionsOnSave": {
"source.organizeImports": true,
"source.fixAll.eslint": true
"source.organizeImports": "explicit",
"source.fixAll.eslint": "explicit"
},
"editor.formatOnSave": true,
"editor.formatOnPaste": true,

"editor.formatOnPaste": true
}

0 comments on commit 6e32c62

Please sign in to comment.