Preventing Url manipulation attacks with MVC?

前端 未结 4 1659
难免孤独
难免孤独 2021-02-04 12:00

Any good strategies, code snippets etc for preventing URL manipulation?

For example I have this url, http://localhost/profile/edit/5 the id could easily be

4条回答
  •  难免孤独
    2021-02-04 12:24

    Number 3 is the correct thing to do. Server-Side Security Validation is always what you need, because this is the mechanism that you completely control and can rely on.

    Number 1 is Security by Obscurity, and if someone accidentally posts his URL somewhere (like people often do with Session-IDs when they copy/paste links), your "Security" is broken.

    Number 2 seems like a weak security - if you go through the hassle, better implement proper security. That also allows people to bookmark the page.

提交回复
热议问题