From 9bb9e1b3d3f7c62d1694fddbfe7f9c8b58654053 Mon Sep 17 00:00:00 2001 From: Corbin Date: Sun, 19 Nov 2017 20:58:25 -0800 Subject: [PATCH] [lusca] Fix tests and linting --- types/lusca/index.d.ts | 7 ++++--- types/lusca/lusca-tests.ts | 4 ++-- types/lusca/tsconfig.json | 1 + 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/types/lusca/index.d.ts b/types/lusca/index.d.ts index c85e2d9d66..8527ef3411 100644 --- a/types/lusca/index.d.ts +++ b/types/lusca/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/krakenjs/lusca#readme // Definitions by: Corbin Crutchley // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 import express = require('express'); @@ -17,13 +18,13 @@ declare namespace lusca { xframe?: string | false; p3p?: string | false; hsts?: hstsOptions | false; - xssProtection?: boolean; + xssProtection?: xssProtectionOptions | boolean; nosniff?: boolean; referrerPolicy?: string | false; } interface cspOptions { - policy?: string | object | (object | string)[]; + policy?: string | object | Array; reportOnly?: boolean; reportUri?: string; styleNonce?: boolean; @@ -69,7 +70,7 @@ declare namespace lusca { function xframe(value: string): express.RequestHandler; function p3p(value: string): express.RequestHandler; function hsts(options?: hstsOptions): express.RequestHandler; - function xssProtection(options?: xssProtectionOptions): express.RequestHandler; + function xssProtection(options?: xssProtectionOptions | true): express.RequestHandler; function nosniff(): express.RequestHandler; function referrerPolicy(value: string): express.RequestHandler; } diff --git a/types/lusca/lusca-tests.ts b/types/lusca/lusca-tests.ts index 5d267c0a95..8a74ec5e8a 100644 --- a/types/lusca/lusca-tests.ts +++ b/types/lusca/lusca-tests.ts @@ -13,9 +13,9 @@ app.use(lusca({ nosniff: true, referrerPolicy: 'same-origin' })); + app.use(lusca.csrf()); -app.use(lusca.csp({policy: [{ "img-src": "'self' http:" }, "block-all-mixed-content"] - , reportOnly: false})); +app.use(lusca.csp({policy: [{ "img-src": "'self' http:" }, "block-all-mixed-content"], reportOnly: false})); app.use(lusca.xframe('SAMEORIGIN')); app.use(lusca.p3p('ABCDEF')); app.use(lusca.hsts({ maxAge: 31536000 })); diff --git a/types/lusca/tsconfig.json b/types/lusca/tsconfig.json index 656795435c..ede7926c1c 100644 --- a/types/lusca/tsconfig.json +++ b/types/lusca/tsconfig.json @@ -7,6 +7,7 @@ "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, + "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ "../"