Repository navigation
fix: don't require SERVERID cookie for a valid VTOP session - #342
Conversation
VTOP no longer sets a SERVERID cookie; only JSESSIONID is returned. ValidateCookies, the login validator and the semester-details check still required SERVERID, so every successful login was discarded and users saw "Unable to log in" even with correct credentials. Treat a session as valid when CSRF and JSESSIONID are present.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
|
|
||
| func ValidateCookies(cookies types.Cookies) bool { | ||
| return cookies.CSRF != "" && cookies.JSESSIONID != "" && cookies.SERVERID != "" | ||
| return cookies.CSRF != "" && cookies.JSESSIONID != "" |
There was a problem hiding this comment.
The new SERVERID-free session case has no automated regression test. Existing refresh tests still supply SERVERID, so restoring the old requirement could break commands again without failing those tests.
Add tests for ValidateCookies, ValidateLogin, and GetSemDetails: accept CSRF plus JSESSIONID without SERVERID, and still reject either required value being empty. Exercise GetSemDetails without a cached result.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Fixes #341
Problem
VTOP no longer sets a
SERVERIDcookie (onlyJSESSIONIDis returned). Login succeeds and the home page loads, butValidateCookies, the login validator and the semester-details check still requiredSERVERID, so the valid session was discarded and every command failed with "Unable to log in".Change
A session is now treated as valid when
CSRFandJSESSIONIDare present.SERVERIDis still sent in requests when VTOP provides it.helpers/helper.go(ValidateCookies)helpers/login-validator.gohelpers/sem-details.goTesting
go vetandgo test ./...passprofileandattendancework against live VTOPspent a lot of water and tokens to review your slop
The PR appears safe to merge, with a non-blocking request for regression tests.
Summary
The PR allows VTOP sessions without
SERVERID.SERVERIDcookie.Reviews (1) · Last reviewed commit: "fix: don't require SERVERID cookie for a..." · Reviewed by Greptile