fix: skip verification for partner onboarding requests in TurnstileMi…#695
Conversation
…ddleware Added a condition to the TurnstileMiddleware to bypass token verification for requests that include a partner ID in the header, allowing for smoother onboarding processes.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
This is the final PR Bugbot will review for you during this billing cycle
Your free Bugbot reviews will reset on February 26
Details
Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.
To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.
| if c.GetHeader("X-Partner-Id") != "" { | ||
| c.Next() | ||
| return | ||
| } |
There was a problem hiding this comment.
Unvalidated header bypasses bot protection entirely
High Severity
The bypass checks only that X-Partner-Id is non-empty — the value is never validated against a known list of legitimate partner IDs, a database, a config allowlist, or any cryptographic proof. Any bot or attacker can include X-Partner-Id: anything in a request to completely skip Cloudflare Turnstile on both the auth/register and auth/login endpoints, enabling brute-force login attacks and mass automated account creation.


…ddleware
Added a condition to the TurnstileMiddleware to bypass token verification for requests that include a partner ID in the header, allowing for smoother onboarding processes.
Description
References
Testing
Checklist
mainBy submitting a PR, I agree to Paycrest's Contributor Code of Conduct and Contribution Guide.