mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
lusca: support new csrf options: blacklist and whitelist for 1.6 (#36024)
This commit is contained in:
parent
e584cee6c9
commit
b3cf16f4e0
28
types/lusca/index.d.ts
vendored
28
types/lusca/index.d.ts
vendored
@ -1,6 +1,6 @@
|
||||
// Type definitions for lusca 1.5
|
||||
// Type definitions for lusca 1.6
|
||||
// Project: https://github.com/krakenjs/lusca#readme
|
||||
// Definitions by: Corbin Crutchley <https://github.com/crutchcorn>
|
||||
// Definitions by: Corbin Crutchley <https://github.com/crutchcorn>, Naoto Yokoyama <https://github.com/builtinnya>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
@ -37,12 +37,15 @@ declare namespace lusca {
|
||||
preload?: boolean;
|
||||
}
|
||||
|
||||
type csrfOptions = csrfOptionsAngular | csrfOptionsNonAngular;
|
||||
type csrfOptions = csrfOptionsBase & csrfOptionsAngularOrNonAngular & csrfOptionsBlacklistOrWhitelist;
|
||||
|
||||
interface csrfOptionsAngular {
|
||||
interface csrfOptionsBase {
|
||||
key?: string;
|
||||
secret?: string;
|
||||
impl?: () => any;
|
||||
}
|
||||
|
||||
interface csrfOptionsAngular {
|
||||
cookie?: string | {
|
||||
options?: object;
|
||||
};
|
||||
@ -50,9 +53,6 @@ declare namespace lusca {
|
||||
}
|
||||
|
||||
interface csrfOptionsNonAngular {
|
||||
key?: string;
|
||||
secret?: string;
|
||||
impl?: () => any;
|
||||
cookie?: string | {
|
||||
name: string;
|
||||
options?: object;
|
||||
@ -60,6 +60,20 @@ declare namespace lusca {
|
||||
angular?: false;
|
||||
}
|
||||
|
||||
type csrfOptionsAngularOrNonAngular = csrfOptionsAngular | csrfOptionsNonAngular;
|
||||
|
||||
interface csrfOptionsBlacklist {
|
||||
blacklist?: string[];
|
||||
whitelist?: never;
|
||||
}
|
||||
|
||||
interface csrfOptionsWhitelist {
|
||||
blacklist?: never;
|
||||
whitelist?: string[];
|
||||
}
|
||||
|
||||
type csrfOptionsBlacklistOrWhitelist = csrfOptionsBlacklist | csrfOptionsWhitelist;
|
||||
|
||||
interface xssProtectionOptions {
|
||||
enabled?: boolean;
|
||||
mode?: string;
|
||||
|
||||
@ -15,6 +15,10 @@ app.use(lusca({
|
||||
}));
|
||||
|
||||
app.use(lusca.csrf());
|
||||
app.use(lusca.csrf({cookie: {name: 'csrf'}}));
|
||||
app.use(lusca.csrf({cookie: 'csrf', angular: true}));
|
||||
app.use(lusca.csrf({blacklist: ['/blacklist']}));
|
||||
app.use(lusca.csrf({whitelist: ['/whitelist']}));
|
||||
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'));
|
||||
|
||||
Loading…
Reference in New Issue
Block a user