I am interested to know how the URL-based api key restriction works, for example, used by Google to protect its Google Maps service.
From what I understand from this article, β Restricting access to Ajax services ,β there are two parts: first, when the service creates a specific key for a given domain using a one-way hash function; and second, where the service verifies the key based on the Referer header.
Although the article is understandable, I still have a problem trying to figure out how safe the verification method is. I mean, if the key is checked only against the referent, isnβt it so easy to fake? I think that a simple β127.0.0.1 www.mydomain.comβ in the hosts file will be enough to trick the check, and think that the referent is www.mydomain.com.
Perhaps I misunderstood some things, and some clarifications will be appreciated.
source share