<?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 Sumanth Bettadapura on Medium]]></title>
        <description><![CDATA[Stories by Sumanth Bettadapura on Medium]]></description>
        <link>https://medium.com/@sumanthbettadapura?source=rss-223b42591c98------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*lHx_chri9_wP_B0_ZFl3Hg.png</url>
            <title>Stories by Sumanth Bettadapura on Medium</title>
            <link>https://medium.com/@sumanthbettadapura?source=rss-223b42591c98------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 10:05:40 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sumanthbettadapura/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[Decoding Security: Secrets Manager or Environment Variables?]]></title>
            <link>https://medium.com/smallcase-engineering/decoding-security-secret-manager-or-environment-variables-9b9beb7c35b7?source=rss-223b42591c98------2</link>
            <guid isPermaLink="false">https://medium.com/p/9b9beb7c35b7</guid>
            <category><![CDATA[aws-secrets-manager]]></category>
            <category><![CDATA[gcp-secret-manager]]></category>
            <dc:creator><![CDATA[Sumanth Bettadapura]]></dc:creator>
            <pubDate>Wed, 24 Apr 2024 07:24:34 GMT</pubDate>
            <atom:updated>2024-05-19T05:54:10.604Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ek9kefgkVSvXIPh0_b_6Vw.png" /></figure><p>Let me tell you how I ended up at a point where I started using Secrets Manager.</p><p>I was building my portfolio application (<a href="http://www.summy.dev/">summy.dev</a>) and I wanted to use some 3rd party apis for my application. I wanted to store the access tokens and as a common Joe, I was storing it in environment variables while the application was in development phase. I wanted to take it live with my infra set up at Google App Engine and my CI/CD via GitHub action.</p><p>I broke my back trying to figure out how to inject environment variables to Google App Engine in a safe and secure manner. A lot of digging went through but I couldn’t discover options that were simpler safer than what I was already doing. Some suggested having it over the yml config of App Engine and to inject into environment from there or to have it in my CI/CD process to inject the environment variables.</p><p>All these methods had one thing in common — <em>They asked me to keep my secret access token in code repository</em>. Nope! that’s not safe right as I already mentioned.</p><p>How about setting up environment variables directly in App Engine? Sounds safe enough to me but App Engine doesn’t support that.</p><p>Whaat?!</p><p>Yes! I too had the same expression. How can it not support something as crucially required as environment variables for secrets storage? then I discovered a few videos on YouTube by Google to understand the <strong>why</strong> part of it. I highly recommend you <a href="https://www.youtube.com/watch?v=JIE89dneaGo&amp;t=61s">watch this video</a>.</p><p>Let’s dig in!</p><p>The key difference between using a Secrets Manager v/s Environment Variables can be split up into three key areas.</p><ul><li>Security</li><li>Flexibility</li><li>Management Capabilities</li></ul><h3>Security</h3><p><strong>Environment Variables</strong></p><p>Well I do agree that environment variables are pretty convenient to use especially for storing sensitive information such as API Secret tokens, DB access keys etc but the main drawback of it is they can potentially be accessed and abused by anyone with access to the system and or through logging mechanisms.</p><p><strong>Secrets Manager</strong></p><p>The best thing about this is it provides a secure means to store secrets by encrypting them at rest and in transit. Along with that it provides other value added services like fine grained access control, auditing, rotation policy etc. enhancing overall security.</p><h3>Flexibility</h3><p><strong>Environment Variables</strong></p><p>They are typically straight forward to use. They can be used in applications without any additional setups to be done but the catch is they become nerve wrecking when you have to maintain large number of keys multiplied by different/multiple environments.</p><p><strong>Secrets Manager</strong></p><p>Best thing about this is it offers more flexibility when it comes to managing secrets centrally. It allows you to store not just key-value pairs but as well complex data structures. It tops it up by providing APIs and SDKs for accessing secrets programatically making integrations with your apps much easier.</p><h3>Management</h3><p><strong>Environment Variables</strong></p><p>Environment variables might be quickest way to get started easily but managing them becomes tough as it often involves manual processes such as updating configurations on each system individually which might result in inconsistencies and potential security risks if not handled properly since it involves human intervention.</p><p><strong>Secrets Manager</strong></p><p>Since it is centralized management for secrets allowing us to easily CRUD secrets through its interface or APIs and also it supports neat features like automatic rotation of secrets, helping us maintain secrets without human intervention.</p><h3>Summary</h3><p>For storing secret, a Secrets Manager is the best choice.</p><p>Secrets Manager services are available with Google Cloud Program as well as with AWS.</p><p>P.S — Feel free to reach out to me if you need hand in setting up secrets manager in your application.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9b9beb7c35b7" width="1" height="1" alt=""><hr><p><a href="https://medium.com/smallcase-engineering/decoding-security-secret-manager-or-environment-variables-9b9beb7c35b7">Decoding Security: Secrets Manager or Environment Variables?</a> was originally published in <a href="https://medium.com/smallcase-engineering">smallcase Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[UPI & QR Codes — A cool new tool for fraudsters?]]></title>
            <link>https://medium.com/@sumanthbettadapura/upi-qr-codes-a-cool-new-tool-to-fraud-638ae284291?source=rss-223b42591c98------2</link>
            <guid isPermaLink="false">https://medium.com/p/638ae284291</guid>
            <category><![CDATA[upi-payment]]></category>
            <category><![CDATA[cybercrime]]></category>
            <category><![CDATA[online-fraud]]></category>
            <category><![CDATA[upi]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[Sumanth Bettadapura]]></dc:creator>
            <pubDate>Sat, 02 Apr 2022 03:23:02 GMT</pubDate>
            <atom:updated>2022-04-02T04:31:31.602Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VG1QVHleH0IQFWdvY3CtTw.png" /></figure><p>To set the context for those who do not know, In India, The most frequently used mode of transaction these days is UPI, be it shopping for groceries roadside or paying bills at a pub, or shopping in a mall, everywhere this mode of payment is accepted.</p><p>The receiver would have a payment address in the format of XXXXXX@bank linked to his bank account and to that address payment can be made by other UPI accounts, and on a regular day, a common man in India would be scanning numerous QR codes for sending in the cash.</p><h3>Where does the new scam technique occur?</h3><p>The crucial point which I want to point out here is, It is a common thing for a person in India to scan the QR code which contains the UPI address and make the payment to that UPI address via desired payment apps such as phonePe, google pay, etc., and what we have to notice is, it is little uncommon for a common person to receive money from others as a day-to-day business transaction and this is the stuff that would be taken as advantage by the fraudsters.</p><h3>How does it happen?</h3><p>Here goes a story of an incident that happened to a friend of mine XYZ, so one day my friend XYZ wanted to sell an item that she no longer needed and she listed that item on some of the online markets such as Facebook, Olx, and Quikr,</p><p>and these ads are publicly visible and she had also listed her contact details,</p><p>and this is where the fraudster’s swindle starts, the scammer noticed the advertisement and called my friend XYZ as an imposter who liked the item which was listed and wanted to purchase the item and XYZ became happy that someone was interested in that item and can finally get rid of it and make some penny out of it, now the crucial part comes, the fraudster sends XYZ the QR code and asks to scan the QR code and Enter the UPI Pin and the amount would get credited to the account and XYZ being in spur of the moment scans the QR code and enters her UPI pin and submits and BHAM!</p><h3><strong>XYZ Just became a victim of fraud!</strong></h3><p>What happened here is that XYZ instead of receiving the payment, sent the amount to the fraudster and she realized this as soon as she got notified by SMS from her bank saying that XXXX amount have been debited from her account.</p><h3>Why it was so easy to trick this person into the trap?</h3><p>As a common joe, she was used to sending the money by scanning the QR code and she never before had received money from someone, at least as a trade and subconsciously she scanned the QR code and entered the PIN and fell into the trap.</p><p>Another thing about these UPI Payment QR codes is that they can be coded the payment amount along with the UPI address so that the payee can just scan and enter the UPI pin and don’t need to enter the payment amount, but this is too rare of a scenario where the QR code would be coded with payment amount usually, this adds another layer of dubiety for the person being scammed.</p><h3>What other ways of getting scammed ?</h3><p>Suppose you are buying an items from any of such sites and the seller pretends to be a army/defence personal and shares his IDs too (a fake one of course) and he says that he’s in immediate need of the money and he would want the payment in advance/as soon as possible and he would ship the item right away, and one would by default trust that person by emotional factors that he’s from defence and would make the payment and would never hear the end of it.</p><p>Fraudster may also try sending you ‘request for payment’ in google pay or phone pay… and you would get fooled by accepting the request for payment and paying the requested amount, be cautious while receiving as well as sending any payments to anyone.</p><h3>What you should be aware of?</h3><ul><li>The most important thing which you should always remember about these UPI payments is that you need to enter the PIN only when you are sending the money to another person and you would never ever require to enter the UPI pin while receiving from anyone.</li><li>Be a little considerate while sharing your personal details in places like these (Facebook marketplace, Olx, Quikr, etc), I recommend you to have a spare phone number for doing this stuff.</li></ul><h3>I’ve got scammed, what should I do !?!?</h3><p>First of all, sorry to hear that, now let’s look at what can be done.</p><p>India has got a special division in the police department for handling these online frauds and scams called Cyber Crime Cell. Immediately call Cyber Crime Cell at their toll-free number <strong>155260 and 1930</strong> and report the incident, while reporting you would be needing the following details,</p><ul><li>Transaction ID of the payment done (can be found in the app in which you transacted phonepe/google pay etc)</li><li>fraudsters’ phone number if you have</li><li>Your UPI address</li><li>Your Aadhar card</li><li>Your bank account number, IFSC Code, Branch details, and your Debit card number (Remember to share only the Card number and not the expiry date and CVV, they won’t be asking for expiry date and CVV anyway)</li><li>Your phone number and email address.</li><li>You might be asked for a screenshot of the transactionID screen and your aadhar card too.</li></ul><p>Once you report this, they would generate a 9 character CIR ID, which would be looking something like this CIRxxxxxx (This part may vary from state to state, this is with respect to Karnataka state) and would be sent to your phone as an SMS, and now the Cyber Cell would get in contact with the bank and freeze the fraudsters’ bank account, and for this reason, I want to personally suggest you to keep your calm and not let the fraudster know that you know you have been scammed and you are in contact with authorities now, because if the fraudster comes to know about this, he/she may withdraw all the money from the bank account.</p><p>now you can take the CIR ID and reach your nearest local police station without further ado.</p><p>another fun fact which I would like to mention is, most of these frauds are being done by those who don’t even have proper literacy, I highly recommend you to watch the Netflix series <a href="https://www.netflix.com/title/81183491">jamtara</a> where you can get to know about a group of small-town young men run a lucrative phishing operation on credit cards and debit cards.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=638ae284291" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[My first encounter with SameSite attribute in cookies]]></title>
            <link>https://medium.com/smallcase-engineering/my-first-encounter-with-samesite-attribute-in-cookies-388227507aa9?source=rss-223b42591c98------2</link>
            <guid isPermaLink="false">https://medium.com/p/388227507aa9</guid>
            <category><![CDATA[web]]></category>
            <category><![CDATA[samesite]]></category>
            <category><![CDATA[cookies]]></category>
            <category><![CDATA[cookie-consent]]></category>
            <category><![CDATA[browser-hijacker]]></category>
            <dc:creator><![CDATA[Sumanth Bettadapura]]></dc:creator>
            <pubDate>Sun, 20 Feb 2022 11:43:58 GMT</pubDate>
            <atom:updated>2022-02-20T11:50:47.772Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EVU0etRU84LM2h_8AyO8Yg.png" /></figure><h3>Background</h3><p>I have been working on enhancing a legacy project which was based on monolith architecture (<a href="https://en.wikipedia.org/wiki/Monolithic_application">https://en.wikipedia.org/wiki/Monolithic_application</a>), let’s call that project ABC hosted at <a href="http://www.abc.com/">www.abc.com</a> for convenience.</p><p>This is how the legacy system worked:</p><ul><li>whenever a request is made to the system(www.<a href="http://abc.com/">abc.com</a>) and it doesn’t match the defined api routes(/api), it responds to that request with HTML (client/frontend files).</li><li>When the user signs in, the backend responds with Set-Cookie which contains a JWT and that cookie was being sent on all the further calls to establish authentication. This was working fine as all the calls were being made from abc.com itself and the required JWT containing cookie was automatically being sent to the backend.</li></ul><p>As a part of an enhancement to the architecture of this project, the frontend and backend were separated and now the backend was hosted at abc-api.com and the frontend was hosted at abc.com and this started breaking the login system.<br>After some debugging, I realized that this is breaking due to the cookie being set on another domain and the SameSite attribute-related changes that have happened across browsers.</p><h3>Understanding the ‘SameSite’ Attribute in cookies</h3><p>The SameSite attribute of the Set-Cookie HTTP response header allows you to declare if your cookie should be restricted to a first-party or same-site context.<br>- MDN Web Docs</p><p>When the cookie is considered as first-party (or same-site context)?<br>A cookie is associated with a particular domain and scheme (such as http or https), and may also be associated with subdomains if the Set-Cookie Domain attribute is set. If the cookie domain and scheme match the current page, the cookie is considered to be from the same site as the page and is referred to as a <em>first-party cookie</em>.</p><p>Recently there have been changes regarding the SameSite attribute standards, Which are :</p><ol><li>Earlier if no SameSite attribute were specified, the cookies were being sent for all requests, and now if the SameSite attribute is not specified, it would have defaulted to Lax.<br>Lax — Cookies are not sent on normal cross-site subrequests (for example to load images or frames into a third party site), but are sent when a user is <em>navigating to</em> the origin site (i.e., when following a link)</li><li>Developers must use a new cookie setting, SameSite=None, to designate cookies for cross-site access. Cookies with SameSite=None must now also specify the ‘secure’ attribute so cross-site cookies can only be accessed over HTTPS connections.</li><li>Cookies from the same domain are no longer considered to be from the same site if sent using a different scheme i.e, http: / https:/</li></ol><h3>Getting back to the issue</h3><p>So, as mentioned above, after the frontend and backend were separated, frontend being at <a href="http://abc.com/">abc.com</a> and backend being at <a href="http://abc-api.com/">abc-api.com</a>, when the user was logging in, abc-api.com was responding cookie containing JWT but any further communication was failing because all the further communication was being made from abc.com and those calls did not contain the cookies by default so authentication was failing.</p><h3>Solution</h3><p>An immediate solution to make sure that the login works similar to how it worked in the legacy monolith app, was to make sure that cookies can be sent from the browser to <a href="http://abc-api.com/">abc-api.com</a> whenever the frontend at <a href="http://abc.com/">abc.com</a> calls any APIs.</p><p>To enable this:</p><ul><li>The cookie should have SameSite=None so that it can be sent by default in third party contexts (which was the default behavior before SameSite was introduced)</li><li>the cookie has to be set as secure, to comply with guidelines for SameSite=None</li><li>The frontend and backend both have to be on https, so that the secure cookie can be transmitted</li></ul><p>This fixed the login issue, and the cookie behavior is now more or less similar to the earlier setup.</p><h3>Plans:</h3><ul><li>The current solution with SameSite=None gets us back to the original working implementation, which works fine, but still has all the drawbacks (csrf, privacy) which are supposed to be solved by the introduction of SameSite cookies.</li><li>We still need to have csrf protection enabled</li><li>We still need to set this cookie as httpOnly so that it can’t be leaked through Javascript</li></ul><h3>References:</h3><ol><li><a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie/SameSite#browser_compatibility">https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie/SameSite#browser_compatibility</a></li><li><a href="https://developers.google.com/search/blog/2020/01/get-ready-for-new-samesitenone-secure">https://developers.google.com/search/blog/2020/01/get-ready-for-new-samesitenone-secure</a></li><li><a href="https://web.dev/samesite-cookies-explained/">https://web.dev/samesite-cookies-explained/</a></li></ol><h3><strong>Gratitude</strong> :</h3><p>Thanks to <a href="https://medium.com/u/8bcc3cfffe22">Gaurav Gupta</a> for all the support and inputs :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=388227507aa9" width="1" height="1" alt=""><hr><p><a href="https://medium.com/smallcase-engineering/my-first-encounter-with-samesite-attribute-in-cookies-388227507aa9">My first encounter with SameSite attribute in cookies</a> was originally published in <a href="https://medium.com/smallcase-engineering">smallcase Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Reverse Tab-nabbing — Links and Its Security loops]]></title>
            <link>https://medium.com/smallcase-engineering/reverse-tab-nabbing-links-and-its-security-loops-237bca7c79e6?source=rss-223b42591c98------2</link>
            <guid isPermaLink="false">https://medium.com/p/237bca7c79e6</guid>
            <category><![CDATA[web-security]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[html]]></category>
            <dc:creator><![CDATA[Sumanth Bettadapura]]></dc:creator>
            <pubDate>Thu, 09 Dec 2021 05:43:09 GMT</pubDate>
            <atom:updated>2024-03-05T19:17:05.048Z</atom:updated>
            <content:encoded><![CDATA[<h3>Reverse Tab-nabbing — Links and Its Security loop</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*C9rOvOmvRAISmmSBm_SP5Q.jpeg" /></figure><p>Well, all the webpages in the web became cool because we could link one page to another right ?</p><p>This is made possible by the good old ‘Anchor Tag’ (&lt;a&gt;), what could possibly go wrong using an anchor tag? Well, some security concerns are associated with the usage of anchor tags while linking an external resource.</p><p>In this article, we are going to discuss the security concerns associated with linking external resources and some patterns for mitigating these security concerns. This is what we would talk about:</p><ol><li>Concerns related to noopener</li><li>Concerns related to noreferrer</li><li>Different ways of handling these security issues</li><li>How did we tackle this in smallcase by creating a reusable component?</li><li>How do we decide which links should be internal links and which links should be external?</li></ol><h3>1. noopener</h3><p>The first and foremost concern is with regards to noopener. Whenever you link any external resource, and the user clicks on that link and opens that linked website, that linked website’s window.opener property returns a reference to the window that opened the window (i.e, your site). This is true irrespective of whether the link was opened in the same tab or a new tab.</p><p>The functionalities exposed by the window.opener is very less especially when the origin of the opener is not the same as the current page, variables and functions on the opener window object are not accessible, But still, navigation of opener window is possible which enables the opening window to navigate the opener window to other location, say a phishing site. This is called ‘reverse tabnabbing’. Basically how ‘reverse tabnabbing’ happens is, suppose a document, let’s name it ‘<a href="http://abc.com/">abc.com</a>’, has an anchor tag with target=”_blank” with href directing to some other document, lets name it ‘X News’, when the ‘X News’ gets opened, the window object of ‘<a href="http://abc.com/">abc.com</a>’ document tab is passed to ‘X News’ tab and it is accessible through window.opener. window.opener is basically ‘abc’ tab’s window object.</p><p>What can the ‘X News’ doc do with this reference? There are several things which can be done, one of which is redirection, this opened new tab can redirect the opener window to some other location and the user won’t even notice because the current focus would be on the ‘X News’ tab, and by this ‘X News’ can redirect to anywhere, maybe a phishing site and may ask for credentials or sensitive data from the user.</p><h3>2. noreferrer</h3><p>whenever we link to an external resource and the user clicks on that link, the referrer header would be passed to the opened page which indicates where the traffic is coming from. This might not look like imposing any security issue, but the issue arises in what all information is being passed in the header.</p><p>An example scenario is :</p><ul><li>the referrer header contains the address of a request,</li><li>consider a “reset password” page with a social media link in a footer. If the link was followed, depending on how information was shared, the social media site may receive the reset password URL and may still be able to use the shared information, potentially compromising a user’s security.</li></ul><p><strong>Other relevant info</strong></p><ul><li>All the new major browsers by default set rel=’noopener’ for any target=’_blank’</li><li>noreferrer includes the functionality of noopener and it seems to be redundant, but if we dig a little deeper and look into browser support for noopener, we find that there are still some browsers that currently doesn’t support noopener, and also there is no downside in mentioning both noreferrer and noopener.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3qDFdY328jRMR8s24WOkNA.png" /><figcaption>Browser support details for noopener.</figcaption></figure><h3>3. Different ways of handling these security issues</h3><p><strong>1. Specifying the values in rel attribute of anchor tag/link tag</strong></p><p>Having rel = ‘noreferrer noopener’ in anchor tag inside external link. This is pretty straight forward, we will not be passing anything.</p><p>example -</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OXrPcat718acviFzWcePNQ.png" /></figure><p><strong>2. Referrer-Policy</strong></p><p>The Referrer-Policy HTTP header controls how much referrer information (sent via the Referer header) should be included with requests.<br>Referrer policy can be set for the entire document using meta tag</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5JLb-IH3alWhAw_E0CUclw.png" /></figure><p>In the above HTML, content specifies the referrer-policy. Different referrer policies can be found <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referrer-Policy">here</a>.</p><p>Or we can specify the referrer policy to specific links</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lYiHA5YgpNzBC0x_HKif6w.png" /></figure><p>Note: referrer-policy is still a working draft and isn’t a web standard yet. <a href="https://caniuse.com/#feat=referrer-policy">can_i_use</a></p><p><strong>3. Exit Page Redirect</strong></p><p>This method involves having an intermediate page where we redirect our users to and from there the user is redirected to the intended. This is the safest and only method to work without any flaw. More on this <a href="https://geekthis.net/post/hide-http-referer-headers/#exit-page-redirect">here</a>.</p><h3>4. How did we tackle this at smallcase creating a reusable component?</h3><p>There is already an eslint rule which warns about using noreferrer and noopener when adding target=”_blank” to any link. We were using that rule, but we realized that devs have to make a decision about using rel=”noreferrer noopener” at every point of usage. This was not easy for every dev to follow, and we wanted to wrap this functionality in a more semantic interface, so we decided to create a reusable component, which would have sensible defaults and make it more declarative for devs to use.</p><p>We created a reusable component that would accept the following params as props -</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b022fa343354a2b8fa101104f4d4d6fd/href">https://medium.com/media/b022fa343354a2b8fa101104f4d4d6fd/href</a></iframe><p>and the component looks like below</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*F0leuLIwU24Z5nITCOAz6A.png" /></figure><p>by making use of the above common component, we could make it convenient for devs to take care of reverse tab nabbing.<br>Note that the noopener is always set because we didn’t find any use case where we wanted the opened window from an anchor to have a reference to the opening window.</p><p><strong>Note:</strong></p><p>Even when you are opening any window programmatically/via javascript, you’re vulnerable to this, to avoid being vulnerable set the opener to null</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*y4ouctTojGcGEaXb7fjRrg.png" /></figure><p>however, the above method may fail in safari, for safari support, inject a hidden iframe that opens the new tab and immediately remove the iframe.</p><h3>5. How we decide which links are internal and which links are external</h3><p>It is quite important to differentiate between which links to be considered as internal links and which ones to be considered as external links for many reasons such as analytics, sso, and so on.</p><p><strong>Internal links -</strong> links which we are owned by us — in other words, links to the same origin or any resource owned/handled by own organisation can be considered as internal links, its quite safe to pass the header details and even the opener reference since the internal links are those links which are belonging to you/your organisation, so there is not much risk of reverse tabnabbing or sensitive information in header getting leaked. These links may open in the same tab or a new tab.</p><p><strong>External links — </strong>Any links which lead to any location which are not owned by us are to be considered as external links, whether they open in a new tab or not.</p><p>One more super important thing to keep in mind is, if your site has content written by your user, you should make sure that the links written by the user in the content are handled for reverse tabnabbing.</p><p><strong>Fin</strong>.</p><h4><strong>Acknowledgments:</strong></h4><p>Huge thanks to <a href="https://medium.com/u/8bcc3cfffe22">Gaurav Gupta</a> without whom this article would not have been possible.</p><h4><strong>References:</strong></h4><ul><li><a href="https://developer.mozilla.org/en-US/docs/Web/API/Window/opener">Window.opener - Web APIs | MDN</a></li><li><a href="https://developer.mozilla.org/en-US/docs/Web/Security/Referer_header:_privacy_and_security_concerns">Referer header: privacy and security concerns - Web security | MDN</a></li><li><a href="https://www.jitbit.com/alexblog/256-targetblank---the-most-underestimated-vulnerability-ever/">Target=&quot;_blank&quot; - the most underestimated vulnerability ever</a></li><li><a href="https://caniuse.com/rel-noopener">rel=noopener | Can I use... Support tables for HTML5, CSS3, etc</a></li><li><a href="https://mathiasbynens.github.io/rel-noopener/">About rel=noopener</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=237bca7c79e6" width="1" height="1" alt=""><hr><p><a href="https://medium.com/smallcase-engineering/reverse-tab-nabbing-links-and-its-security-loops-237bca7c79e6">Reverse Tab-nabbing — Links and Its Security loops</a> was originally published in <a href="https://medium.com/smallcase-engineering">smallcase Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>