<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Pulkit Vaishnav on Medium]]></title>
        <description><![CDATA[Stories by Pulkit Vaishnav on Medium]]></description>
        <link>https://medium.com/@pulkitvaishnav?source=rss-1c6dfef7ebca------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*inEfLKs_5M6hHqS5CA5-eA.png</url>
            <title>Stories by Pulkit Vaishnav on Medium</title>
            <link>https://medium.com/@pulkitvaishnav?source=rss-1c6dfef7ebca------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 18:37:27 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@pulkitvaishnav/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Beyond Endpoints: A Deep Dive into API Authorization Security]]></title>
            <link>https://medium.com/@pulkitvaishnav/beyond-endpoints-a-deep-dive-into-api-authorization-security-767c5b26070e?source=rss-1c6dfef7ebca------2</link>
            <guid isPermaLink="false">https://medium.com/p/767c5b26070e</guid>
            <category><![CDATA[security]]></category>
            <category><![CDATA[authorization]]></category>
            <category><![CDATA[api]]></category>
            <category><![CDATA[api-security]]></category>
            <category><![CDATA[owasp-top-10]]></category>
            <dc:creator><![CDATA[Pulkit Vaishnav]]></dc:creator>
            <pubDate>Mon, 01 Sep 2025 18:33:18 GMT</pubDate>
            <atom:updated>2025-09-01T18:42:21.878Z</atom:updated>
            <content:encoded><![CDATA[<p>When we talk about <strong>API security</strong>, the conversation often stops at securing endpoints, validating tokens, or encrypting traffic. While these are essential, the real challenge lies in <strong>authorization, </strong>ensuring that users can only perform actions and access resources they’re explicitly allowed to.</p><p>Authorization issues are consistently one of the <strong>top causes of API breaches</strong> (see OWASP API Security Top 10), and yet they are often underestimated. API security isn’t just about code or endpoints; it’s about <strong>inputs, behaviour, data processing, and business logic enforcement</strong> across the entire lifecycle.</p><p>Let’s break this down.</p><h3>The Role of Object-Level Authorization</h3><p>One of the most common API vulnerabilities is <strong>Broken Object-Level Authorization (BOLA)</strong>.</p><p>Consider this endpoint:</p><pre>GET https://example.com/user/&lt;user-id&gt;/profile</pre><p>If the application does not properly verify that the logged-in user has access to &lt;user-id&gt;, any user could modify the parameter and fetch someone else’s profile.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/994/1*hn_agmHX0hcZkck9DAkOWA.png" /></figure><h4>Why This Happens</h4><p>Developers often assume that because an API is authenticated, it is also authorized. That assumption is dangerous. <strong>Authentication ≠ Authorization</strong>. Every action on an object (read, update, delete) must validate that:</p><ul><li>The user is authorized to perform the requested action.</li><li>The user’s role and relationship to the object (ownership, group, etc.) are valid.</li></ul><h4>How to Strengthen It</h4><ul><li><strong>Policies &amp; Hierarchies:</strong> Apply strict RBAC (Role-Based Access Control) or ABAC (Attribute-Based Access Control).</li><li><strong>Unpredictable Identifiers:</strong> Use UUIDs instead of sequential IDs to make guessing object identifiers difficult. UUIDs reduce the risk of simple enumeration attacks but should always be combined with proper access checks.</li></ul><h3>The Danger of Excessive Data Exposure</h3><p>Even if authorization is correct, <strong>data exposure</strong> can compromise user privacy. For instance, a user profile may include fields like:</p><ul><li>Name, bio, profile picture ✅ (safe to expose)</li><li>Current IP, last login, social security number, passport details ❌ (sensitive, should remain private)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fsrL0mCSJN2zO4HsuCUJQg.png" /></figure><h4>Why This Matters</h4><p>Exposing sensitive data, intentionally or by accident, creates attack opportunities for <strong>phishing, account takeover, or privacy violations</strong>.</p><h4>Preventive Measures</h4><ul><li><strong>Public Data Policy:</strong> Define what can be safely exposed by default.</li><li><strong>Principle of Least Privilege:</strong> APIs should only return the <strong>bare minimum</strong> data required for business needs.</li><li><strong>Validate and Cherry-Pick Responses:</strong> Explicitly serialize only necessary fields. Never expose full database objects.</li></ul><h3>Mass Assignment &amp; Object Property Abuse</h3><p>APIs can also be vulnerable to <strong>Mass Assignment, </strong>when an attacker submits extra parameters to update object properties that should be off-limits.</p><p>Example:</p><pre>{<br>  &quot;username&quot;: &quot;alice&quot;,<br>  &quot;is_admin&quot;: true<br>}</pre><p>If the backend blindly binds the request body to the database model, Alice just made herself an administrator.</p><h4>How to Mitigate</h4><ul><li><strong>Don’t Trust the Client:</strong> Validate and sanitize every input.</li><li><strong>Cherry-Pick Allowed Properties (Fields):</strong> Explicitly define which fields are editable, for e.g. username, bio, profile picture.</li><li><strong>Separate Sensitive Endpoints:</strong> Critical updates (like roles or permissions) should have dedicated endpoints with stricter checks, parameters which are sensitive are kept behind this endpoint.</li></ul><h3>Broken Function Level Authorization</h3><p>Another critical flaw is <strong>Broken Function Level Authorization (BFLA), </strong>when APIs fail to enforce proper access control at the function or endpoint level.</p><p>This issue goes beyond “what data you can see” and focuses on “<strong>what actions you can perform”</strong>.</p><h3>Forms of BFLA</h3><ol><li><strong>Regular User Accessing Admin Functions:</strong></li></ol><ul><li>A ticketing app lets admins delete tickets via</li></ul><pre>DELETE /api/admin/tickets/{ticketId}</pre><ul><li>If the delete endpoint only checks if a user is logged in, a regular user could delete any ticket.</li></ul><p><strong>2. HTTP Method Manipulation</strong></p><ul><li>GET /api/products/123 retrieves product info.</li><li>Due to poor backend checks, sending DELETE /api/products/123 as a normal user deletes the product.</li></ul><p><strong>3. Group-Based Access Control Bypass</strong></p><ul><li>It happens when APIs don’t enforce role checks properly, allowing users from one group (e.g., Managers) to access data meant for another group (e.g., Analysts).</li><li><strong>For example</strong>, a Manager restricted to team reports could guess /api/reports/analyst/financial_data and view company-wide financials. The risk lies in developers relying on URL paths instead of backend authorization. The fix is to enforce strict role checks, deny by default, and validate every request against user roles and relationships.</li></ul><h3>5 Major Principles for Securing API Authorization</h3><ol><li><strong>Least Privilege: The “Need-to-Know” Rule</strong></li></ol><p>Think of your API like a secure building. Not everyone needs a master key. A receptionist only needs access to the lobby, while an IT admin may need server room access. Similarly, your API should only give users the bare minimum data and permissions they need to do their job, nothing more.</p><p>This limits the blast radius if something goes wrong. If a user account is compromised, the attacker doesn’t suddenly get the keys to the entire kingdom.</p><p><strong>2. Don’t Trust the Client: Assume They’re a Trickster</strong></p><p>Clients (browsers, mobile apps, scripts) can be tampered with. Attackers can craft malicious requests that look “normal” but are designed to exploit hidden weaknesses.</p><p>Always assume that the data coming in has been manipulated, even if it looks innocent. Validate everything. Just because someone hands you an ID card doesn’t mean you should let them in without checking if it’s real.</p><p><strong>3. Validate &amp; Cherry-Pick: Be Picky About What You Share and Accept</strong></p><p>When sending data back, only expose what’s necessary. Don’t dump the whole database record into a JSON response. If a user only needs a name and profile picture, don’t also include their email, last login time, or internal IDs.</p><p>When receiving data, only accept what you’ve explicitly defined as valid. If your form expects a “bio” field, don’t blindly accept an “is_admin” flag hidden in the request. Attackers love when you’re not selective, it’s like sneaking extra toppings onto a pizza order and hoping the chef doesn’t notice.</p><p><strong>4. Role &amp; Relationship Checks: Who Are You, and What’s Your Connection?</strong></p><p>Not all users are equal, and not all relationships are the same. A manager may see their team’s reports but not the entire company’s financials. A user may edit their own profile but never someone else’s.<br> Your API must constantly check:</p><ul><li>Does this user have the right role (e.g., admin vs. regular user)?</li><li>Do they have a valid relationship to the object (e.g., owner of the resource)?</li></ul><p>This ensures that permissions aren’t just based on “who you are” but also “what your relationship is” to the data.</p><p><strong>5. Deny by Default : Lock the Door Until Proven Safe</strong><br> Imagine leaving your house with the door wide open and hoping no one walks in. That’s what APIs do when they allow access by default.<br> Instead, flip the model: <strong>block everything by default, and only open access intentionally.</strong> This way, new endpoints or features aren’t accidentally exposed to the world. It’s safer to start with “no” and then carefully say “yes” where appropriate.</p><p>Securing an API goes beyond authentication and endpoint protection. It’s about <strong>holistic authorization</strong>: ensuring that every request, every action, and every response is governed by <strong>principles of least privilege, data minimization, and consistent access controls</strong>.</p><p>Yes, this adds steps for developers, but it also <strong>prevents data breaches, privilege escalations, and account takeovers</strong>. In the end, it’s not just about security, it’s about <strong>trust</strong>.</p><h3><strong>References:</strong></h3><ul><li><a href="https://owasp.org/API-Security/editions/2023/en/0x11-t10/">https://owasp.org/API-Security/editions/2023/en/0x11-t10/</a></li><li><a href="https://cheatsheetseries.owasp.org/cheatsheets/Authorization_Cheat_Sheet.html">https://cheatsheetseries.owasp.org/cheatsheets/Authorization_Cheat_Sheet.html</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=767c5b26070e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding AWS Credits Limits while Processing Millions of Requests]]></title>
            <link>https://medium.com/@pulkitvaishnav/understanding-aws-credits-limits-while-processing-millions-of-requests-3b1eef7781a9?source=rss-1c6dfef7ebca------2</link>
            <guid isPermaLink="false">https://medium.com/p/3b1eef7781a9</guid>
            <category><![CDATA[postgres]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[database]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[aws-ec2]]></category>
            <dc:creator><![CDATA[Pulkit Vaishnav]]></dc:creator>
            <pubDate>Fri, 07 Jul 2017 16:46:27 GMT</pubDate>
            <atom:updated>2017-07-07T16:54:01.409Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1hZhpiGDgClKdBreodkqIQ.jpeg" /></figure><blockquote>“A consumer doesn’t take anything away: he doesn’t actually consume anything. Giving the same thing to a thousand consumers is not really any more expensive than giving it to just one.”</blockquote><blockquote>- Linus Torvalds</blockquote><p><a href="https://en.wikipedia.org/wiki/Amazon_Web_Services">AWS</a> has numerous users with billions of revenue which makes it a competent market leader. In an efficient way like an onion having multiple layers and each layer is abstracting several sets of rules which control the performance of any <a href="https://en.wikipedia.org/wiki/Amazon_Elastic_Compute_Cloud">EC2 instance</a>. Each layer defines its own importance along with hidden rules which are not only rare but difficult to determine. We dealt with many such issues at <a href="http://hashgrowth.com/">HashGrowth</a> while deploying our database server. Among them one notable issue was weird increase in CPU steal time upto 60%. This problem led us to do some research and we found that we have been facing many hidden problems which were not only difficult to determine but also had a great impact over the server performance.</p><p>The story began when we were deploying database server for HashGrowth (an extensively write heavy product) in which we were aggregating data of 3 Million applications in ~25 relations.</p><p>We were using a t2.medium instance (of AWS) with 2 cores and 4 GB RAM as our database server, app servers, and celery workers (Python tool to run task asynchronously). Initially all things were going well and suddenly after few minutes our write time (of all ~25 relations) started to increase from 0.4 sec to 20 sec in 16 min. At the same time, CPU usage was varying between 30–40%.</p><p>“Writes are slower than reads.”</p><p>Taking this as a theory we started exploring, because of excessive writes in our product i.e. writes for 3 million apps in ~25 relations.</p><p>Next in our journey we met with these following problems:</p><h3>Lack of I/O per second</h3><h4>IOPS (Wikipedia definition):</h4><blockquote>Input/output operations per second (IOPS, pronounced eye-ops) is a performance measurement used to characterize computer storage devices like hard disk drives (HDD), solid state drives (SSD), and storage area networks (SAN).</blockquote><p>The first thing we discovered that write heavy applications needs more IOPS credits since the disk is the slowest element in the cycle which is not able to handle more concurrent writes. To verify this theory, we decided to increase <a href="https://en.wikipedia.org/wiki/IOPS">IOPS</a> using Provisioned IOPS aka PIOPS (a service provided by AWS for higher IOPS) of 15K IOPS/sec, this increased our 16 minutes time of systematic write to 30 minutes. But after 30 minutes we faced the very same problem of high write time. This was not a solution but it somewhat optimized our performance, which made us to set an effective number of IOPS.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nbvgmq0W01hi4bPxxJwARg.png" /><figcaption><strong>I/O Credits and Burst Performance(1) [</strong><a href="http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/images/gp2_iops.png"><strong>Source</strong></a><strong>]</strong></figcaption></figure><p>After having done an extensive research on EBS volumes, we found about the credit system in EBS volume, which provides 5.4 million IOPS and allows you to consume at max 3000 IOPS/sec which can burst up to 10000.This in turn fills the credit bucket at rate of 3 IOPS/GB.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/638/1*MqTKA0eKeOzPAc9YZY1zwQ.jpeg" /><figcaption><strong>I/O Credits and Burst Performance(2) [</strong><a href="http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSVolumeTypes.html"><strong>Source</strong></a><strong>: AWS EBS ]</strong></figcaption></figure><p>For example, if you have 300GB volume the bucket will fill by 900 IOPS/sec (3 IOPS * 300 GB). In our case the credits will get exhausted in 30 min by 3000 IOPS/sec, therefore we need 3000 IOPS/sec which will be possible only when we have a volume of 1000GB. In this way, we got 3000 IOPS constantly, after adding a 1000GB EBS volume. We fulfilled the IOPS shortage problem, but we didn’t achieve our goal of fast processing constantly since speed started to reduce after a certain time.</p><h3><strong>Weird CPU Performance</strong></h3><p>As we started monitoring the server’s resources closely, we found that the RAM usage by the server was constant throughout the process.</p><p>Whereas the CPU usage was different at different points. When we started saving our data to the database, the CPU utilization was at 70–100% which got decreased to 10–40% after 30 minutes. Which you may consider normal, right? Except that is not the case with AWS because to give equal performance to all servers on the shared resources AWS throttles CPU usage and starts to steal resources from the VM.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/687/1*gVjHR-8kKPxMMNK0mzCwGQ.png" /><figcaption><strong>Steal time of server [Source: HashGrowth database server]</strong></figcaption></figure><h4>Steal Time (manual refer to it as):</h4><blockquote>st : time stolen from this vm by the hypervisor</blockquote><p>Steal time is the time hypervisor scheduled to perform some other operations instead of operation within VM. This time can be time for another VM or hypervisor itself. In layman terms, this condition only arise when system have the lack of computing resources (i.e. CPU).</p><p>In AWS-EC2 this is not the case, steal is not based on the other VM’s activities. It is an intentional approach of EC2 to make sure users won’t get more CPU resources than they are paying for. Here, EC2 instances bifurcate CPU into two main units vCPU and ECU (Elastic Compute Unit). The vCPUs are the shared cores with the ECU (where one ECU provides the equivalent CPU capacity of a 1.0–1.2 GHz 2007 Opteron or 2007 Xeon processor). The ratio of vCPU and ECU governs the capabilities of the instances. Since the AWS provides credit points to each server on the hourly basis which varies from 3–81 credits points:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/706/1*YCzyTcMFbR_LwKr_eMnX8A.png" /><figcaption><strong>Credits on different T2 instances [</strong><a href="http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/t2-instances.html"><strong>Source</strong></a><strong>: AWS EC2 User Guide]</strong></figcaption></figure><p>These credits points are stored by AWS and whenever you have an extra load on your server the CPU usage burst its performance using these credits. Hence before choosing any random <em>t2.*</em> type server just look at the desired instance type maximum CPU usage.</p><p>In our case when we were getting the performance of 70–100% CPU usage that was just because of the initial CPU burst (i.e. because of initial CPU credits) and once we had finished all those credits the CPU performance got decreased and our write time got optimised on the database server.</p><h3>Conclusion</h3><p>After doing some back-of-the-envelope calculations:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/425/1*-1Bs_tN7P5O4jRtGzrXz1g.png" /></figure><p>We calculated that 1000 GB will give us enough IOPS (3000 IOPS/sec) which won’t exceed credits limit even on maximum pressure. To get an optimal server size we ran some experiments with different sizes of servers, and calculated that server size of m4.large instance (i.e. with 2 cores and 8GB RAM) will be adequate for our data server. In this way, we solved our problem of high write time on our database server.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3b1eef7781a9" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>