Dev.to Security 🔐 Cybersecurity 👁 0

Security middleware ships with ZinTrust. Turning it on is your job.

Here's what's in the box: Security headers: HSTS, Content-Security-Policy, X-Frame-Options, X-Content-Type-Options CORS: origin validation and preflight handling CSRF: double-submit cookie protection for anything th

Security middleware ships with ZinTrust. Turning it on is your job.


Here's what's in the box:

  • Security headers: HSTS, Content-Security-Policy, X-Frame-Options, X-Content-Type-Options
  • CORS: origin validation and preflight handling
  • CSRF: double-submit cookie protection for anything that changes state
  • XSS sanitization: strips HTML from incoming data, all the way down

Here's the part people miss: a fresh project doesn't turn any of these on for you. You register them globally, or attach them to the routes that need them.

Once they're on, a few things are worth checking:

  1. Set your CORS origins to the domains you actually serve, not *.
  2. Make sure your frontend sends the CSRF token on every write.
  3. Look over your CSP rules if you load third-party scripts.

And every time you add routes, look at what's actually registered on them. Having a middleware package installed doesn't mean a route is protected.

Try it: npm install -g @zintrust/core && zin new my-app

📰 Read the original article on Dev.to Security

Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.