Is there a way to block debugtron from opening a production electron app?
nitishdhar opened this issue · 2 comments
nitishdhar commented
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
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
Thanks, that worked.