Вопрос

Suppose I have a asp.net mvc 3 application with an interface named /getdata, different users connect to the server by my PC client software and get private data using this interface. Different users are identified by their own well-encrypted tokens.enter image description here

Now the problem is ClientA told us he got another user's data. From the log of ClientA we found he got ClientB's (but they don't know each other, they can't share accounts). I looked through the code of my web application but couldn't find any chance to mix their data.

So I wonder can this happen:

(1) ClientB starts a http request to http://mysite.com/getdata, with his token in the http header, via a web proxy.

(2) The web proxy accesses my web server, get ClientB's data.

(3) My web server approves the request and returns ClientB's data, since everything is correct.

(4) ClientB gets his data and correctly displayed

(5) Almost the same time after ClientB get his data, ClientA starts a same request, with ClientA's token in the header.

(6) The web proxy find the url that ClientA requesting is the same as ClientB's, and the result is still in cache, then returns ClientB's data. Then ClientA gets another's data.

In my web app interface, at the very beginning I already set all the response no-cache, max-age=0 and so on to prevent client-side cache. My question is:

  1. Can the scanario in the image happen?

  2. If yes, how can I prevent the web proxy returning cached data? I can't modify the program of the PC client, and web proxy servers are out of my control.

  3. If no, what's the possible reason that A is getting B's data?

Это было полезно?

Решение

Can the scanario in the image happen?

Yes, this is possible if the clients are using the GET verb to access the /getdata endpoint.

If yes, how can I prevent the web proxy returning cached data? I can't modify the program of the PC client, and web proxy servers are out of my control.

Decorate the controller action that is serving the GetData endpoint with a [NoCache] attribute to ensure that no data gets cached downstream.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top