views:

48

answers:

1

We have an API that will be only used by our new website for now. I would like to get an input how what stackoverflowers think about the security in place for this api.

1)SSL protected

2)When logging in, the user's "IP" is sent as well as user and password. The API is then attached to the session and the session token is sent back. Whenever the next call is made, the userID, session and ip are passed. Then the userID is verified with the right sessiontoken and ip and if its good then the method is carried out.

3)The webservice itself is protected to allow access only from the ip where the server is being hosted.

Thanks, Faisal Abid

+1  A: 

I don't see why an ip address is passed. This should be pulled from the TCP socket and there for cannot be spoofed or otherwise influenced by an attacker.

The session id should be a Cryptographic Nonce and ideally you would be using a session handler already available in your platform. There is no sense in re-inventing the wheel.

Rook
Well how would the Api script get the IP since the api resides on a server different then the website.
Faisal Abid
The website makes a call to the API, essentially the website is a "client" for the api.
Faisal Abid
@Faisal Abid but, the webserver is using the API right? Why is the client's ip address useful?
Rook
@Rook: 1) Had you asked nicely, I would have. 2) You are now immortalized in the tomes of profanity and inexcusable grammatical negligence.
Alex
@Alex Manners and grammar does not make you a skilled programmer or hacker.
Rook
@Rook: You are correct; I made neither of those claims. However it seems you lack logic, which is a skill characteristic of good programmers.
Alex
@Rook: I'm not sure which 'server' you are referring to - downvoting all my questions/answers like you are doing does not constitute hacking. On a related matter, you've been getting trolled for 20 minutes.
Alex
@Alex i love trolls and i like speling and gramor.
Rook