@reliabilityworks/ruleset-nextjs 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +4 -0
- package/rules.json +38 -0
package/package.json
ADDED
package/rules.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"id": "nextjs/production-browser-sourcemaps",
|
|
4
|
+
"severity": "medium",
|
|
5
|
+
"title": "Source maps enabled in production",
|
|
6
|
+
"description": "Enabling production browser source maps can expose source code and application internals.",
|
|
7
|
+
"matcher": {
|
|
8
|
+
"type": "regex",
|
|
9
|
+
"fileGlobs": ["**/next.config.{js,cjs,mjs,ts}"],
|
|
10
|
+
"pattern": "productionBrowserSourceMaps\\s*:\\s*true",
|
|
11
|
+
"message": "productionBrowserSourceMaps appears to be enabled"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"id": "nextjs/next-public-secret-name",
|
|
16
|
+
"severity": "high",
|
|
17
|
+
"title": "Potential secret exposed via NEXT_PUBLIC_ env",
|
|
18
|
+
"description": "Environment variables prefixed with NEXT_PUBLIC_ are exposed to the browser. Names containing KEY/SECRET/TOKEN/PASSWORD are often secrets.",
|
|
19
|
+
"matcher": {
|
|
20
|
+
"type": "regex",
|
|
21
|
+
"fileGlobs": ["**/*.{js,jsx,ts,tsx}"],
|
|
22
|
+
"pattern": "\\bNEXT_PUBLIC_[A-Z0-9_]*(KEY|SECRET|TOKEN|PASSWORD)\\b",
|
|
23
|
+
"message": "NEXT_PUBLIC_ variable name suggests a secret may be exposed to the client"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"id": "nextjs/unsafe-revalidate-zero",
|
|
28
|
+
"severity": "medium",
|
|
29
|
+
"title": "Revalidate set to 0",
|
|
30
|
+
"description": "Using revalidate: 0 can disable caching and increase load; it can also be an indicator of misconfigured production caching.",
|
|
31
|
+
"matcher": {
|
|
32
|
+
"type": "regex",
|
|
33
|
+
"fileGlobs": ["**/*.{js,jsx,ts,tsx}"],
|
|
34
|
+
"pattern": "\\brevalidate\\s*:\\s*0\\b",
|
|
35
|
+
"message": "revalidate is set to 0"
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
]
|