<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Davanesh Saminathan</title>
    <description>The latest articles on DEV Community by Davanesh Saminathan (@davanesh).</description>
    <link>https://dev.to/davanesh</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3961295%2Fd9045060-87fc-457d-a464-fdf8733fd9d0.jpeg</url>
      <title>DEV Community: Davanesh Saminathan</title>
      <link>https://dev.to/davanesh</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/davanesh"/>
    <language>en</language>
    <item>
      <title>I Got Tired of Installing 5 Security Packages in Every Express Project</title>
      <dc:creator>Davanesh Saminathan</dc:creator>
      <pubDate>Tue, 02 Jun 2026 11:08:13 +0000</pubDate>
      <link>https://dev.to/davanesh/i-got-tired-of-installing-5-security-packages-in-every-express-project-309n</link>
      <guid>https://dev.to/davanesh/i-got-tired-of-installing-5-security-packages-in-every-express-project-309n</guid>
      <description>&lt;p&gt;Every time I started a new Express.js project, the first few minutes looked exactly the same.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install &lt;/span&gt;helmet
npm &lt;span class="nb"&gt;install &lt;/span&gt;express-rate-limit
npm &lt;span class="nb"&gt;install &lt;/span&gt;morgan
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then came the setup.&lt;/p&gt;

&lt;p&gt;Different middleware.&lt;/p&gt;

&lt;p&gt;Different configuration options.&lt;/p&gt;

&lt;p&gt;Different documentation.&lt;/p&gt;

&lt;p&gt;The process wasn't difficult, but after doing it repeatedly across multiple projects, it started to feel unnecessary.&lt;/p&gt;

&lt;p&gt;I wasn't building new features.&lt;/p&gt;

&lt;p&gt;I was rebuilding the same security foundation over and over again.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Pattern I Kept Seeing
&lt;/h2&gt;

&lt;p&gt;Most Express applications need the same baseline protections:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Security headers&lt;/li&gt;
&lt;li&gt;Rate limiting&lt;/li&gt;
&lt;li&gt;Request size limits&lt;/li&gt;
&lt;li&gt;Request logging&lt;/li&gt;
&lt;li&gt;Secure defaults&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Yet every project required installing and configuring multiple packages just to reach that baseline.&lt;/p&gt;

&lt;p&gt;For experienced developers, that's manageable.&lt;/p&gt;

&lt;p&gt;For beginners, it's often confusing.&lt;/p&gt;

&lt;p&gt;And in many projects, security gets postponed until much later in development.&lt;/p&gt;

&lt;p&gt;Sometimes it never gets added at all.&lt;/p&gt;

&lt;h2&gt;
  
  
  What If It Was Just One Package?
&lt;/h2&gt;

&lt;p&gt;At some point, I started asking a simple question:&lt;/p&gt;

&lt;p&gt;Why am I repeating the same setup every time?&lt;/p&gt;

&lt;p&gt;What if the common security protections could be enabled with a single middleware?&lt;/p&gt;

&lt;p&gt;Something as simple as:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;fortress&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;fortressjs&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;use&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;fortress&lt;/span&gt;&lt;span class="p"&gt;());&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That question eventually led to the creation of FortressJS.&lt;/p&gt;

&lt;h2&gt;
  
  
  Building FortressJS
&lt;/h2&gt;

&lt;p&gt;FortressJS started as a personal project to simplify Express API security.&lt;/p&gt;

&lt;p&gt;The goal wasn't to replace every security package in the Node.js ecosystem.&lt;/p&gt;

&lt;p&gt;The goal was much simpler:&lt;/p&gt;

&lt;p&gt;Provide sensible security defaults with minimal setup.&lt;/p&gt;

&lt;p&gt;Today, FortressJS includes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Security headers&lt;/li&gt;
&lt;li&gt;Rate limiting&lt;/li&gt;
&lt;li&gt;Request size protection&lt;/li&gt;
&lt;li&gt;Request logging&lt;/li&gt;
&lt;li&gt;Easy Express integration&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Installation:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install &lt;/span&gt;fortressjs
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Usage:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;express&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;express&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;fortress&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;fortressjs&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;app&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;express&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;use&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;fortress&lt;/span&gt;&lt;span class="p"&gt;());&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  What I Learned Building It
&lt;/h2&gt;

&lt;p&gt;Building FortressJS taught me several lessons.&lt;/p&gt;

&lt;h3&gt;
  
  
  Simplicity Is a Feature
&lt;/h3&gt;

&lt;p&gt;Developers don't want more configuration.&lt;/p&gt;

&lt;p&gt;They want fewer decisions.&lt;/p&gt;

&lt;p&gt;Reducing setup complexity can be just as valuable as adding new functionality.&lt;/p&gt;

