久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

如何在電子js中對(duì)源代碼進(jìn)行混淆并保護(hù)源代碼

How to perform obfuscation of source code and protect source in electron js(如何在電子js中對(duì)源代碼進(jìn)行混淆并保護(hù)源代碼)
本文介紹了如何在電子js中對(duì)源代碼進(jìn)行混淆并保護(hù)源代碼的處理方法,對(duì)大家解決問(wèn)題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!

問(wèn)題描述

我最近開發(fā)了一個(gè)帶有 electron 框架的應(yīng)用程序,在閱讀了與電子 JavaScript 代碼相關(guān)的安全問(wèn)題后,我現(xiàn)在擔(dān)心源代碼保護(hù).

我的意思是即使應(yīng)用程序是為生產(chǎn)而構(gòu)建的,也可以對(duì)代碼進(jìn)行逆向工程.我的應(yīng)用程序包含許多關(guān)鍵信息,例如用于自動(dòng)更新的 GitHub Private Token 等等.

我剛剛瀏覽了許多 SO 帖子,但沒(méi)有找到完美的答案,因此請(qǐng)解決問(wèn)題.使用電子無(wú)法混淆javascript代碼或源代碼保護(hù)?然而,混淆并不能完全保護(hù)代碼,但它會(huì)使逆向工程變得復(fù)雜.如果有解決方法,請(qǐng)告訴我.我在電子的安全相關(guān)帖子中沒(méi)有找到比 tl;dr 更多的內(nèi)容.

我通過(guò) obfuscator 找到了一種混淆方法,但似乎它需要手動(dòng)混淆,而對(duì)源代碼保護(hù)沒(méi)有什么像在 NW.js 有沒(méi)有更好的方法來(lái)實(shí)現(xiàn)呢?

我在 中型帖子上發(fā)現(xiàn)了一些有助于混淆的內(nèi)容.但沒(méi)有找到任何關(guān)于源代碼保護(hù)的信息.

解決方案

tl;dr 你可以,但不值得努力.只需打包您的來(lái)源asar 文件,它讓大多數(shù)人遠(yuǎn)離它.

長(zhǎng)篷:

  • 在構(gòu)建應(yīng)用時(shí)使用 asar 選項(xiàng).
  • 用丑陋的方法混淆代碼.
  • 使用 WASM
  • 語(yǔ)言綁定,用于從已編譯格式中獲取數(shù)據(jù)
    • 用于 Rust 的 neonjs
    • 用于 C# 的 edge-js
    • N-API,用于 C/C++ 的 NAN

否則您的文件是腳本,所有這些步驟只會(huì)減慢攻擊者(許多防御的策略),但他們不會(huì)阻止他們從訪問(wèn)它們.devTools 相當(dāng)容易打開和人們將能夠以某種方式、形狀或形式閱讀代碼.和如果有人得到了你的混淆代碼,那么重建什么很簡(jiǎn)單正在發(fā)生(請(qǐng)參閱此處以供參考:https://www.youtube.com/watch?v=y6Uzinz3DRU)p>

如果你想保護(hù)自己免受代碼操縱,有更好的方法來(lái)做到這一點(diǎn).像散列,上下文隔離等電子關(guān)于這個(gè)問(wèn)題有一整章.

https://github.com/electron/electron/blob/master/docs/tutorial/security.md

I recently developed an app with electron framework and am now worried about source code protection after reading security concerns related to electron javascript code.

I mean reverse engineering of the code is possible even if the app is built for production. My application contains many critical information like GitHub Private Token for AutoUpdate and much more.

I just have gone through many SO post but didn't find the perfect answer so resolve the problem. Obfuscation of javascript code or source code protection is not possible with electron? However, Obfuscation doesn't protect the code completely but it can make reverse engineering complex. if there is a workaround for doing so, let me know. I didn't find more than tl;dr in the security-related post of the electron.

I found an obfuscation method by obfuscator but seems it's gonna need manual obfuscation and nothing much about the source code protection like in NW.js Is there any better way to achieve it?

I found something helpful for obfuscation on Medium post. but didn't find anything about source protection.

解決方案

tl;dr You can and it is not worth the effort. Just pack your source into a asar file, it keeps most people away from it.

Long awnser:

  • Use the asar option when building your app.
  • Obfuscating the code with a uglyfier.
  • Use WASM
  • Language bindings to grab your data from a compiled format
    • neonjs for Rust
    • edge-js for C#
    • N-API, NAN for C/C++

Otherwise your files are scripts, all these steps only slow down a attacker (Tactic of many defenses), but they will not prevent them from accessing them. The devTools are fairly easy to get opened and people will be able to read the code in some way, shape or form. And if someone gets your Obfuscated code it is simple to reconstruct what is happening (see here for reference: https://www.youtube.com/watch?v=y6Uzinz3DRU)

If you want to protect yourself from code manipulation, there are better ways to do it. Like Hashing, Context Isolation etc. electron has a whole chapter on the matter.

https://github.com/electron/electron/blob/master/docs/tutorial/security.md

這篇關(guān)于如何在電子js中對(duì)源代碼進(jìn)行混淆并保護(hù)源代碼的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來(lái)源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問(wèn)題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

How to fix BrowserWindow is not a constructor error when creating child window in Electron renderer process(在 Electron 渲染器進(jìn)程中創(chuàng)建子窗口時(shí)如何修復(fù) BrowserWindow 不是構(gòu)造函數(shù)錯(cuò)誤) - IT屋-程序員軟件開發(fā)技術(shù)
mainWindow.loadURL(quot;https://localhost:3000/quot;) show white screen on Electron app(mainWindow.loadURL(https://localhost:3000/) 在 Electron 應(yīng)用程序上顯示白屏)
Electron webContents executeJavaScript : Cannot execute script on second on loadURL(Electron webContents executeJavaScript:無(wú)法在第二個(gè) loadURL 上執(zhí)行腳本)
how to use electron browser window inside components in angular-cli?(如何在angular-cli的組件內(nèi)使用電子瀏覽器窗口?)
ElectronJS - sharing redux store between windows?(ElectronJS - 在 Windows 之間共享 redux 存儲(chǔ)?)
How to access camera/webcamera inside electron app?(如何在電子應(yīng)用程序中訪問(wèn)相機(jī)/網(wǎng)絡(luò)攝像頭?)
主站蜘蛛池模板: 精品产国自在拍 | 嫩草视频在线 | 国产精品高潮呻吟久久av黑人 | 国产三级精品三级在线观看四季网 | 亚洲第一色av | 久久久久九九九女人毛片 | www.天天操 | 91免费电影 | 在线观看免费av片 | 九九免费观看视频 | 蜜桃特黄a∨片免费观看 | 亚洲精品乱码久久久久久按摩 | 伊人网站在线观看 | 国产蜜臀97一区二区三区 | 亚洲一区二区三区免费视频 | 狠狠av| 亚洲色图第一页 | 国产一区欧美 | 精品一区二区电影 | 中文字幕日韩欧美 | 久久久91精品国产一区二区三区 | 亚洲激情一区二区三区 | 国产ts一区 | 亚洲视频在线播放 | 伊人色综合久久久天天蜜桃 | 99精品国产一区二区三区 | 免费v片 | 中文字幕一区二区三区不卡 | 精品乱码一区二区 | 亚洲欧美在线一区 | 91精品久久久久久久久 | 在线免费激情视频 | 精品国产乱码一区二区三区a | 久久精品欧美电影 | 欧美日韩亚洲在线 | 日韩不卡在线观看 | 91在线一区 | 99这里只有精品视频 | 欧美日韩一区二区三区四区五区 | 91看片| 亚洲精品福利在线 |