electron-vite icon indicating copy to clipboard operation
electron-vite copied to clipboard

Strings are not protected when using `bytecodePlugin`

Open subframe7536 opened this issue 1 year ago • 4 comments

Describe the bug

Create from official template and add bytecodePlugin

export default defineConfig({
  main: {
    plugins: [externalizeDepsPlugin(), bytecodePlugin({ protectedStrings: ['pong'] })]
  },
  //...
})

in generated .jsc file, the pong is shown vertically

image

Electron-Vite Version

2.3.0

Electron Version

28.2.10

Vite Version

5.3.1

Validations

subframe7536 avatar Jul 02 '24 03:07 subframe7536

What is your source code?

alex8088 avatar Jul 04 '24 06:07 alex8088

Just the template: https://github.com/alex8088/quick-start/blob/17aaa8c5b8f9def5dbf3f88c55ac8b17408544e2/packages/create-electron/playground/vue-ts/src/main/index.ts#L53

If string is long (like primary key), it is much easier to recognize

subframe7536 avatar Jul 04 '24 06:07 subframe7536

Did some research and successfully obfuscate the string. see in https://github.com/subframe7536/electron-incremental-update/commit/961893d4232f0313d4c1c639aa133b53c099e388

subframe7536 avatar Jul 04 '24 12:07 subframe7536

The bytecodePlugin is not work for me, too. I just add one password string into protectedStrings like this

main: { plugins: [externalizeDepsPlugin(), bytecodePlugin({ protectedStrings: [my_password] })] },

But I still found my_password string in index.jsc file easily. I've read documents and sure that build.minify is disabled.

staristic avatar Nov 15 '24 08:11 staristic