pd4d10 / debugtron

Debug in-production Electron based app
MIT License
1.41k stars 109 forks source link

Is there a way to block debugtron from opening a production electron app? #8

Closed nitishdhar closed 3 years ago

nitishdhar commented 3 years ago

Great application, makes it really easy to test builds with no dev tools. While this is great for developers, as an app owner, I wanted to know if there's a way to restrict this app or the mechanisms this app relies on from being able to do what it does.

I know it's weird to ask in an issue that your app working as expected is the issue but really wanted to hear your thoughts on this.

Thanks

toyobayashi commented 3 years ago

According to https://github.com/bytedance/debugtron/blob/d56c68c6fe2e47ce799e1d623bfce0fc684b91c0/src/main/actions.ts#L51-L57

so this could work

// electron main
for (let i = 0; i < process.argv.length; i++) {
  const arg = process.argv[i]
  if (arg.indexOf('--inspect') !== -1 || arg.indexOf('--remote-debugging-port') !== -1) {
    throw new Error('Not allow debugging this program.')
  }
}
nitishdhar commented 3 years ago

Thanks, that worked.