Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
exports.route = function (settings) {
if (!settings) {
return null;
}
const security = Hoek.applyToDefaults(Defaults.security, settings);
if (security.hsts) {
if (security.hsts === true) {
security._hsts = 'max-age=15768000';
}
else if (typeof security.hsts === 'number') {
security._hsts = 'max-age=' + security.hsts;
}
else {
security._hsts = 'max-age=' + (security.hsts.maxAge || 15768000);
if (security.hsts.includeSubdomains || security.hsts.includeSubDomains) {
security._hsts = security._hsts + '; includeSubDomains';
}
if (security.hsts.preload) {
security._hsts = security._hsts + '; preload';
}
}