-
-
Notifications
You must be signed in to change notification settings - Fork 870
feat(csrf): Support async IsAllowedSecFetchSiteHandler
#4559
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(csrf): Support async IsAllowedSecFetchSiteHandler
#4559
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4559 +/- ##
=======================================
Coverage 91.53% 91.53%
=======================================
Files 172 172
Lines 11228 11228
Branches 3260 3263 +3
=======================================
Hits 10278 10278
Misses 949 949
Partials 1 1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds support for async IsAllowedSecFetchSiteHandler functions in the CSRF middleware, allowing users to perform asynchronous operations (like database lookups or API calls) when validating the Sec-Fetch-Site header.
- Updated the
IsAllowedSecFetchSiteHandlertype to support both synchronous and asynchronous handlers - Modified the
isAllowedSecFetchSitefunction to properly handle async handlers withawait - Added comprehensive test coverage for async handler scenarios
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/middleware/csrf/index.ts | Updated type definition and implementation to support async IsAllowedSecFetchSiteHandler with proper await handling |
| src/middleware/csrf/index.test.ts | Added comprehensive tests covering async handler functionality including allowed values, path-based bypass, and blocked requests |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
IsAllowedSecFetchSiteHandlerIsAllowedSecFetchSiteHandler
…dSecFetchSiteHandler
yusukebe
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
|
I've fixed the conflict myself. Looks good. Thanks! |
This is
IsAllowedSecFetchSiteHandlerversion of #4558The author should do the following, if applicable
bun run format:fix && bun run lint:fixto format the code