&lt;h3&gt;
  
  
  Scope Can Kill Projects
&lt;/h3&gt;

&lt;p&gt;My initial ideas were much larger.&lt;/p&gt;

&lt;p&gt;Threat intelligence.&lt;/p&gt;

&lt;p&gt;Security dashboards.&lt;/p&gt;

&lt;p&gt;Advanced monitoring.&lt;/p&gt;

&lt;p&gt;But trying to build everything at once is how many projects fail.&lt;/p&gt;

&lt;p&gt;Starting small made it possible to actually ship something.&lt;/p&gt;

&lt;h3&gt;
  
  
  Open Source Is Different
&lt;/h3&gt;

&lt;p&gt;Writing code is only part of the work.&lt;/p&gt;

&lt;p&gt;Documentation, examples, testing, and feedback are just as important.&lt;/p&gt;

&lt;p&gt;A project nobody understands won't get used, regardless of how good the code is.&lt;/p&gt;

&lt;h2&gt;
  
  
  What's Next?
&lt;/h2&gt;

&lt;p&gt;The roadmap for FortressJS currently includes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Threat detection&lt;/li&gt;
&lt;li&gt;Security auditing CLI&lt;/li&gt;
&lt;li&gt;Security scoring&lt;/li&gt;
&lt;li&gt;Local monitoring dashboard&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The focus remains the same:&lt;/p&gt;

&lt;p&gt;Make API security easier for Node.js developers.&lt;/p&gt;

&lt;h2&gt;
  
  
  Final Thoughts
&lt;/h2&gt;

&lt;p&gt;FortressJS started because I was tired of repeating the same security setup in every Express project.&lt;/p&gt;

&lt;p&gt;Instead of doing it again, I decided to build a tool that could automate the process.&lt;/p&gt;

&lt;p&gt;The project is still in its early stages, and feedback is always welcome.&lt;/p&gt;

&lt;p&gt;⭐ GitHub: &lt;a href="https://github.com/davanesh/fortressjs" rel="noopener noreferrer"&gt;https://github.com/davanesh/fortressjs&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;📦 NPM Packages:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Core: &lt;a href="https://www.npmjs.com/package/@fortressjs/core" rel="noopener noreferrer"&gt;https://www.npmjs.com/package/@fortressjs/core&lt;/a&gt; — The main FortressJS package that provides security middleware, rate limiting, request protection, and secure defaults for Express applications.&lt;/li&gt;
&lt;li&gt;CLI: &lt;a href="https://www.npmjs.com/package/@fortressjs/cli" rel="noopener noreferrer"&gt;https://www.npmjs.com/package/@fortressjs/cli&lt;/a&gt; — Command-line tool for auditing, analyzing, and managing FortressJS security features.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you're building Express APIs, what security package do you install first?&lt;/p&gt;

</description>
      <category>node</category>
      <category>express</category>
      <category>security</category>
      <category>opensource</category>
    </item>
    <item>
      <title>10 Security Mistakes Most Express APIs Make (And How to Fix Them)</title>
      <dc:creator>Davanesh Saminathan</dc:creator>
      <pubDate>Tue, 02 Jun 2026 10:41:05 +0000</pubDate>
      <link>https://dev.to/davanesh/10-security-mistakes-most-express-apis-make-and-how-to-fix-them-4jki</link>
      <guid>https://dev.to/davanesh/10-security-mistakes-most-express-apis-make-and-how-to-fix-them-4jki</guid>
      <description>&lt;p&gt;Building APIs with Express.js is fast and enjoyable, but security is often treated as something to handle later. Unfortunately, small security mistakes can expose applications to attacks, data leaks, and service disruptions.&lt;/p&gt;

&lt;p&gt;In this article, we'll look at 10 common security mistakes developers make when building Express APIs and how to fix them.&lt;/p&gt;




&lt;h2&gt;
  
  
  1. Not Using Security Headers
&lt;/h2&gt;

&lt;p&gt;By default, Express does not add many security-related HTTP headers.&lt;/p&gt;

&lt;p&gt;Without proper headers, applications may be vulnerable to attacks such as clickjacking and MIME-type sniffing.&lt;/p&gt;

&lt;h3&gt;
  
  
  Fix
&lt;/h3&gt;

&lt;p&gt;Install Helmet:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install &lt;/span&gt;helmet
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Use it in your application:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;helmet&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;helmet&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;use&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;helmet&lt;/span&gt;&lt;span class="p"&gt;());&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  2. No Rate Limiting
&lt;/h2&gt;

&lt;p&gt;Without rate limiting, attackers can spam endpoints, brute-force login forms, or overwhelm your server.&lt;/p&gt;

