Enforcing / Securing POST parameters

前端 未结 2 1135
死守一世寂寞
死守一世寂寞 2021-01-23 06:38

My title is probably vague so please check my situation below.

I have a web application to manage a list of employees. The application is set up in a hub-spoke pattern w

相关标签:
2条回答
  • 2021-01-23 07:22

    Many web based systems are designed to be stateless. The main reason is to allow multiple sessions/windows.

    You could potentially store the currently edited employee ID in a session variable and only allow changes to that employee ID, however, what if the user has two browser windows open in the same session? Now, you have to keep the currently edited employee ID for each window. Well, you don't have this information, so you have to store the employee ID in the form itself, and this is all editable by the client.

    So, instead, simply enforce the rules on the server, and if they have permission to edit that employee, let them.

    Ensure that your system is using HTTPS to prevent man in the middle attacks, escaping all output to prevent cross site scripting (XSS), and requiring POST for all updates as well as using sessions and form tokens to prevent cross site request forgery (CSRF). Once you've done that, any employee ID manipulation will likely be self-inflicted, and your job isn't to protect the user from themselves.

    0 讨论(0)
  • 2021-01-23 07:29

    What you usualy do is - click on a row, get the employee ID and send it to the server, retrieve information by ID and publish it to the user. Usualy you keep the ID as some jind of hidden value, so when you update, you update this ID. And, usualy, you don't allow ID changes. IMO no need of checking ID, but if you think some one can jump over, just check if the ID of the page is the same you have in the hidden value.

    0 讨论(0)
提交回复
热议问题