hagana icon indicating copy to clipboard operation
hagana copied to clipboard

Non-default export child_process bug

Open Mickael-van-der-Beek opened this issue 2 years ago • 3 comments

I believe that there is a bug where functions that get extracted from the exports and not from the default export object don't get wrapped by Hagana.

e.g: This works:

import { execSync } from 'child_process';

export function run () {
  const result = execSync('node -v').toString();
  console.log('RESULT=', result);
}

This doesn't:

import childProcess from 'child_process';

export function run () {
  const result = childProcess.execSync('node -v').toString();
  console.log('RESULT=', result);
}

Mickael-van-der-Beek avatar Jun 24 '22 16:06 Mickael-van-der-Beek

I'll take a look at this. It should work

yaakov123 avatar Jun 25 '22 18:06 yaakov123

Interesting, I tested for a similar case where I checked if: const {execSync} = require("child_process")

bypasses the protection (it doesn't), but seems that using import bypasses the protection.

yaakov123 avatar Jun 25 '22 19:06 yaakov123

This is weird, it's only happening to me occasionally. Do you mind upload a repo with your project structure?

yaakov123 avatar Jun 26 '22 11:06 yaakov123