The vulnerability lies in the way Jupyter Server generates and persists the cookie secret for authentication. The advisory GHSA-5mrq-x3x5-8v8f states that the cookie secret is stored in a file and not rotated or cleared upon password changes. The provided patch addresses this by modifying the cookie secret generation process to include the user's password.
The key change is in the _default_cookie_secret method within jupyter_server/serverapp.py. The patch introduces a call to self.identity_provider.cookie_secret_hook(h), which in turn updates the HMAC with the user's hashed password. This ensures that any change in the password will result in a new cookie secret, effectively invalidating all previously issued cookies. The function ServerApp._default_cookie_secret is therefore the place where the vulnerable logic existed, as it was responsible for creating a static cookie secret that did not account for password changes.