&lt;h3&gt;
  
  
  Fix
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install &lt;/span&gt;express-rate-limit
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;rateLimit&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;express-rate-limit&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;limiter&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;rateLimit&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;windowMs&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;15&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;60&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;max&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;use&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;limiter&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  3. Exposing Stack Traces in Production
&lt;/h2&gt;

&lt;p&gt;Detailed error messages may reveal sensitive implementation details.&lt;/p&gt;

&lt;h3&gt;
  
  
  Bad Example
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;status&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;500&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;error&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;stack&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Better
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;status&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;500&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;error&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Internal Server Error&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Keep detailed logs on the server, not in client responses.&lt;/p&gt;




&lt;h2&gt;
  
  
  4. Trusting User Input
&lt;/h2&gt;

&lt;p&gt;Never trust incoming data.&lt;/p&gt;

&lt;p&gt;Attackers can send malformed requests, inject malicious payloads, or bypass assumptions.&lt;/p&gt;

&lt;h3&gt;
  
  
  Fix
&lt;/h3&gt;

&lt;p&gt;Validate all incoming requests using libraries such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Zod&lt;/li&gt;
&lt;li&gt;Joi&lt;/li&gt;
&lt;li&gt;express-validator&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;schema&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;object&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;email&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;string&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;email&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  5. Hardcoding Secrets
&lt;/h2&gt;

&lt;p&gt;One of the most common mistakes is storing secrets directly in source code.&lt;/p&gt;

&lt;h3&gt;
  
  
  Avoid
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;API_KEY&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;my-secret-key&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Better
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;API_KEY&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;API_KEY&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Store secrets in environment variables instead.&lt;/p&gt;




&lt;h2&gt;
  
  
  6. Missing Request Size Limits
&lt;/h2&gt;

&lt;p&gt;Attackers can send extremely large payloads and consume server resources.&lt;/p&gt;

&lt;h3&gt;
  
  
  Fix
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;use&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;express&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;limit&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;1mb&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;}));&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Choose limits appropriate for your application.&lt;/p&gt;




&lt;h2&gt;
  
  
  7. Using Outdated Dependencies
&lt;/h2&gt;

&lt;p&gt;Security vulnerabilities are regularly discovered in npm packages.&lt;/p&gt;

&lt;h3&gt;
  
  
  Fix
&lt;/h3&gt;

&lt;p&gt;Run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm audit
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And keep dependencies updated:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm update
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  8. Weak Authentication Practices
&lt;/h2&gt;

&lt;p&gt;Common mistakes include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Weak passwords&lt;/li&gt;
&lt;li&gt;Long-lived tokens&lt;/li&gt;
&lt;li&gt;Missing password hashing&lt;/li&gt;
&lt;li&gt;No multi-factor authentication&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Fix
&lt;/h3&gt;

&lt;p&gt;Use:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;bcrypt or Argon2 for password hashing&lt;/li&gt;
&lt;li&gt;JWT expiration times&lt;/li&gt;
&lt;li&gt;MFA where appropriate&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  9. No Logging or Monitoring
&lt;/h2&gt;

&lt;p&gt;If an incident occurs, logs are often the only way to understand what happened.&lt;/p&gt;

&lt;h3&gt;
  
  
  Fix
&lt;/h3&gt;

&lt;p&gt;Implement structured logging:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;morgan&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;morgan&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;use&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;morgan&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;combined&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Monitor unusual traffic patterns and failed authentication attempts.&lt;/p&gt;




&lt;h2&gt;
  
  
  10. Assuming HTTPS Is Optional
&lt;/h2&gt;

&lt;p&gt;HTTP traffic can be intercepted and modified.&lt;/p&gt;

&lt;h3&gt;
  
  
  Fix
&lt;/h3&gt;

&lt;p&gt;Always use HTTPS in production.&lt;/p&gt;

&lt;p&gt;If you're deploying behind a reverse proxy:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;trust proxy&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And enforce HTTPS wherever possible.&lt;/p&gt;




&lt;h1&gt;
  
  
  Final Thoughts
&lt;/h1&gt;

&lt;p&gt;Security isn't a feature you add at the end of a project. It should be part of the development process from day one.&lt;/p&gt;

&lt;p&gt;The good news is that most of these issues can be fixed with just a few lines of code.&lt;/p&gt;

&lt;p&gt;While exploring common Express security challenges, I've also been building &lt;strong&gt;FortressJS&lt;/strong&gt;, an open-source project focused on making API security easier for Node.js developers.&lt;/p&gt;

&lt;p&gt;What security mistake do you see most often in Express applications?&lt;/p&gt;

&lt;p&gt;Thanks for reading! 🚀&lt;/p&gt;

</description>
      <category>node</category>
      <category>express</category>
      <category>security</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
