GET vs POST in REST Web Service

前端 未结 3 466
忘了有多久
忘了有多久 2021-01-18 17:53

I\'m in the process of developing a REST service that allows a user to claim their listing based on a couple of pieces of information that appear on their invoice (invoice n

3条回答
  •  不要未来只要你来
    2021-01-18 18:04

    Independently of POST vs GET, I would recommend NOT basing your security as something as simple as a zip code and an invoice number. I would bet on the fact that invoice numbers are sequential (or close), and there aren't that many zip codes around - voila, I got full access to your listings.

    If you're using another authentication method (typically in HTTP header), then you're good - it doesn't matter if you have an invoice number if the URL, so might as well use GET.

    If you're not, then I guess POST isn't as bad as GET in term of exposing confidential content.

提交回复
热议问题