Actionscript 3 - How do I secure an API by only allowing trusted domains

De openkb
Aller à : Navigation, rechercher

Sommaire

Questions

Question

How do I secure an API by only allowing trusted domains?

Details

I am building a REST API. I need a way to distribute API Keys but only allow them to work from the domain they are registered with.

The main issue is my API Key needs to be embedded in a Flash File which can easily be decompiled to steal the API Key. If Flash makes this impossible I can use Javascript instead.

I have heard a lot of people say use $_SERVER[ HTTP_REFERER ]. But that is easily spoofed.

    • How do I build an API that makes sure a request is coming from an allowed domain?
    • How do I create an API key that is tied to a domain?
    • How do I secure an API by only allowing trusted domains?

Related Stackoverflow Questions:

These questions are related but didn t quite answer my question. Figured I would just put them here for future reference.

Answers

JavaScript won t help you here - the problem is that the key is being stored on the client, which means that it is not secure. You can make it a bit more difficult for an attacker certainly (e.g. like you say checking the referrer), but at the end of the day all the server can verify is that the key is correct, and since the key can easily be stolen that s not very helpful.

The way this can be secured is by having the private keys run on the servers of whoever you are giving them to instead of in the client. Depending on your needs, this may not be feasible.

http://blog.boogatech.com/as3_tutorial_site-locking_your_flash_project/ http://blog.boogatech.com/as3_tutorial_site-locking_your_flash_project/

I d advise you to think about what attack and attackers you are trying to prevent (why do you have to tie API keys to a domain?). This will help you plan your security attempts better. For instance, if you are not running an ultra-critical API, you can decide that putting in a couple of things to make it harder for attackers to access the API is acceptable, with the knowledge that you can t stop an extremely dedicated attacker.

Source

License : cc by-sa 3.0

http://stackoverflow.com/questions/11694443/how-do-i-secure-an-api-by-only-allowing-trusted-domains

Related

Outils personnels
Espaces de noms

Variantes
Actions
Navigation
Outils