Skip to content

Commit 7145046

Browse files
committed
Add referrer policy
This commit adds a referrer policy to all requests. The usage of `same-origin` allows HackMD to still interpret all requests and this way not break anything. But it prevents 3rd party scripts, pictures and more to get informations that may lead to not secured note. It has to be mentioned that this maybe breaks some features of the Google Analytics embedding. This has to be tested. Fixes #724 Signed-off-by: Sheogorath <sheogorath@shivering-isles.com>
1 parent bb5e021 commit 7145046

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

app.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,13 @@ if (config.hsts.enable) {
110110
logger.info('https://en.wikipedia.org/wiki/HTTP_Strict_Transport_Security')
111111
}
112112

113+
// Add referrer policy to improve privacy
114+
app.use(
115+
helmet.referrerPolicy({
116+
policy: 'same-origin'
117+
})
118+
)
119+
113120
// Generate a random nonce per request, for CSP with inline scripts
114121
app.use(csp.addNonceToLocals)
115122

0 commit comments

Comments
 (0)