mirror of
https://github.com/Jeuners/ECC.git
synced 2026-09-09 15:02:30 +02:00
fix: bootstrap plugin-installed hook commands safely
This commit is contained in:
parent
48a30b53c8
commit
1b7c5789fc
9 changed files with 564 additions and 95 deletions
|
|
@ -73,7 +73,7 @@ function validateHookEntry(hook, label) {
|
|||
console.error(`ERROR: ${label} missing or invalid 'command' field`);
|
||||
hasErrors = true;
|
||||
} else if (typeof hook.command === 'string') {
|
||||
const nodeEMatch = hook.command.match(/^node -e "(.*)"$/s);
|
||||
const nodeEMatch = hook.command.match(/^node -e "((?:[^"\\]|\\.)*)"(?:\s|$)/s);
|
||||
if (nodeEMatch) {
|
||||
try {
|
||||
new vm.Script(nodeEMatch[1].replace(/\\\\/g, '\\').replace(/\\"/g, '"').replace(/\\n/g, '\n').replace(/\\t/g, '\t'));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue