helmet
This extension is based on express.js' helmet.
import cheetah from 'https://deno.land/x/cheetah/mod.ts'
import { helmet } from 'https://deno.land/x/cheetah/ext/helmet.ts'
const app = new cheetah()
.use(helmet())
Configuration
contentSecurityPolicySet the Content-Security-Policy header with a strict security policy.
// default behavior: (enabled) helmet({ contentSecurityPolicy: true })crossOriginEmbedderPolicySet the Cross-Origin-Embedder-Policy header.
helmet({ crossOriginEmbedderPolicy: null // not set by default })crossOriginOpenerPolicySet the Cross-Origin-Opener-Policy header.
helmet({ contentSecurityPolicy: 'same-origin' // set to 'same-origin' by default })crossOriginResourcePolicySet the Cross-Origin-Resource-Policy header.
helmet({ crossOriginResourcePolicy: 'same-origin' // set to 'same-origin' by default })dnsPrefetchingEnable DNS Prefetching at the expense of your users' privacy.
helmet({ dnsPrefetching: false // disabled by default })noFramingSet the X-Frame-Options header to mitigate Clickjacking.
helmet({ noFraming: 'sameorigin' // set to 'sameorigin' by default })hstsSet the Strict-Transport-Security header, which indicates to browsers to prefer a secure HTTPS connection.
helmet({ contentSecurityPolicy: { // set with these options by default maxAge: 31536000, // a year includeSubDomains: true } })noSniffingSet the X-Content-Type-Options header to
nosniff. This mitigates Content Sniffing, which can cause security vulnerabilities.helmet({ noSniffing: true // enabled by default })originAgentClusterSet the Origin-Agent-Cluster header, which provides a mechanism to allow web applications to isolate their origins.
helmet({ originAgentCluster: true // enabled by default })crossDomainPolicySet the X-Permitted-Cross-Domain-Policies header, which tells some clients (mostly Adobe products) your domain's policy for loading cross-domain content.
helmet({ crossDomainPolicy: 'none' // set to 'none' by default })referrerPolicySet the Referrer-Policy header to control what information is set in the Referer header.
helmet({ referrerPolicy: 'no-referrer' // set to 'no-referrer' by default })