Skip to content

Commit 0aa3116

Browse files
committed
Fix wrong maxAgeSeconds multiplication
It seems like the inital work on the hsts module expected milliseconds. This has either changed or was never true. Either way, it caused that the current defaults resulted in theory in a 1000 year HSTS policy. Luckily helmet was smart enough to not go higher than 1 year. Anyway, this patch fixes the multiplication of the configured size with 1000 by removing this multiplication. Also to simplify the reading of the defaults, we split them into their components, 60 times 60 seconds so we get one hour. 24 of those hours so we get a day and finally 365 days to get our original wanted default of one year. Reference: d69d65e Signed-off-by: Sheogorath <sheogorath@shivering-isles.com>
1 parent 271dff3 commit 0aa3116

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

app.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ app.use(compression())
8383
// use hsts to tell https users stick to this
8484
if (config.hsts.enable) {
8585
app.use(helmet.hsts({
86-
maxAge: config.hsts.maxAgeSeconds * 1000,
86+
maxAge: config.hsts.maxAgeSeconds,
8787
includeSubdomains: config.hsts.includeSubdomains,
8888
preload: config.hsts.preload
8989
}))

lib/config/default.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ module.exports = {
1313
useSSL: false,
1414
hsts: {
1515
enable: true,
16-
maxAgeSeconds: 31536000,
16+
maxAgeSeconds: 60 * 60 * 24 * 365,
1717
includeSubdomains: true,
1818
preload: true
1919
},

0 commit comments

Comments
 (0)