Should I use GET or POST when requesting sensitive data?

后端 未结 6 528
野性不改
野性不改 2021-02-04 18:51

Should I use GET or POST for retrieving sensitive data, given that:

  • The response will contain sensitive data.
  • There are side-eff
6条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-02-04 19:00

    If the data is highly sensitive, consider using a POST. It's easy to issue a GET request without much thought - for instance if someone is looking at log file while logged in to the application with appropriate permissions and they click a link, they would generate a get request.

    You can instead ask the client to construct a document you could call a 'sensitive data access request'. Potentially you could require a field with the reason for looking at this data. The server could receive this request and send the sensitive data in response.

    Depending on the type of client application the users have access to, it might be much easier to demonstrate intentionality if a user sends a POST request than if they send a GET request.

提交回复
热议问题