javascript - 用户是否可以在浏览器中修改网站 JavaScript?

标签 javascript security

我对安全了解不多,但我正在尝试找出如何尽可能保证我的网站安全。我知道我可以在后端处理的东西越多越好,但是对于我想在客户端上保存一些变量的情况,这些东西是完全不可更改的吗?

例如,如果我为用户 Angular 色设置一个全局变量(这是一个纯 AJAX Web 应用程序,因此全局变量始终可用),是否有任何软件可以在浏览器中编辑 javascript,以便用户可以改变他们的 Angular 色?

最佳答案

安全性是 Web 开发领域的一个重要主题,确定 Web 应用程序的安全性对于您来说非常重要。

有3个部分需要注意

  1. 前端(网站)

everything here is insecure, whatever shown on you in the browser could be changed or modified. Just go to the debug console and you could change the variable and rerender the html page again

  • 传输级别 (https)
  • web communication is based on the http(s) protocol that allows you to communicate between your server and client. Using https will prevent you from man in the middle attack

  • 后端
  • always make sure to authenticate and check the data sent from your client (POST, PUT, DELETE)

    预防

    好处是,即使您更改客户端的变量,它也只会出现在该客户端 session 上,不会影响任何其他 session 。有几种方法可以提高前端的安全性

    1. 混淆

    this means make your source code harder to read. You could try to use tool like minification, and concatatenata your source code.

  • 数据
  • Never ever store user sensitive data (password, user info) in the client side, since people could just change and see it

    这应该让您了解更多有关安全性的知识

    关于javascript - 用户是否可以在浏览器中修改网站 JavaScript?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30905266/

    相关文章:

    javascript - Opera 中的 execcomand 错误

    javascript - 定时规划Mysql数据库清理

    c# - 我对使用网页/WebMatrix 与 XSS 的 ASP.NET 请求验证有多大的信任度?

    php - 停止Bot [SO]-PHP

    java - 如何在 Java 中限制 JPasswordField 中的位数?

    javascript - 如何避免取消选中 extjs4.1 中的复选框

    javascript - ajax php按钮点击计数器的计数不显示

    database - 审计跟踪和实现 SOX/HIPAA/等,敏感数据的最佳实践

    c# - 我如何使用频率分析来解析加密的段落?

    javascript - 无法使用 JSON.stringify() 生成 JSON 文件