We have an public facing web-server, with a custom API
feature to allow users to download data associated with a website we've developed. It's just an option to give users the data behind the website, for their own personal use and in json
format.
My question is not related to any errors or issues, as such. It's a question on security and if the way we've done it is safe.
I am new to CORS and wondered if doing this, is secure enough?
builder.Services.AddCors(p =>
p.AddPolicy("corsapp", builder =>
{
builder.WithOrigins("*").AllowAnyMethod().AllowAnyHeader();
}));
The data we provide is very limited and has no personal or identifiable information that would be of value to a hacker. In fact the data can be sourced from the internet in other websites.
Is the above builder
ok as is, or should we be specific with our domain URL in case hackers get past the API's default protection? By default I mean we are not programming any specific security features into our API. I just built it using VS2022, with the default project template for API development in C#.
Thanks
UPDATE
Please provide links or examples on how to properly setup CORS
on an API without authentication. As I said in my OP, our API does not require authentication - it's just a straight data dump. However, with the above Builder
, we are concerned of other possible vulnerabilities (if any!) - OR is CORS by default is "safe"?!