专有网络组件

发布于 2025-01-15 11:59:59 字数 159 浏览 2 评论 0原文

假设我们有一些专为特定公司需求而设计和开发的专有 Web 组件。

我们能否保护我们的网络组件不被他人使用?如果可以,如何保护?

注意:我并不是在谈论其他开发人员修改组件,我只是首先考虑其他人立即使用它们。

Let's say we have some proprietary web components which were designed and developed for a specific company needs.

Can we safeguard our web components from being used by others? If yes, how?

Note: I am not talking about other developers modifying the component, I am only thinking about others using them straight away in the first place.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

倒带 2025-01-22 11:59:59

这只是JS。你能做的就是拖延黑客的攻击。

您最多可以使用 JSObfuscator 和 JSFuck 等工具来使您的代码尽可能不可读。但当然,经验丰富的黑客也有工具……

然后我突然意识到;这一切都是为了增加额外的障碍,而且还有一个障碍我们可以采取行动。

我写了一篇关于使用 URI 编码 Web 组件的书呆子 DEV.to 博客文章

基本上可以归结为不要像混淆器那样将字典放入文件本身;
但将编码字典放在 URI 中(域路径更好!):

<script src="element.js?-customElements-define-HTMLElement-"></script>

并执行:

let D = document.currentScript.src.split`-`;

// D = ["element.js?","customElements","define","HTMLElement"];

window[D[1]][D[2]]("my-element",class extends window[D[3]]{ ... });

It is just JS. All you can do is delay hackers.

The most you can do is use tools like JSObfuscator and JSFuck to make your code as unreadable as possible. But ofcourse experienced hackers have tools also...

Then it dawned me; it is all about adding extra hurdles, and there is one more hurdle we can call to action.

I wrote a nerdy DEV.to blog post about using the URI to encode your Web Components

Basically boils down to NOT putting the Dictionary in the file itself, like Obfuscators do;
but placing the encoding dictionary in the URI (Domain Path even better!):

<script src="element.js?-customElements-define-HTMLElement-"></script>

And executing:

let D = document.currentScript.src.split`-`;

// D = ["element.js?","customElements","define","HTMLElement"];

window[D[1]][D[2]]("my-element",class extends window[D[3]]{ ... });
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文