Improve Helmet's xssFilter options

Made two improvements here:

1. `xssFilter` takes an object with a certain interface, not just any
   `Object`.
2. Changed the `@summary` documentation.
This commit is contained in:
Evan Hahn
2016-04-02 14:37:55 -07:00
parent d969b903d1
commit 70262bcb3e
2 changed files with 9 additions and 3 deletions
+2
View File
@@ -17,6 +17,8 @@ function helmetTest() {
*/
function xssFilterTest() {
app.use(helmet.xssFilter());
app.use(helmet.xssFilter({}));
app.use(helmet.xssFilter({ setOnOldIE: false }));
app.use(helmet.xssFilter({ setOnOldIE: true }));
}
+7 -3
View File
@@ -24,7 +24,11 @@ declare module "helmet" {
disableAndroid? : boolean;
directives? : IHelmetCspDirectives
}
interface IHelmetXssFilterConfiguration {
setOnOldIE? : boolean;
}
/**
* @summary Interface for helmet class.
* @interface
@@ -82,11 +86,11 @@ declare module "helmet" {
publicKeyPins(options ?: Object):express.RequestHandler;
/**
* @summary Prevent Cross-site scripting attacks.
* @summary Mitigate cross-site scripting attacks with the "X-XSS-Protection" header.
* @return {RequestHandler} The Request handler.
* @param {Object} options The options.
*/
xssFilter(options ?: Object):express.RequestHandler;
xssFilter(options ?: IHelmetXssFilterConfiguration):express.RequestHandler;
/**
* @summary Set policy around third-party content via headers