Fix security issues
Fixes GHSA-2w6w-674q-4c4q, GHSA-xhpv-hc6g-r9c6, GHSA-3mfm-83xf-c92r, GHSA-2qvq-rjwj-gvw9, GHSA-9cx6-37pm-9jff, GHSA-7rx3-28cr-v5wh, GHSA-442j-39wm-28r2, GHSA-xjpj-3mr7-gcpf
This commit is contained in:
committed by
Jay Linski
parent
b2a083136b
commit
68d8df5a88
@@ -686,9 +686,18 @@ JavaScriptCompiler.prototype = {
|
||||
let foundDecorator = this.nameLookup('decorators', name, 'decorator'),
|
||||
options = this.setupHelperArgs(name, paramSize);
|
||||
|
||||
// Store the resolved decorator in a variable and verify it is a function before
|
||||
// calling it. Without this, unregistered decorators can cause an unhandled TypeError
|
||||
// (calling undefined), which crashes the process — enabling Denial of Service.
|
||||
this.decorators.push(['var decorator = ', foundDecorator, ';']);
|
||||
this.decorators.push([
|
||||
'if (typeof decorator !== "function") { throw new Error(',
|
||||
this.quotedString('Missing decorator: "' + name + '"'),
|
||||
'); }'
|
||||
]);
|
||||
this.decorators.push([
|
||||
'fn = ',
|
||||
this.decorators.functionCall(foundDecorator, '', [
|
||||
this.decorators.functionCall('decorator', '', [
|
||||
'fn',
|
||||
'props',
|
||||
'container',
|
||||
|
||||
Reference in New Issue
Block a user