The web application framework we use has built-in support for handling Cross-site Request Forgery. This works well when data is posted with a browser to our webserver.
Currently we are developing an API in which an uploaded XML file is processed by the same application framework. Our API requires a unique token in the uploaded XML file for authentication. Since CSRF detection is enabled by default and the XML file does not contain a CSRF token we currently can not upload any data through this API.
However, we can quite easily disable CSRF detection, but is this safe?
A post here states -- quite boldly -- the following.
It is safe to remove csrf for API calls as the particular vulnerability can only be executed through a web browser.
Is this true? Can nothing similar to a CSRF attack happen through an API?