nhost / hasura-auth

Authentication for Hasura.
https://nhost.io
MIT License
373 stars 111 forks source link

ever growing provider_requests table in auth schema #455

Closed saibs closed 3 weeks ago

saibs commented 6 months ago

We are self hosting hasura auth, we noticed recently that lots of entries are created in provider_requests table in auth schema and keeps on growing because of this request triggered in the oauth middleware responsible in creating the session. Note: we are not using any oauth provider as a signin method.

I think this is happening since this commit the healthz endpoint moved to app level and every call to healthz endpoint creates an entry in provider_requests table because of the above express middleware.

Steps to reproduce

tested on version: 0.24.0 related discord discussion

dbarrosop commented 6 months ago

Ok, I could reproduce with an empty AUTH_API_PREFIX. If you have a solution that doesn't involve changing current behavior a PR is more than welcomed. Otherwise we will try to take a look when we have the time.

Note to interested parties: This doesn't affect nhost-managed instances.

saibs commented 6 months ago

one easy solution by not affecting current behavior would be to hoist the /healthz endpoint check above the app usage of router

but this would still be a vulnerability as one can create lots of entries in the database by just calling random routes which are 404, because of this catch all route and would create sessions with null values in provider_requests table

stale[bot] commented 4 weeks ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.