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
A very common security problem in student projects is not referencing the sessionToken cookie within an API route (leaving it unprotected and open to anyone who wants to hit the API endpoint with Postman or a script or similar)
We should check all API route handlers that the user writes (the default export in all files in the pages/api folder - check out the no-document-import-in-page rule for implementation hints), to make sure that they are referring to sessionToken somewhere
Students can "opt out" of this behavior by writing unprotected at the start of the function name (so they do this while being aware of it) eg. unprotectedUsersHandler
The text was updated successfully, but these errors were encountered:
karlhorky
changed the title
New Rule: Require reference of sessionToken cookie in API route handler functions (unless function name prefixed with "unprotected")
New Rule: Require reference to sessionToken cookie in API route handlers
Jan 19, 2022
A very common security problem in student projects is not referencing the
sessionToken
cookie within an API route (leaving it unprotected and open to anyone who wants to hit the API endpoint with Postman or a script or similar)We should check all API route handlers that the user writes (the default export in all files in the
pages/api
folder - check out theno-document-import-in-page
rule for implementation hints), to make sure that they are referring to sessionToken somewhereStudents can "opt out" of this behavior by writing
unprotected
at the start of the function name (so they do this while being aware of it) eg.unprotectedUsersHandler
The text was updated successfully, but these errors were encountered: