mirror of
https://github.com/discourse/discourse.git
synced 2025-04-02 10:16:09 +08:00
SECURITY: Upgrade Ember to fix CVE-2015-7565. Also upgrade Handlebars
This commit is contained in:
parent
7a28338a07
commit
4bbbdd8dc4
2
Gemfile
2
Gemfile
@ -46,7 +46,7 @@ gem 'active_model_serializers', '~> 0.8.3'
|
|||||||
gem 'onebox'
|
gem 'onebox'
|
||||||
|
|
||||||
gem 'ember-rails'
|
gem 'ember-rails'
|
||||||
gem 'ember-source', '1.12.1'
|
gem 'ember-source', '1.12.2'
|
||||||
gem 'barber'
|
gem 'barber'
|
||||||
gem 'babel-transpiler'
|
gem 'babel-transpiler'
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ GEM
|
|||||||
ember-source (>= 1.1.0)
|
ember-source (>= 1.1.0)
|
||||||
jquery-rails (>= 1.0.17)
|
jquery-rails (>= 1.0.17)
|
||||||
railties (>= 3.1)
|
railties (>= 3.1)
|
||||||
ember-source (1.12.1)
|
ember-source (1.12.2)
|
||||||
erubis (2.7.0)
|
erubis (2.7.0)
|
||||||
eventmachine (1.0.8)
|
eventmachine (1.0.8)
|
||||||
excon (0.45.4)
|
excon (0.45.4)
|
||||||
@ -415,7 +415,7 @@ DEPENDENCIES
|
|||||||
discourse-qunit-rails
|
discourse-qunit-rails
|
||||||
discourse_email_parser
|
discourse_email_parser
|
||||||
ember-rails
|
ember-rails
|
||||||
ember-source (= 1.12.1)
|
ember-source (= 1.12.2)
|
||||||
excon
|
excon
|
||||||
fabrication (= 2.9.8)
|
fabrication (= 2.9.8)
|
||||||
fakeweb (~> 1.3.0)
|
fakeweb (~> 1.3.0)
|
||||||
|
@ -24,6 +24,5 @@ registerUnbound('raw', function(templateName, params) {
|
|||||||
Ember.warn('Could not find raw template: ' + templateName);
|
Ember.warn('Could not find raw template: ' + templateName);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
return renderRaw(this, template, templateName, params);
|
return renderRaw(this, template, templateName, params);
|
||||||
});
|
});
|
||||||
|
@ -8,9 +8,9 @@ function resolveParams(ctx, options) {
|
|||||||
if (options.hashTypes) {
|
if (options.hashTypes) {
|
||||||
Ember.keys(hash).forEach(function(k) {
|
Ember.keys(hash).forEach(function(k) {
|
||||||
const type = options.hashTypes[k];
|
const type = options.hashTypes[k];
|
||||||
if (type === "STRING") {
|
if (type === "STRING" || type === "StringLiteral") {
|
||||||
params[k] = hash[k];
|
params[k] = hash[k];
|
||||||
} else if (type === "ID") {
|
} else if (type === "ID" || type === "PathExpression") {
|
||||||
params[k] = get(ctx, hash[k], options);
|
params[k] = get(ctx, hash[k], options);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -23,7 +23,7 @@ function resolveParams(ctx, options) {
|
|||||||
|
|
||||||
export default function registerUnbound(name, fn) {
|
export default function registerUnbound(name, fn) {
|
||||||
const func = function(property, options) {
|
const func = function(property, options) {
|
||||||
if (options.types && options.types[0] === "ID") {
|
if (options.types && (options.types[0] === "ID" || options.types[0] === "PathExpression")) {
|
||||||
property = get(this, property, options);
|
property = get(this, property, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,17 +68,6 @@
|
|||||||
RawHandlebars.JavaScriptCompiler.prototype.compiler = RawHandlebars.JavaScriptCompiler;
|
RawHandlebars.JavaScriptCompiler.prototype.compiler = RawHandlebars.JavaScriptCompiler;
|
||||||
RawHandlebars.JavaScriptCompiler.prototype.namespace = "Discourse.EmberCompatHandlebars";
|
RawHandlebars.JavaScriptCompiler.prototype.namespace = "Discourse.EmberCompatHandlebars";
|
||||||
|
|
||||||
|
|
||||||
RawHandlebars.Compiler.prototype.mustache = function(mustache) {
|
|
||||||
if ( !(mustache.params.length || mustache.hash)) {
|
|
||||||
|
|
||||||
var id = new Handlebars.AST.IdNode([{ part: 'get' }]);
|
|
||||||
mustache = new Handlebars.AST.MustacheNode([id].concat([mustache.id]), mustache.hash, mustache.escaped);
|
|
||||||
}
|
|
||||||
|
|
||||||
return Handlebars.Compiler.prototype.mustache.call(this, mustache);
|
|
||||||
};
|
|
||||||
|
|
||||||
RawHandlebars.precompile = function(value, asObject) {
|
RawHandlebars.precompile = function(value, asObject) {
|
||||||
var ast = Handlebars.parse(value);
|
var ast = Handlebars.parse(value);
|
||||||
|
|
||||||
@ -99,6 +88,28 @@
|
|||||||
|
|
||||||
RawHandlebars.compile = function(string) {
|
RawHandlebars.compile = function(string) {
|
||||||
var ast = Handlebars.parse(string);
|
var ast = Handlebars.parse(string);
|
||||||
|
|
||||||
|
var visitor = new Handlebars.Visitor();
|
||||||
|
visitor.mutating = true;
|
||||||
|
|
||||||
|
visitor.MustacheStatement = function(mustache) {
|
||||||
|
if (!(mustache.params.length || mustache.hash)) {
|
||||||
|
mustache.params[0] = mustache.path;
|
||||||
|
mustache.path = {
|
||||||
|
type: "PathExpression",
|
||||||
|
data: false,
|
||||||
|
depth: mustache.path.depth,
|
||||||
|
parts: ["get"],
|
||||||
|
original: "get",
|
||||||
|
loc: mustache.path.loc,
|
||||||
|
strict: true,
|
||||||
|
falsy: true
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return Handlebars.Visitor.prototype.MustacheStatement.call(this, mustache);
|
||||||
|
};
|
||||||
|
visitor.accept(ast);
|
||||||
|
|
||||||
// this forces us to rewrite helpers
|
// this forces us to rewrite helpers
|
||||||
var options = { data: true, stringParams: true };
|
var options = { data: true, stringParams: true };
|
||||||
var environment = new RawHandlebars.Compiler().compile(ast, options);
|
var environment = new RawHandlebars.Compiler().compile(ast, options);
|
||||||
|
4328
vendor/assets/javascripts/handlebars.js
vendored
4328
vendor/assets/javascripts/handlebars.js
vendored
File diff suppressed because one or more lines are too long
1218
vendor/assets/javascripts/handlebars.runtime.js
vendored
1218
vendor/assets/javascripts/handlebars.runtime.js
vendored
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user