GrafeasGroup / blossom

The website. The app. The everything.
6 stars 3 forks source link

[RFC] Exempt the API from CSRF protections #129

Closed TheLonelyGhost closed 3 years ago

TheLonelyGhost commented 3 years ago

Description:

Currently the bots call out to a non-existent API endpoint to harvest a CSRF token, then call to the appropriate API. That results in lots of errors generated. I'm arguing here that it isn't necessary to protect the API like that.

Given CSRF protection is an anti-bot measure, an API by nature is intended for bots, and we are already authenticating every request with an API token, applying exemptions to all authenticated API endpoints seems prudent.

Checklist:

MaxVanDeursen commented 3 years ago

Would this mean that the functionality within the Blossom wrapper does not work anymore? If this is the case, we should make sure to deploy a bump in versions for both Blossom, her wrapper, and all applications in tandem.

TheLonelyGhost commented 3 years ago

Good question. I wouldn't expect it would and I suspect it would just ignore whether someone has sent a valid CSRF. Would have to test to be certain, so I'll post here once I do that 😄.

itsthejoker commented 3 years ago

@TheLonelyGhost any movement here?

TheLonelyGhost commented 3 years ago

Just tested and it looks like it works okay regardless of if csrf token is passed:

With CSRF token

Without CSRF token