You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Github oauth flow has a state variable in its request that is supposed to be used to prevent CSRF. Currently, it is a constant string, but it should be randomly generated for each oauth login request.
In the case of KWoC, the oauth request only logs in the user and no damage could be done even if another site redirects to the oauth login url. However, it would be best to use a random string anyway.
Solution:
Generate a random string when clicking on the login button
Store the string in localstorage and redirect to the oauth URL with this state
When the oauth login is complete and the user is redirected to /oauth on the frontend, match these strings and only proceed to log in if they match
It would also be good to make the state a limited-time string so that a string generated previously cannot be used
Describe the feature/bug
The Github oauth flow has a
state
variable in its request that is supposed to be used to prevent CSRF. Currently, it is a constant string, but it should be randomly generated for each oauth login request.In the case of KWoC, the oauth request only logs in the user and no damage could be done even if another site redirects to the oauth login url. However, it would be best to use a random string anyway.
Solution:
localstorage
and redirect to the oauth URL with this state/oauth
on the frontend, match these strings and only proceed to log in if they matchResources
KWoC-Frontend/src/util/constants.ts
Line 51 in c9f57e9
The text was updated successfully, but these errors were encountered: