The security advisory describes an authorization bypass vulnerability in Clerk's has() and auth.protect() functions when multiple authorization checks are combined. The advisory mentions that the fix is in the @clerk/shared package and specifically in the createCheckAuthorization function.
By analyzing the source code of the createCheckAuthorization function and the combine function it uses, I was able to identify the flaw in the logic. The original combine function would return true if at least one of the authorization checks passed, even if other checks failed. This is incorrect, as all requested checks should pass for the authorization to be granted.
The patch for this vulnerability corrects the logic of the combine function to ensure that all non-skipped checks pass. This confirms that the createCheckAuthorization function was the source of the vulnerability.
Therefore, the vulnerable function is createCheckAuthorization in packages/shared/src/authorization.ts.