UNPKG

@adonisjs/shield

Version:

A middleware for AdonisJS to keep web applications secure from common web attacks

19 lines (18 loc) 562 B
import { noop } from '../../noop.ts'; import type { CspOptions } from '../../types.ts'; /** * Factory that returns a function to set the `Content-Security-Policy` header based upon * the user configuration. Provides protection against XSS and code injection attacks. * * @param options - CSP configuration options * * @example * const cspGuard = cspFactory({ * enabled: true, * directives: { * defaultSrc: ["'self'"], * scriptSrc: ["'self'", '@nonce'] * } * }) */ export declare function cspFactory(options: CspOptions): typeof noop;