mirror of
https://github.com/n8n-io/n8n.git
synced 2026-05-12 16:10:30 +02:00
fix(core): Correct process.version in expression sandbox (#26550)
Co-authored-by: manusjs <manusjs@users.noreply.github.com>
This commit is contained in:
parent
9775f96f15
commit
fc0f0712d8
|
|
@ -474,7 +474,7 @@ export class Expression {
|
|||
pid: process.pid,
|
||||
ppid: process.ppid,
|
||||
release: process.release,
|
||||
version: process.pid,
|
||||
version: process.version,
|
||||
versions: process.versions,
|
||||
}
|
||||
: {};
|
||||
|
|
|
|||
|
|
@ -165,6 +165,13 @@ describe('Expression', () => {
|
|||
expect(evaluate('={{Symbol(1).toString()}}')).toEqual(Symbol(1).toString());
|
||||
});
|
||||
|
||||
it('should expose correct process properties in sandbox', () => {
|
||||
expect(evaluate('={{process.version}}')).toMatch(/^v\d+\.\d+\.\d+/);
|
||||
expect(evaluate('={{typeof process.pid}}')).toBe('number');
|
||||
expect(evaluate('={{process.version}}')).not.toBe(process.pid);
|
||||
expect(evaluate('={{process.version}}')).toBe(process.version);
|
||||
});
|
||||
|
||||
it('should not able to do arbitrary code execution', () => {
|
||||
const testFn = vi.fn();
|
||||
Object.assign(global, { testFn });
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user