The vulnerability, as described in GHSA-4f9j-vr4p-642r, is due to insecure settings on the budibase:auth session cookie. Specifically, the cookie was set with httpOnly: false and lacked a secure flag. This makes it possible for an XSS attack to steal the session cookie, leading to account takeover.
The analysis of the provided information points to the setCookie function in packages/backend-core/src/utils/utils.ts as the source of the vulnerability. This function is responsible for setting cookies, and the vulnerability description explicitly mentions the file where it resides.
The investigation of the associated pull request (#18571) and its commits confirms this. Commit 69f3f9dc84d27a47e8f1c52aea213cef2ea3f20d directly modifies the setCookie function to add the secure flag. This change, made to address the GHSA, is direct evidence that setCookie is the function where the insecure cookie attributes were being set. Although the httpOnly flag was the primary concern, the patch for the secure flag within the same function confirms its role in the vulnerability.