Skip to content

Commit 6790c08

Browse files
committed
Merge branch '4.x'
# Conflicts: # components/bower.json # components/handlebars.js.nuspec # components/package.json # integration-testing/multi-nodejs-test/test.sh # package-lock.json # package.json
2 parents 2f509a8 + a9a8e40 commit 6790c08

File tree

7 files changed

+73
-21
lines changed

7 files changed

+73
-21
lines changed

Gruntfile.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -119,19 +119,19 @@ module.exports = function(grunt) {
119119
concurrency: 4,
120120
browsers: [
121121
{ browserName: 'chrome' },
122-
{ browserName: 'firefox', platform: 'Linux' },
122+
{ browserName: 'firefox', platform: 'Linux' }
123123
// {browserName: 'safari', version: 9, platform: 'OS X 10.11'},
124124
// {browserName: 'safari', version: 8, platform: 'OS X 10.10'},
125-
{
126-
browserName: 'internet explorer',
127-
version: 11,
128-
platform: 'Windows 8.1'
129-
},
130-
{
131-
browserName: 'internet explorer',
132-
version: 10,
133-
platform: 'Windows 8'
134-
}
125+
// {
126+
// browserName: 'internet explorer',
127+
// version: 11,
128+
// platform: 'Windows 8.1'
129+
// },
130+
// {
131+
// browserName: 'internet explorer',
132+
// version: 10,
133+
// platform: 'Windows 8'
134+
// }
135135
]
136136
}
137137
},

integration-testing/multi-nodejs-test/test.sh

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,20 @@ cd "$( dirname "$( readlink -f "$0" )" )" || exit 1
1212
# However, the built distribution should work with older NodeJS versions as well.
1313
# This test is simple by design. It merely ensures, that calling Handlebars does not fail with old versions.
1414
# It does (almost) not test for correctness, because that is already done in the mocha-tests.
15-
# And it does not use any NodeJS based testing framwork to make this part independent of the Node version.
15+
# And it does not use any NodeJS based testing framework to make this part independent of the Node version.
1616

1717
unset npm_config_prefix
1818

1919
echo "Handlebars should be able to run in various versions of NodeJS"
20-
for i in 10 11 12 13 ; do
20+
for node_version_to_test in 10 11 12 13 14 15; do
21+
2122
rm target node_modules package-lock.json -rf
2223
mkdir target
23-
nvm install "$i"
24-
nvm exec "$i" npm install
25-
nvm exec "$i" npm run test
26-
nvm exec "$i" npm run test-precompile
24+
25+
nvm install "$node_version_to_test"
26+
nvm exec "$node_version_to_test" npm install
27+
nvm exec "$node_version_to_test" npm run test
28+
nvm exec "$node_version_to_test" npm run test-precompile
2729

2830
echo Success
2931
done

lib/handlebars/base.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { registerDefaultDecorators } from './decorators';
55
import logger from './logger';
66
import { resetLoggedProperties } from './internal/proto-access';
77

8-
export const VERSION = '4.7.6';
8+
export const VERSION = '4.7.7';
99
export const COMPILER_REVISION = 8;
1010
export const LAST_COMPATIBLE_COMPILER_REVISION = 7;
1111

lib/handlebars/compiler/javascript-compiler.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,12 @@ JavaScriptCompiler.prototype = {
1616
return this.internalNameLookup(parent, name);
1717
},
1818
depthedLookup: function(name) {
19-
return [this.aliasable('container.lookup'), '(depths, "', name, '")'];
19+
return [
20+
this.aliasable('container.lookup'),
21+
'(depths, ',
22+
JSON.stringify(name),
23+
')'
24+
];
2025
},
2126

2227
compilerInfo: function() {

lib/handlebars/runtime.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ export function template(templateSpec, env) {
121121
loc: loc
122122
});
123123
}
124-
return obj[name];
124+
return container.lookupProperty(obj, name);
125125
},
126126
lookupProperty: function(parent, propertyName) {
127127
let result = parent[propertyName];

release-notes.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,26 @@
22

33
## Development
44

5-
[Commits](https://github.com/wycats/handlebars.js/compare/v4.7.6...master)
5+
[Commits](https://github.com/handlebars-lang/handlebars.js/compare/v4.7.7...master)
6+
7+
## v4.7.7 - February 15th, 2021
8+
9+
- fix weird error in integration tests - eb860c0
10+
- fix: check prototype property access in strict-mode (#1736) - b6d3de7
11+
- fix: escape property names in compat mode (#1736) - f058970
12+
- refactor: In spec tests, use expectTemplate over equals and shouldThrow (#1683) - 77825f8
13+
- chore: start testing on Node.js 12 and 13 - 3789a30
14+
15+
(POSSIBLY) BREAKING CHANGES:
16+
17+
- the changes from version [4.6.0](https://github.com/handlebars-lang/handlebars.js/blob/master/release-notes.md#v460---january-8th-2020) now also apply
18+
in when using the compile-option "strict: true". Access to prototype properties is forbidden completely by default, specific properties or methods
19+
can be allowed via runtime-options. See #1633 for details. If you are using Handlebars as documented, you should not be accessing prototype properties
20+
from your template anyway, so the changes should not be a problem for you. Only the use of undocumented features can break your build.
21+
22+
That is why we only bump the patch version despite mentioning breaking changes.
23+
24+
[Commits](https://github.com/wycats/handlebars.js/compare/v4.7.6...v4.7.7)
625

726
## v4.7.6 - April 3rd, 2020
827

spec/security.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,10 @@ describe('security issues', function() {
298298
checkProtoPropertyAccess({ compat: true });
299299
});
300300

301+
describe('in strict-mode', function() {
302+
checkProtoPropertyAccess({ strict: true });
303+
});
304+
301305
function checkProtoPropertyAccess(compileOptions) {
302306
it('should be prohibited by default and log a warning', function() {
303307
var spy = sinon.spy(console, 'error');
@@ -396,6 +400,28 @@ describe('security issues', function() {
396400
});
397401
});
398402
});
403+
404+
describe('escapes template variables', function() {
405+
it('in compat mode', function() {
406+
expectTemplate("{{'a\\b'}}")
407+
.withCompileOptions({ compat: true })
408+
.withInput({ 'a\\b': 'c' })
409+
.toCompileTo('c');
410+
});
411+
412+
it('in default mode', function() {
413+
expectTemplate("{{'a\\b'}}")
414+
.withCompileOptions()
415+
.withInput({ 'a\\b': 'c' })
416+
.toCompileTo('c');
417+
});
418+
it('in default mode', function() {
419+
expectTemplate("{{'a\\b'}}")
420+
.withCompileOptions({ strict: true })
421+
.withInput({ 'a\\b': 'c' })
422+
.toCompileTo('c');
423+
});
424+
});
399425
});
400426

401427
function wrapToAdjustContainer(precompiledTemplateFunction) {

0 commit comments

Comments
 (0)