Skip to content

Commit

Permalink
fix: check prototype property access in strict-mode (#1736)
Browse files Browse the repository at this point in the history
  • Loading branch information
nknapp committed Feb 13, 2021
1 parent f058970 commit b6d3de7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/handlebars/runtime.js
Expand Up @@ -124,7 +124,7 @@ export function template(templateSpec, env) {
loc: loc
});
}
return obj[name];
return container.lookupProperty(obj, name);
},
lookupProperty: function(parent, propertyName) {
let result = parent[propertyName];
Expand Down
4 changes: 4 additions & 0 deletions spec/security.js
Expand Up @@ -298,6 +298,10 @@ describe('security issues', function() {
checkProtoPropertyAccess({ compat: true });
});

describe('in strict-mode', function() {
checkProtoPropertyAccess({ strict: true });
});

function checkProtoPropertyAccess(compileOptions) {
it('should be prohibited by default and log a warning', function() {
var spy = sinon.spy(console, 'error');
Expand Down

0 comments on commit b6d3de7

Please sign in to comment.