<?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: Kshitij</title>
    <description>The latest articles on DEV Community by Kshitij (@kernelkain).</description>
    <link>https://dev.to/kernelkain</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%2F3953019%2F39f656d7-121d-4b3f-b768-8b352486b929.jpg</url>
      <title>DEV Community: Kshitij</title>
      <link>https://dev.to/kernelkain</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/kernelkain"/>
    <language>en</language>
    <item>
      <title>I Built a Tool to Detect Delayed Access Revocation</title>
      <dc:creator>Kshitij</dc:creator>
      <pubDate>Sun, 09 Aug 2026 20:16:36 +0000</pubDate>
      <link>https://dev.to/kernelkain/i-built-a-tool-to-detect-delayed-access-revocation-427d</link>
      <guid>https://dev.to/kernelkain/i-built-a-tool-to-detect-delayed-access-revocation-427d</guid>
      <description>&lt;p&gt;This weekend, I built &lt;strong&gt;TimeTrap&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;It started with a simple question:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;What if access is revoked, but something that depends on it stays active?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That small delay can become a real security problem.&lt;/p&gt;

&lt;p&gt;🔗 &lt;a href="https://web-2b33.prg1.zerops.app" rel="noopener noreferrer"&gt;Try TimeTrap live&lt;/a&gt;&lt;br&gt;&lt;br&gt;
💻 &lt;a href="https://github.com/kernelKain/timetrap" rel="noopener noreferrer"&gt;View the source code&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The problem
&lt;/h2&gt;

&lt;p&gt;Imagine a user cancels a premium subscription at minute 10.&lt;/p&gt;

&lt;p&gt;The subscription is revoked immediately, but a cached permission remains active until minute 60. The system allows a five-minute grace period.&lt;/p&gt;

&lt;p&gt;So the timeline looks like this:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Time&lt;/th&gt;
&lt;th&gt;What happens&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Minute 10&lt;/td&gt;
&lt;td&gt;Subscription is revoked&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Minute 15&lt;/td&gt;
&lt;td&gt;Allowed grace period ends&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Minute 60&lt;/td&gt;
&lt;td&gt;Cached access finally expires&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The user keeps premium access for 50 minutes after cancellation. Of those, &lt;strong&gt;45 minutes violate the rule&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Each part of the system may look correct by itself. The subscription was revoked, and the cache eventually expired. The problem is the gap between those two events.&lt;/p&gt;

&lt;p&gt;That is what TimeTrap finds.&lt;/p&gt;

&lt;h2&gt;
  
  
  What TimeTrap does
&lt;/h2&gt;

&lt;p&gt;You describe the objects in your authorization flow—subscriptions, caches, sessions, or tokens—and add events such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;issue&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;refresh&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;revoke&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;expire&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Then you choose a rule, such as “cached access must end within five minutes of subscription revocation.”&lt;/p&gt;

&lt;p&gt;TimeTrap checks the timeline and shows:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;whether the scenario is safe;&lt;/li&gt;
&lt;li&gt;the exact time the violation begins and ends;&lt;/li&gt;
&lt;li&gt;how long stale access remains active;&lt;/li&gt;
&lt;li&gt;the events that caused the problem;&lt;/li&gt;
&lt;li&gt;a suggested correction.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For the example above, TimeTrap reports the violation as &lt;code&gt;[15, 60)&lt;/code&gt; and suggests revoking the cached permission when the subscription is revoked.&lt;/p&gt;

&lt;p&gt;You can see the complete flow here:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://web-2b33.prg1.zerops.app/results/d28ecf3d-e28a-4538-a74c-d88d791d57fe" rel="noopener noreferrer"&gt;Unsafe result&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://web-2b33.prg1.zerops.app/results/1998c072-7095-4d5f-a45f-7a520a3d62c8" rel="noopener noreferrer"&gt;Corrected result&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  How it works
&lt;/h2&gt;

&lt;p&gt;The analyzer is written in Go and is fully deterministic. The same input always produces the same result.&lt;/p&gt;

&lt;p&gt;Instead of checking every minute, it checks only the moments where something can change: an issue, refresh, revocation, expiry, or rule deadline. It then joins failed periods into one clear violation interval.&lt;/p&gt;

&lt;p&gt;The rest of the application uses:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;React and TypeScript for the interface;&lt;/li&gt;
&lt;li&gt;Go for the API and analyzer;&lt;/li&gt;
&lt;li&gt;PostgreSQL for saved scenarios and results;&lt;/li&gt;
&lt;li&gt;Zerops for deployment.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Saved results use their own URLs, so they can be refreshed or shared. Applying a fix creates a corrected copy instead of replacing the original unsafe result.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I learned
&lt;/h2&gt;

&lt;p&gt;Authorization is not only about &lt;strong&gt;who can access something&lt;/strong&gt;. It is also about &lt;strong&gt;when that access should stop&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;TimeTrap is currently a design-time tool. It checks the scenario you provide; it does not inspect or change a live production system. The model is intentionally small and uses integer-minute timing, but it makes this easy-to-miss problem visible.&lt;/p&gt;

&lt;p&gt;OpenAI Codex helped me with planning, implementation, testing, documentation, and deployment. I still reviewed the code and verified the behavior through tests, builds, API checks, and browser testing.&lt;/p&gt;

&lt;p&gt;I built TimeTrap for the WeMakeDevs challenge and deployed it on Zerops.&lt;/p&gt;

&lt;p&gt;If this kind of authorization problem sounds familiar, try the demo and let me know what you think.&lt;/p&gt;

&lt;p&gt;👉 &lt;a href="https://web-2b33.prg1.zerops.app" rel="noopener noreferrer"&gt;Open TimeTrap&lt;/a&gt;&lt;br&gt;&lt;br&gt;
⭐ &lt;a href="https://github.com/kernelKain/timetrap" rel="noopener noreferrer"&gt;Explore the GitHub repository&lt;/a&gt;&lt;/p&gt;

</description>
      <category>go</category>
      <category>security</category>
      <category>react</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
