Socket
Socket
Sign inDemoInstall

express-secure-handlebars

Package Overview
Dependencies
193
Maintainers
5
Versions
15
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.0.3 to 2.0.4

6

package.json
{
"name": "express-secure-handlebars",
"version": "2.0.3",
"version": "2.0.4",
"licenses": [

@@ -41,4 +41,4 @@ {

"handlebars": "^3.0.3",
"secure-handlebars": "^1.1.0",
"xss-filters": "^1.2.2"
"secure-handlebars": "^1.1.1",
"xss-filters": "^1.2.4"
},

@@ -45,0 +45,0 @@ "devDependencies": {

@@ -28,2 +28,11 @@ /*

/* override ExpressHandlebars.render() to expose filePath as compilerOptions */
ExpressSecureHandlebars.prototype.render = function (filePath, context, options) {
// expose filePath as processingFile in compilerOptions for secure-handlebars
this.compilerOptions || (this.compilerOptions = {});
this.compilerOptions.processingFile = filePath;
return expressHandlebars.prototype.render.call(this, filePath, context, options);
};
/* exporting the same signature of express-handlebars */

@@ -30,0 +39,0 @@ exports = module.exports = exphbs;

@@ -14,2 +14,3 @@ /*

var expect = require('expect.js'),
path = require('path'),
expressHandlebars = require('express-handlebars'),

@@ -75,3 +76,3 @@ expressSecureHandlebars = require('../../src/express-secure-handlebars.js'),

it("handlebars compile test", function() {
it("handlebars compile test", function() {
var template = '<a href="{{url}}">closed</a>';

@@ -83,4 +84,13 @@ var t1 = expressSecureHandlebars.create().handlebars.compile(template);

});
it("handlebars getTemplate test", function() {
var templateFile = path.resolve("views/yd.hbs");
var expSecureHbs = expressSecureHandlebars.create();
expSecureHbs.render(templateFile);
expect(expSecureHbs.compilerOptions).to.be.ok();
expect(expSecureHbs.compilerOptions.processingFile).to.be.ok();
expect(expSecureHbs.compilerOptions.processingFile).to.be.match(/yd\.hbs/);
});
});
}());
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc