<?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: Vignesh Nagarajan</title>
    <description>The latest articles on DEV Community by Vignesh Nagarajan (@vignesh_nagarajan).</description>
    <link>https://dev.to/vignesh_nagarajan</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.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1565300%2F986fa84c-c8e6-4acd-8e74-5777a3246a89.png</url>
      <title>DEV Community: Vignesh Nagarajan</title>
      <link>https://dev.to/vignesh_nagarajan</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/vignesh_nagarajan"/>
    <language>en</language>
    <item>
      <title>🔐 How to Prevent Expired JWT Token Reuse and API Authorization Bypass?</title>
      <dc:creator>Vignesh Nagarajan</dc:creator>
      <pubDate>Wed, 12 Aug 2026 09:40:37 +0000</pubDate>
      <link>https://dev.to/vignesh_nagarajan/how-to-prevent-expired-jwt-token-reuse-and-api-authorization-bypass-5hf7</link>
      <guid>https://dev.to/vignesh_nagarajan/how-to-prevent-expired-jwt-token-reuse-and-api-authorization-bypass-5hf7</guid>
      <description>&lt;p&gt;I’m looking for suggestions from &lt;strong&gt;developers, security engineers, and penetration testers&lt;/strong&gt; who have handled similar issues in production applications.&lt;/p&gt;

&lt;p&gt;I recently came across an interesting security scenario involving &lt;strong&gt;JWT token reuse, session termination, and Burp Suite response manipulation&lt;/strong&gt;.&lt;/p&gt;





&lt;h2&gt;1️⃣ The Scenario&lt;/h2&gt;

&lt;p&gt;My application has:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;⚛️ React frontend&lt;/li&gt;
  &lt;li&gt;☕ Spring Boot backend&lt;/li&gt;
  &lt;li&gt;🔑 JWT-based authentication&lt;/li&gt;
  &lt;li&gt;🌐 HTTPS&lt;/li&gt;
  &lt;li&gt;🛡️ Role and permission-based authorization&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;During security testing, the tester captures a valid access token and attempts to reuse it after the token has expired or the session has been terminated.&lt;/p&gt;

&lt;h3&gt;Expected behavior&lt;/h3&gt;

&lt;pre&gt;&lt;code&gt;User Login
    ↓
Access Token Issued
    ↓
Token Expires / Session Terminates
    ↓
Old Token Becomes Invalid
    ↓
Attacker Replays Old Token
    ↓
Backend Rejects Request
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The main requirement is:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;strong&gt;An expired, revoked, or terminated token must never be accepted for a protected API operation.&lt;/strong&gt;
&lt;/blockquote&gt;





&lt;h2&gt;2️⃣ The Interesting Part — Burp Suite&lt;/h2&gt;

&lt;p&gt;There is another aspect that makes this scenario interesting.&lt;/p&gt;

&lt;p&gt;Suppose the backend correctly identifies the token as invalid and returns:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;HTTP/1.1 401 Unauthorized&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The tester can intercept the response using Burp Suite and change it to:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;HTTP/1.1 200 OK&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;before the response reaches the React application.&lt;/p&gt;

&lt;h3&gt;Flow&lt;/h3&gt;

&lt;pre&gt;&lt;code&gt;Attacker
    ↓
Expired / Invalid Token
    ↓
Spring Boot
    ↓
401 Unauthorized
    ↓
Burp Suite
    ↓
401 → 200
    ↓
React receives modified response
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;I understand that the &lt;strong&gt;browser is an untrusted environment&lt;/strong&gt; and that an attacker controlling their browser can modify HTTP requests and responses.&lt;/p&gt;

&lt;p&gt;However, my question is:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;strong&gt;What is the industry-standard approach to ensure that this type of manipulation cannot result in an actual unauthorized server-side operation?&lt;/strong&gt;
&lt;/blockquote&gt;





&lt;h2&gt;3️⃣ What I Have Already Considered&lt;/h2&gt;

&lt;h3&gt;🔑 Authentication&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;Short-lived access tokens&lt;/li&gt;
  &lt;li&gt;JWT signature validation&lt;/li&gt;
  &lt;li&gt;JWT expiration validation&lt;/li&gt;
  &lt;li&gt;Refresh-token rotation&lt;/li&gt;
  &lt;li&gt;HttpOnly + Secure cookies&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;🚫 Token / Session Management&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;Server-side session invalidation&lt;/li&gt;
  &lt;li&gt;Token/session versioning&lt;/li&gt;
  &lt;li&gt;Token revocation&lt;/li&gt;
  &lt;li&gt;Invalidating previously issued tokens after logout&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;👮 Authorization&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;Permission validation on every protected API&lt;/li&gt;
  &lt;li&gt;Role-based authorization&lt;/li&gt;
  &lt;li&gt;Server-side authorization&lt;/li&gt;
  &lt;li&gt;Never trusting frontend role/permission information&lt;/li&gt;
&lt;/ul&gt;





&lt;h2&gt;4️⃣ Token Replay Scenario&lt;/h2&gt;

&lt;p&gt;For example, suppose an attacker captures:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;Token A&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Later:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;Token A
   ↓
Expires / Session Terminated
   ↓
Attacker Replays Token A
   ↓
Protected API
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The backend should independently validate:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;JWT Signature
      ↓
Expiration
      ↓
Session Validity
      ↓
Token Status
      ↓
User Status
      ↓
Permission
      ↓
Business Authorization
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Only if all validations succeed should the operation be performed.&lt;/p&gt;





&lt;h2&gt;5️⃣ Expected Security Model 🛡️&lt;/h2&gt;

&lt;pre&gt;&lt;code&gt;Attacker Captures Token A
          ↓
Token A Expires / Session Terminates
          ↓
Attacker Replays Token A
          ↓
Backend Independently Validates
          │
          ├── 🔑 JWT Signature
          ├── ⏳ Expiration
          ├── 🔒 Session Validity
          ├── 🚫 Token Status
          ├── 👤 User Status
          └── 👮 Authorization
                  ↓
               REJECT
                  ↓
       Protected Operation NOT Performed
&lt;/code&gt;&lt;/pre&gt;





&lt;h2&gt;6️⃣ JWT vs Session-Based Authentication&lt;/h2&gt;

&lt;p&gt;This also raises an architectural question.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
  &lt;tbody&gt;
&lt;tr&gt;
    &lt;th&gt;Approach&lt;/th&gt;
    &lt;th&gt;Token Revocation&lt;/th&gt;
    &lt;th&gt;Replay Protection&lt;/th&gt;
    &lt;th&gt;Complexity&lt;/th&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;Long-lived JWT&lt;/td&gt;
    &lt;td&gt;Hard&lt;/td&gt;
    &lt;td&gt;Weak&lt;/td&gt;
    &lt;td&gt;Low&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;Short-lived JWT&lt;/td&gt;
    &lt;td&gt;Better&lt;/td&gt;
    &lt;td&gt;Better&lt;/td&gt;
    &lt;td&gt;Medium&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;JWT + Server-side Session&lt;/td&gt;
    &lt;td&gt;Strong&lt;/td&gt;
    &lt;td&gt;Strong&lt;/td&gt;
    &lt;td&gt;Medium&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;Opaque Session Token&lt;/td&gt;
    &lt;td&gt;Strong&lt;/td&gt;
    &lt;td&gt;Strong&lt;/td&gt;
    &lt;td&gt;Medium&lt;/td&gt;
  &lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;





&lt;h2&gt;7️⃣ Refresh Token Replay 🔄&lt;/h2&gt;

&lt;p&gt;Another area I am particularly interested in is refresh-token reuse.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;Refresh Token A
      ↓
Refresh Request
      ↓
Token A Invalidated
      ↓
Refresh Token B Issued
      ↓
Attacker Reuses Token A
      ↓
Replay Detected
      ↓
Reject / Terminate Session
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;What is the recommended production approach for detecting and handling this type of refresh-token replay?&lt;/p&gt;





&lt;h2&gt;8️⃣ My Questions to the Community ❓&lt;/h2&gt;

&lt;ol&gt;
  &lt;li&gt;
    &lt;strong&gt;What is the recommended architecture for preventing JWT replay/token reuse after logout or session termination?&lt;/strong&gt;
  &lt;/li&gt;

  &lt;li&gt;
    &lt;strong&gt;Is JWT alone appropriate when immediate token invalidation is required?&lt;/strong&gt;
  &lt;/li&gt;

  &lt;li&gt;
    &lt;strong&gt;Should access tokens be short-lived with refresh-token rotation?&lt;/strong&gt;
  &lt;/li&gt;

  &lt;li&gt;
    &lt;strong&gt;What is the recommended way to invalidate previously issued access tokens?&lt;/strong&gt;
  &lt;/li&gt;

  &lt;li&gt;
    &lt;strong&gt;How should a backend detect and handle refresh-token replay?&lt;/strong&gt;
  &lt;/li&gt;

  &lt;li&gt;
    &lt;strong&gt;Would opaque/session-based tokens be a better alternative when strong revocation is required?&lt;/strong&gt;
  &lt;/li&gt;

  &lt;li&gt;
    &lt;strong&gt;From a penetration-testing perspective, what is the standard remediation when a previously issued token can still be reused?&lt;/strong&gt;
  &lt;/li&gt;

  &lt;li&gt;
    &lt;strong&gt;If the backend correctly returns 401 but Burp changes it to 200 before it reaches React, is there an accepted way to prevent the frontend from trusting the manipulated response?&lt;/strong&gt;
  &lt;/li&gt;
&lt;/ol&gt;





&lt;h2&gt;9️⃣ The Important Distinction&lt;/h2&gt;

&lt;p&gt;I understand that these are two different scenarios:&lt;/p&gt;

&lt;h3&gt;Scenario A — Response Manipulation&lt;/h3&gt;

&lt;pre&gt;&lt;code&gt;Backend
   ↓
401 Unauthorized
   ↓
Burp Suite
   ↓
401 → 200
   ↓
React
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This may fool the &lt;strong&gt;client-side UI&lt;/strong&gt;, because the browser is controlled by the attacker.&lt;/p&gt;

&lt;h3&gt;Scenario B — Actual Authorization Bypass 🚨&lt;/h3&gt;

&lt;pre&gt;&lt;code&gt;Expired / Revoked Token
        ↓
Protected API
        ↓
Backend Accepts Request
        ↓
Unauthorized Operation Executed
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;My primary concern is &lt;strong&gt;Scenario B&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Even if an attacker can manipulate the frontend or HTTP response, the backend should remain the final security boundary and must never perform an unauthorized operation.&lt;/p&gt;





&lt;h2&gt;🔟 What I Am Looking For&lt;/h2&gt;

&lt;p&gt;I would particularly appreciate feedback from people who have:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;🛡️ Handled penetration-testing findings&lt;/li&gt;
  &lt;li&gt;🔐 Designed authentication/session architectures&lt;/li&gt;
  &lt;li&gt;☕ Implemented Spring Security&lt;/li&gt;
  &lt;li&gt;⚛️ Secured React applications&lt;/li&gt;
  &lt;li&gt;🏢 Built authentication systems for production applications&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I’m interested in &lt;strong&gt;real-world solutions and architecture patterns&lt;/strong&gt;, rather than only theoretical recommendations.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Tech Stack:&lt;/strong&gt; ⚛️ React + ☕ Spring Boot + 🔑 JWT&lt;/p&gt;

&lt;p&gt;Would appreciate any practical recommendations, security standards, or real-world experience with this type of security finding. 🙏&lt;/p&gt;





&lt;h2&gt;💬 Final Question&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;How would you design the authentication and authorization architecture so that a captured, expired, revoked, or previously terminated token can never be reused to perform a protected operation — even when the attacker controls the browser and uses Burp Suite to manipulate the HTTP traffic?&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>programming</category>
      <category>productivity</category>
      <category>web3</category>
    </item>
    <item>
      <title>REST vs GraphQL vs gRPC — Which One Should You Really Use?</title>
      <dc:creator>Vignesh Nagarajan</dc:creator>
      <pubDate>Wed, 17 Dec 2025 10:52:32 +0000</pubDate>
      <link>https://dev.to/vignesh_nagarajan/rest-vs-graphql-vs-grpc-which-one-should-you-really-use-248i</link>
      <guid>https://dev.to/vignesh_nagarajan/rest-vs-graphql-vs-grpc-which-one-should-you-really-use-248i</guid>
      <description>&lt;p&gt;`&lt;/p&gt;
&lt;h1&gt;REST vs GraphQL vs gRPC — Which One Should You Really Use?&lt;/h1&gt;

&lt;p&gt;Every few months, the same question comes back:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;“Which API style is best — REST, GraphQL, or gRPC?”&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The honest answer is: &lt;strong&gt;there is no single best option&lt;/strong&gt;.&lt;br&gt;
Each one solves a different problem.&lt;/p&gt;

&lt;p&gt;Let’s break it down without hype, based on real-world usage.&lt;/p&gt;




&lt;h2&gt;1️⃣ REST — The Reliable Default&lt;/h2&gt;

&lt;p&gt;REST is still the most widely used API style.&lt;/p&gt;

&lt;h3&gt;Why developers still choose REST&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;Simple and predictable&lt;/li&gt;
  &lt;li&gt;Human-readable JSON&lt;/li&gt;
  &lt;li&gt;Excellent tooling (Postman, curl, browser)&lt;/li&gt;
  &lt;li&gt;Easy caching and debugging&lt;/li&gt;
  &lt;li&gt;Works everywhere&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Where REST struggles&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;Over-fetching data&lt;/li&gt;
  &lt;li&gt;Multiple API calls for complex UI screens&lt;/li&gt;
&lt;/ul&gt;

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

&lt;pre&gt;&lt;code&gt;GET /institutions/123/users&lt;/code&gt;&lt;/pre&gt;

&lt;h3&gt;Best use cases&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;CRUD-heavy applications&lt;/li&gt;
  &lt;li&gt;Admin panels&lt;/li&gt;
  &lt;li&gt;Public APIs&lt;/li&gt;
  &lt;li&gt;Third-party integrations&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;2️⃣ GraphQL — UI-First APIs&lt;/h2&gt;

&lt;p&gt;GraphQL lets the client ask for exactly what it needs — no more, no less.&lt;/p&gt;

&lt;h3&gt;Why teams adopt GraphQL&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;No over-fetching or under-fetching&lt;/li&gt;
  &lt;li&gt;Single endpoint&lt;/li&gt;
  &lt;li&gt;Perfect for React / mobile apps&lt;/li&gt;
  &lt;li&gt;Strongly typed schema&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Trade-offs&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;More complex backend&lt;/li&gt;
  &lt;li&gt;Caching is harder than REST&lt;/li&gt;
  &lt;li&gt;Needs careful authorization design&lt;/li&gt;
&lt;/ul&gt;

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

&lt;pre&gt;&lt;code&gt;query {
  institution(id: "123") {
    name
    users {
      name
      roles {
        name
      }
    }
  }
}&lt;/code&gt;&lt;/pre&gt;

&lt;h3&gt;Best use cases&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;Frontend-heavy applications&lt;/li&gt;
  &lt;li&gt;Dashboards&lt;/li&gt;
  &lt;li&gt;Mobile apps&lt;/li&gt;
  &lt;li&gt;Aggregated UI data&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;3️⃣ gRPC — Built for Performance&lt;/h2&gt;

&lt;p&gt;gRPC is designed for service-to-service communication.&lt;/p&gt;

&lt;h3&gt;Why gRPC shines&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;Extremely fast (binary protocol)&lt;/li&gt;
  &lt;li&gt;Smaller payloads than JSON&lt;/li&gt;
  &lt;li&gt;Strong typing with Protobuf&lt;/li&gt;
  &lt;li&gt;Streaming support&lt;/li&gt;
  &lt;li&gt;HTTP/2 by default&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Limitations&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;Not browser-friendly&lt;/li&gt;
  &lt;li&gt;Harder to debug manually&lt;/li&gt;
  &lt;li&gt;Requires contract-first thinking&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Example (Proto)&lt;/h3&gt;

&lt;pre&gt;&lt;code&gt;rpc GetUser (UserRequest) returns (UserResponse);&lt;/code&gt;&lt;/pre&gt;

&lt;h3&gt;Best use cases&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;Microservices&lt;/li&gt;
  &lt;li&gt;High-throughput systems&lt;/li&gt;
  &lt;li&gt;Internal APIs&lt;/li&gt;
  &lt;li&gt;Event streaming&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;4️⃣ The Best Architecture Is Hybrid (Not Religious)&lt;/h2&gt;

&lt;p&gt;In real production systems, teams don’t choose one — they combine them.&lt;/p&gt;

&lt;h3&gt;A common enterprise setup&lt;/h3&gt;

&lt;pre&gt;&lt;code&gt;Frontend (Web / Mobile)
        ↓
     GraphQL Gateway
        ↓
REST APIs     gRPC Services&lt;/code&gt;&lt;/pre&gt;

&lt;h3&gt;Why this works&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;UI gets flexible data → GraphQL&lt;/li&gt;
  &lt;li&gt;Internal services stay fast → gRPC&lt;/li&gt;
  &lt;li&gt;External APIs remain simple → REST&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;5️⃣ Decision Cheat Sheet&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
  &lt;tbody&gt;&lt;tr&gt;
    &lt;th&gt;Question&lt;/th&gt;
    &lt;th&gt;Choose&lt;/th&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;Public API?&lt;/td&gt;
    &lt;td&gt;REST&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;UI-driven data needs?&lt;/td&gt;
    &lt;td&gt;GraphQL&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;Microservice → Microservice?&lt;/td&gt;
    &lt;td&gt;gRPC&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;Performance critical?&lt;/td&gt;
    &lt;td&gt;gRPC&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;Simple CRUD?&lt;/td&gt;
    &lt;td&gt;REST&lt;/td&gt;
  &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;6️⃣ Common Mistakes to Avoid 🚫&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;Using GraphQL for everything&lt;/li&gt;
  &lt;li&gt;Using REST between internal microservices&lt;/li&gt;
  &lt;li&gt;Exposing gRPC directly to browsers&lt;/li&gt;
  &lt;li&gt;Ignoring caching and security implications&lt;/li&gt;
&lt;/ul&gt;




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

&lt;p&gt;Each API style exists for a reason.&lt;/p&gt;

&lt;p&gt;Good architecture is about using the right tool in the right place — not following trends.&lt;/p&gt;

&lt;p&gt;If you’re building modern systems:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Use REST for simplicity&lt;/li&gt;
  &lt;li&gt;Use GraphQL for frontend efficiency&lt;/li&gt;
  &lt;li&gt;Use gRPC for internal performance&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;`&lt;/p&gt;

</description>
      <category>programming</category>
      <category>productivity</category>
      <category>web3</category>
    </item>
  </channel>
</rss>
