Skip to content

Commit

Permalink
[DJ] Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Gitar committed Sep 18, 2024
1 parent 7e012ac commit ce6ff9b
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -248,4 +248,4 @@
]
},
"packageManager": "[email protected]"
}
}
35 changes: 35 additions & 0 deletions src/lib/middleware/secure-headers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,41 @@ const secureHeaders: (config: IUnleashConfig) => RequestHandler = (config) => {
originAgentCluster: false,
xDnsPrefetchControl: false,
});
const apiHelmet = helmet({
hsts: {
maxAge: hoursToSeconds(24 * 365 * 2), // 2 non-leap years
includeSubDomains: true,
preload: true,
},
contentSecurityPolicy: {
directives: {
defaultSrc:
helmet.contentSecurityPolicy
.dangerouslyDisableDefaultSrc,
fontSrc: null,
styleSrc: null,
scriptSrc: null,
imgSrc: null,
connectSrc: null,
mediaSrc: null,
objectSrc: null,
frameSrc: null,
upgradeInsecureRequests: null,
scriptSrcAttr: null,
baseUri: null,
formAction: null,
frameAncestors: ["'none'"],
},
},

crossOriginEmbedderPolicy: false,
crossOriginResourcePolicy: false,
crossOriginOpenerPolicy: false,
originAgentCluster: false,
xXssProtection: false,
xDnsPrefetchControl: false,
xFrameOptions: { action: 'deny' },
});

return (req, res, next) => {
if (req.method === 'OPTIONS') {
Expand Down

0 comments on commit ce6ff9b

Please sign in to comment.