mirror of
https://github.com/moda-gov-tw/tw-did.git
synced 2026-01-10 05:07:55 -05:00
chore: add comment for modifying
This commit is contained in:
@@ -27,8 +27,11 @@ import { IssuanceModule } from '../issuance/issuance.module';
|
||||
return [
|
||||
{
|
||||
rootPath: clientPath,
|
||||
// set some response headers to improve security of the static web
|
||||
serveStaticOptions: {
|
||||
setHeaders(res) {
|
||||
// apply Content Security Policy (CSP) to mitigate some types of attacks,
|
||||
// such as cross-site scripting (XSS) and packet sniffing attacks.
|
||||
const cspHeader = `
|
||||
default-src 'self';
|
||||
img-src 'self';
|
||||
@@ -44,11 +47,12 @@ import { IssuanceModule } from '../issuance/issuance.module';
|
||||
frame-src 'self';
|
||||
upgrade-insecure-requests;
|
||||
`.replace(/\s{2,}/g, " ").trim()
|
||||
|
||||
res.setHeader('Content-Security-Policy', cspHeader)
|
||||
// avoid click-jacking attacks
|
||||
res.setHeader('X-Frame-Options', 'DENY')
|
||||
// avoid MIME type sniffing
|
||||
res.setHeader('X-Content-Type-Options', 'nosniff')
|
||||
|
||||
// deny requesting code from any other origin to access resources of the web
|
||||
res.removeHeader('access-control-allow-origin')
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user