如何在客户端应用程序中隐藏customerid

编程入门 行业动态 更新时间:2024-10-10 13:23:28
本文介绍了如何在客户端应用程序中隐藏customerid的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一个使用api的角度单页应用程序,我必须将客户ID作为参数传递给客户端数据,但这不安全,因为clientid在前端暴露,任何人都可以轻松更改用户ID和传递参数,他将获得其他客户数据。如何保护它,以便没有人能看到其他客户数据。 我尝试过: 对它进行了研究,发现了一些方法,但需要最佳实践才能做到这一点。

I have an angular single page application which uses an api ,i have to pass customer id as parameter to get client data , but this is not secure since clientid is exposed at front end and any one can easily change the user id and pass in a parameter and he will get other customer data. How can i secure it so that no one can see other client data. What I have tried: Researched on it and found few ways but need best practice to do this.

推荐答案

你所描述的是一个不安全的直接对象参考: 十大2013-A4-Insecure直接对象参考 - OWASP [ ^ ] 使用序号来访问不同记录的数据使得攻击者猜测其他用户数据的URL是微不足道的。 您可以通过添加 GUID [ ^ ]记录的关键,只使用该键检索数据。 但是唯一的 real 解决方案是为您的代码验证发出请求的用户是否有权访问所请求的数据。如何操作取决于您的数据库结构和身份验证机制。 What you've described is an Insecure Direct Object Reference: Top 10 2013-A4-Insecure Direct Object References - OWASP[^] Using a sequential number to access data for different records makes it trivial for an attacker to guess the URL for other users' data. You can make their life harder by adding a GUID[^] key to the record, and only using that key to retrieve the data. But the only real solution is for your code to validate that the user making the request has permission to access the data being requested. How you do that will depend on your database structure and authentication mechanism.

@ Html.HiddenFor(model => model.Id) @Html.HiddenFor(model=>model.Id)

更多推荐

如何在客户端应用程序中隐藏customerid

本文发布于:2023-11-16 14:48:08,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1605249.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:应用程序   客户端   如何在   customerid

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!