Reputation: 2587
I am developing a web application with Spring Boot and a React.js SPA, but my question is not specific to those libraries/frameworks, as i assume reporting client-side JS errors to the server (for logging and analyzing) must be a common operation for many modern web applications.
So, suppose we have a JS client application that catches an error and a REST endpoint /errors
that takes a JSON object holding the relevant information about what happened. The client app sends the data to the server, it gets stored in a database (or whatever) and everyone's happy, right?
Now I am not, really. Because now I have an open (as in allowing unauthenticated create/write operations) API endpoint everyone with just a little knowledge could easily spam.
I might validate the structure of JSON data the endpoint accepts, but that doesn't really solve the problem.
In questions like "Open REST API attached to a database- what stops a bad actor spamming my db?" or "Secure Rest-Service before user authentification", there are suggestions such as:
So my questions are:
Upvotes: 6
Views: 869
Reputation: 1828
I’ve seen it done three different ways…
Assuming you are using OAuth 2 to secure your API. Stand up two error endpoints.
Secure the /error endpoint using an api key that would be scope for access to the error endpoint only.
Use a 3rd party tool such as Raygun.io, or any APM tool, such as New Relic.
Upvotes: 2