-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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: implement Arcjet security bot detection & Shield WAF #330
Conversation
@davidmytton is attempting to deploy a commit to the Ixartz's projects Team on Vercel. A member of the Team first needs to authorize it. |
Very strange about the TypeScript error, it shouldn't look inside Anyway, it's out of the scope of the PR. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #330 +/- ##
==========================================
- Coverage 10.67% 10.23% -0.45%
==========================================
Files 39 40 +1
Lines 1115 1163 +48
Branches 45 46 +1
==========================================
Hits 119 119
- Misses 963 1010 +47
- Partials 33 34 +1 ☔ View full report in Codecov by Sentry. |
src/app/[locale]/(auth)/layout.tsx
Outdated
import { routing } from '@/libs/i18nNavigation'; | ||
import { enUS, frFR } from '@clerk/localizations'; | ||
import { ClerkProvider } from '@clerk/nextjs'; | ||
import { setRequestLocale } from 'next-intl/server'; | ||
|
||
const aj = arcjet.withRule( |
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.
Is it possible to combine with the one at src/app/[locale]/(marketing)/layout.tsx
?
And move to the root layout: https://github.com/ixartz/Next-js-Boilerplate/blob/main/src/app/%5Blocale%5D/layout.tsx
So, we keep only one and everything is inside the root layout.
CATEGORY:SEARCH_ENGINE won't pass the middleware due to authentication.
Most pages under (auth) required authentication. This is why I'm thinking to add directly in the root layout, did I miss something?
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.
I did it that way because often you want more restrictive bot detection on the authenticated routes vs your website, but I've made the change. The Arcjet call is now in the root layout. It can easily be moved by the user later.
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.
It looks good to me, I'll merge this weekend.
@davidmytton, I wanted to merge the PR but I notice the changes in When I run the type check,
So, it's only related to Arcjet. I would be great to know the root cause before merging it, in the tsconfig:
The type check shouldn't be run inside node_modules, it don't happen with other libraries. On my side, I'll also try to investigate. |
Aj looks like a nice feature, but do you want to introduce a dependency on a solution in alpha release? |
The Next-js-Boilerplate/tsconfig.json Line 64 in a08638b
node_modules directory to be compiled.
This is what I was referring to in the PR description. Changing it to scope only files in To avoid this, we're going to stop publishing the TS files in a new SDK release shortly (arcjet/arcjet-js#2326). Ideally you'd be able to change the Once the release is out I'll update this PR and it should resolve the problem. That's why we still keep the SDK in |
I'd also add there are other dependencies that are technically alpha (i.e pre v1.0) already in this boilerplate e.g. |
@ixartz I just pushed the version update and reverted the |
🎉 This PR is included in version 3.60.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
This adds Arcjet bot protection and attack detection, with custom rules depending on the route.
It uses the global error handler by default, but this can be customized. Instructions are in the
README
.The
tsconfig.json
type checking was looking in thenode_modules
directory because of theinclude
match patterns. Changing the match patterns to just consider files insrc
highlights a lot of errors in the existing files, so I opted to disable the checks for now because fixing them is out of scope of this PR.