You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: add lint-time security checks section to security best practices
Adds a short section on static analysis to the Production Best Practices:
Security page. It complements the existing runtime protections and
dependency scanning advice by covering lint-time detection of insecure
patterns (hardcoded secrets, unsafe redirects, missing cookie flags,
injection-prone string building).
Resolves#2471
Signed-off-by: METHILA M <260591810+methila-2056@users.noreply.github.com>
## Don't use deprecated or vulnerable versions of Express
@@ -304,6 +305,19 @@ Keep an eye out for [GitHub Advisory Database](https://github.com/advisories?que
304
305
305
306
Finally, Express apps—like any other web apps—can be vulnerable to a variety of web-based attacks. Familiarize yourself with known [web vulnerabilities](https://owasp.org/www-project-top-ten/) and take precautions to avoid them.
306
307
308
+
## Lint your code for security issues
309
+
310
+
Dependency scanning (as described above) checks the packages you install, but not the code you write. Static analysis tools catch insecure code patterns at lint time—before the code ships—such as:
311
+
312
+
- Hardcoded secrets and credentials in source code
313
+
- Unsafe redirects (see [Prevent open redirects](#prevent-open-redirects))
314
+
- Missing cookie security flags (see [Use cookies securely](#use-cookies-securely))
315
+
- Injection-prone string building for SQL queries or shell commands
316
+
317
+
Most Express apps already run [ESLint](https://eslint.org/) for code quality, and several ESLint plugins add security-focused rules on top of it. Run these checks in CI alongside your tests so that new violations fail the build.
318
+
319
+
Static analysis complements, but does not replace, the runtime protections described on this page, such as Helmet and dependency scanning.
320
+
307
321
## Additional considerations
308
322
309
323
Here are some further recommendations from the excellent [Node.js Security Checklist](https://blog.risingstack.com/node-js-security-checklist/). Refer to that blog post for all the details on these recommendations:
0 commit comments