diff --git a/types/helmet/helmet-tests.ts b/types/helmet/helmet-tests.ts index 1968c8f848..38fa53828f 100644 --- a/types/helmet/helmet-tests.ts +++ b/types/helmet/helmet-tests.ts @@ -190,6 +190,13 @@ function noSniffTest() { app.use(helmet.noSniff()); } +/** + * @summary Test for {@see helmet#referrerPolicy} function. + */ +function referrerPolicyTest() { + app.use(helmet.referrerPolicy({ policy: 'same-origin' })) +} + /** * @summary Test for {@see helmet#xssFilter} function. */ diff --git a/types/helmet/index.d.ts b/types/helmet/index.d.ts index 1dc8882608..ee37b7d298 100644 --- a/types/helmet/index.d.ts +++ b/types/helmet/index.d.ts @@ -88,6 +88,10 @@ declare namespace helmet { force?: boolean; } + export interface IHelmetReferrerPolicyConfiguration { + policy?: string; + } + export interface IHelmetXssFilterConfiguration { setOnOldIE?: boolean; } @@ -163,6 +167,12 @@ declare namespace helmet { */ noSniff(): express.RequestHandler; + /** + * @summary Adds the "Referrer-Policy" header. + * @return {RequestHandler} The Request handler. + */ + referrerPolicy(options?: IHelmetReferrerPolicyConfiguration): express.RequestHandler; + /** * @summary Mitigate cross-site scripting attacks with the "X-XSS-Protection" header. * @param {IHelmetXssFilterConfiguration} options The options