<?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 Anusha Dasari on Medium]]></title>
        <description><![CDATA[Stories by Anusha Dasari on Medium]]></description>
        <link>https://medium.com/@anushadasari?source=rss-3ced87a5a4b1------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*h86Cdws13KtqB3gz.</url>
            <title>Stories by Anusha Dasari on Medium</title>
            <link>https://medium.com/@anushadasari?source=rss-3ced87a5a4b1------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 19:22:55 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@anushadasari/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[A complete guide to CORS!]]></title>
            <link>https://anushadasari.medium.com/a-complete-guide-to-cors-9045069a7c5e?source=rss-3ced87a5a4b1------2</link>
            <guid isPermaLink="false">https://medium.com/p/9045069a7c5e</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[application-development]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[cors]]></category>
            <category><![CDATA[security]]></category>
            <dc:creator><![CDATA[Anusha Dasari]]></dc:creator>
            <pubDate>Mon, 11 Jan 2021 19:41:10 GMT</pubDate>
            <atom:updated>2021-01-11T19:41:10.434Z</atom:updated>
            <content:encoded><![CDATA[<p>Am sure every developer must have either heard the term or has come across some annoying issues in the name of CORS. If you are one who’s usually perplexed with the idea of CORS or is haunted by the mysterious bugs blabbering something about CORS and never understood what they mean or how to resolve, this article is for you.</p><p>Am sure by the end of this, you will be at a great place, confident enough to tackle any CORS issues which you might encounter and hopefully helps make CORS a little less daunting, and also helps to securely configure CORS support to your own systems.</p><p>Is Application security important?</p><p>OfCORS it is. If you think otherwise, I guess you are on the wrong topic here and feel free to carry on with your firefighting. Or should I say bugfighting? Meh!</p><p><strong>Why do I need to know about it?</strong></p><p>Cross-Origin Request Site is an OWASP TOP 10 Security Misconfiguration vulnerability. In the process of enabling information sharing between sites, people tend to overlook the significance of CORS configuration. As developers, it’s very important that you are aware of this vulnerability and how it can be exploited.</p><p><strong>What is this CORS?</strong></p><p>CORS is abbreviation for Cross Origin Resource Sharing.</p><p>The idea behind CORS is simple: allow one site to make a request to another. It’s a fairly trivial thing to do from most programming languages. So why all this fuss around it?</p><p>While other programming languages have no restrictions on HTTP requests, things are different in a browser, where the browser’s same-origin policy prevents requests from different sites. CORS must balance the need to enable cross-origin requests while preserving the same-origin policy for sites that don’t use CORS.</p><p>This may make CORS sound like a contradiction. How can CORS allow cross-origin requests if the same-origin policy explicitly forbids them? The key is that CORS puts servers firmly in charge of who can make requests, and what type of requests are allowed. A server has the choice to open up its API to all clients, open it up to a small number of clients, or prevent access to all clients.</p><p>CORS is a unique web technology in that it has both a server-side and a client-side component. The server-side component configures which types of cross-origin requests are allowed, while the client-side component controls how cross-origin requests are made.</p><p>So if you want a brief overview of the entire journey of a CORS request, here it goes!</p><p><strong>1</strong>. The CORS request is initiated by the JavaScript client code.</p><p><strong>2</strong>. The browser includes additional HTTP headers on the request before sending the request to the server.</p><p><strong>3</strong>. The server includes HTTP headers in the response that indicate whether the request is allowed.</p><p><strong>4</strong>. If the request is allowed, the browser sends the response to the client code.</p><p>If the headers returned by the server don’t exist, or aren’t what the browser expects, the response is rejected and the client can’t view the response. In this way, browsers can still enforce the same-origin policy on servers that don’t allow cross-origin requests.</p><p>Still confused? Let’s look at it in a little bit detail.</p><p>Before that let’s understand a bit of the terminology.</p><p>What is the origin?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/374/0*84amAKTJacxuIlQ3" /></figure><p>A request is a same-origin request when the client origin and the server origin are exactly the same. Otherwise the request is a cross-origin request.</p><p><strong>Client Side:</strong></p><p>While ancient browsers do not support making requests across different origins, in the current interconnected day and age, all modern browsers have support for Cross Origin requests.</p><ol><li>Client creates the request</li></ol><ul><li>The client specifies data such as the url, method, body and header to be sent with the request</li></ul><p>2. Browser validates headers to be sent</p><ul><li>The browser creates a request object that encompasses the request made by the client.</li><li>Any custom headers need to be confirmed with the server, resulting in a preflight request, which we will see shortly</li></ul><p>3. Attach cookies and authorisation details</p><ul><li>If credentials are included with the request (credentials are cookies, authorisation headers or TLS client certificates), they are sent with the request as well.</li></ul><p>4. Browser validates and passes response to client (if allowed)</p><ul><li>The browser checks the response from the server and decides whether or not to pass on the response to the client. By default, only Cache-Control, Content-Language, Content-Length, Content-Type, Expires, Last-Modified and Pragma headers are exposed to the client, unless specified in the Access-Control-Expose-Headers header.</li></ul><p>Now let’s have a look at what happens on the server side</p><p><strong>Server Side:</strong></p><p>As seen above, you must have realised how the Browser is a trusted intermediary, and plays an active role in a CORS request in two ways:</p><ul><li>The browser adds additional information to the request so that the server can identify the client.</li><li>The browser interprets the server’s response and decides whether to send the request to the client or to return an error.</li></ul><p>So it is the server setting these following headers mainly, behind the scenes which is the core concept of CORS.</p><ul><li><strong>Origin</strong> header is always present on cross-origin requests</li><li>Value of the <strong>Access-Control-Allow-Origin</strong> header can be either a wildcard or an origin value</li></ul><p>Example: Access-Control-Allow-Origin: *</p><p>or Access-Control-Allow-Origin: <a href="http://localhost:8080/">http://localhost:8080</a></p><p>“*” or wildcard header doesn’t necessarily mean that it’s publicly accessible. There may be additional forms of authentication on the resource</p><p>So when the origin header is something the server recognises, or is part of “Access-Control-Allow-Origin” , the server accepts the request, else it rejects it.</p><p>So how do we reject the request?</p><ul><li>Sending an Access-Control-Allow-Origin header that doesn’t match the Origin header</li><li>Removing the Access-Control-Allow-Origin header entirely</li><li>This mechanism for rejecting CORS requests also protects servers that are not CORS aware</li></ul><p>Example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*CBx3DFvjgGCmdepJ" /></figure><p>You must have come across this following error, and now you understand what it means.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/353/0*sTDTWFrWJ43fVM6b" /></figure><p>What’s preflight request?</p><ul><li>The browser sends a preflight request to ask the server for permission to make the actual request <strong>when using non simple methods</strong> or adding custom headers</li><li>protects servers from receiving unexpected requests.</li><li>takes the form of an <strong>HTTP OPTIONS</strong> method with an Origin and Access-Control-Request-Method header.</li><li>The server can grant permissions to use certain HTTP methods by using the <strong>Access-Control-Allow-Methods</strong> header. The server can also grant permission to use certain HTTP headers by using the Access-Control-Allow-Headers header.</li><li>The preflight result cache is a performance optimisation that helps reduce the number of preflight requests made to a particular endpoint.</li></ul><p>Cookie support:</p><ul><li>The Access-Control-Allow-Credentials header can be used in conjunction with withCredentials property to include cookies on cross-origin requests.</li><li>The Access-Control-Expose-Headers header can be used to expose response headers to the client.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*c7NWQ57_JYfmrulr" /></figure><p>Now that we understand the jargon and the headers, let’s look at best practices to set these headers in your applications for the best security.</p><p><strong>Access-Control-Allow-Origin:</strong></p><ul><li>Use the * value to allow requests from all origins.</li><li>Use a whitelist to allow only certain origins.</li></ul><p><strong>Access-Control-Allow-Credentials:</strong></p><ul><li>Setting the value to true allows cookies on requests.</li><li>Enable cookies only if you’re sure you need them.</li><li>If your server does support cookies, be sure to also validate the origin and implement CSRF protection.</li></ul><p><strong>Access-Control-Allow-Methods:</strong></p><ul><li>This header only needs to be present on preflight responses.</li><li>It indicates which HTTP methods are allowed on a URL. Common values include HEAD, OPTIONS, GET, POST, PUT, PATCH, and DELETE.</li></ul><p><strong>Access-Control-Allow-Headers:</strong></p><ul><li>This header only needs to be present on preflight responses.</li><li>It indicates which HTTP headers are allowed on a URL.</li><li>Echo the Access-Control-Request-Headers value to get full header support.</li></ul><p><strong>Access-Control-Max-Age:</strong></p><ul><li>This header only needs to be present on preflight responses.</li><li>It indicates how many seconds to cache preflight requests for.</li><li>Browsers may have their own maxAge caps.</li></ul><p><strong>Access-Control-Expose-Headers:</strong></p><ul><li>This header indicates which response headers to expose to clients.</li><li>It’s an optional header that isn’t required for a successful CORS request.</li></ul><p>Hope that gave you a fair idea of CORS to help you be equipped with the necessary details to deal with CORS in the future.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9045069a7c5e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[MySQL — The Architecture]]></title>
            <link>https://anushadasari.medium.com/mysql-the-architecture-2ff32a97d4af?source=rss-3ced87a5a4b1------2</link>
            <guid isPermaLink="false">https://medium.com/p/2ff32a97d4af</guid>
            <category><![CDATA[database]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[dbms]]></category>
            <category><![CDATA[sql]]></category>
            <category><![CDATA[mysql]]></category>
            <dc:creator><![CDATA[Anusha Dasari]]></dc:creator>
            <pubDate>Tue, 18 Feb 2020 07:00:06 GMT</pubDate>
            <atom:updated>2020-02-18T07:00:06.292Z</atom:updated>
            <content:encoded><![CDATA[<h3>MySQL — The Architecture</h3><p>One of the most widely used SQL databases is MySQL. But very few of us actually know the underlying architecture and understand the fundamentals. In this article I will talk about the server architecture specific to MySQL.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*On4qFFYk2rcXRxBqoLUmWA.png" /></figure><p>MySQL’s most unusual and important feature is its storage-engine architecture, whose design separates query processing and other server tasks from data storage and retrieval. This separation of concerns lets you choose how your data is stored and what performance, features, and other characteristics you want.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QuFP8plNqm_qI7INadsCLA.png" /><figcaption><strong>Logical Architecture</strong></figcaption></figure><p><strong>MySQL’s Logical Architecture</strong></p><p><strong>Connection Handling: The 1st layer</strong></p><p>The topmost layer contains the services that aren’t unique to MySQL. They’re services most network-based client/server tools or servers need: connection handling, authentication, security, and so forth.</p><p>Each client connection gets its own thread within the server process. The connection’s queries execute within that single thread, which in turn resides on one core or CPU. The server caches threads, so they don’t need to be created and destroyed for each new connection. MySQL 5.5 and newer versions support an API that can accept thread-pooling plugins, so a small pool of threads can service many connections.</p><p>When clients (applications) connect to the MySQL server, the server needs to authenticate them based on username, originating host, and password. Once a client has connected, the server verifies whether the client has privileges for each query it issues.</p><p><strong>Query parsing and optimisation: The 2nd layer</strong></p><p>The second layer includes the code for query parsing, analysis, optimisation, caching, and all the built-in functions (e.g., dates, times, math, and encryption). Any functionality provided across storage engines is at this level: Example: stored procedures, triggers, and views</p><p>MySQL parses queries to create an internal structure (the parse tree), and then applies a variety of optimisations which include rewriting the query, determining the order in which it will read tables, choosing which indexes to use, and so on. You can pass hints to the optimiser through special keywords in the query, affecting its decision making process. You can also ask the server to explain various aspects of optimisation. This lets you know what decisions the server is making and gives you a reference point for reworking queries, schemas, and settings to make everything run as efficiently as possible.</p><p>The optimiser asks the storage engine about some of its capabilities and the cost of certain operations, and for statistics on the table data. For instance, some storage engines support index types that can be helpful to certain queries. Before even parsing the query, though, the server consults the query cache, which can store only SELECT statements, along with their result sets.</p><p><strong>Storage Engines: The 3rd layer</strong></p><p>The third layer contains the storage engines. They are responsible for storing and retrieving all data stored in MySQL. Each storage engine has its own benefits and drawbacks. The server communicates with them through the storage engine API. This interface hides differences between storage engines and makes them largely transparent at the query layer. The API contains a couple of dozen low-level functions that perform operations such as “begin a transaction” or “fetch the row that has this primary key.”</p><p><strong>Concurrency Control</strong></p><p>Anytime more than one query needs to change data at the same time, the problem of concurrency control arises. MySQL has to do this at two levels: the server level and the storage engine level.</p><p>The solution to this classic problem of concurrency control is rather simple. Systems that deal with concurrent read/write access typically implement a locking system that consists of two lock types : shared locks and exclusive locks, or read locks and write locks.</p><p>The problem is locks consume resources. Every lock operation — getting a lock, checking to see whether a lock is free, releasing a lock, and so on — has overhead. If the system spends too much time managing locks instead of storing and retrieving data, performance can suffer. A locking strategy is a compromise between lock overhead and data safety, and that compromise affects performance. Most commercial database servers don’t give you much choice: you get what is known as row-level locking in your tables, with a variety of often complex ways to give good performance with many locks.</p><p>MySQL, on the other hand, does offer choices. Its storage engines can implement their own locking policies and lock granularities. Lock management is a very important decision in storage engine design. Fixing the granularity at a certain level can give better performance for certain uses, yet make that engine less suited for other purposes. Because MySQL offers multiple storage engines, it doesn’t require a single general purpose solution.</p><p>It is important to note that, although storage engines can manage their own locks, MySQL itself also uses a variety of locks that are effectively table-level for various purposes. For instance, the server uses a table-level lock for statements such as ALTER TABLE, regardless of the storage engine.</p><p>MySQL server handles concurrency using something called the concept of isolation levels, which you must have read in your courses in DBMS, if you are a software developer. Transaction isolation is one of the foundations of database processing. The isolation level is the setting that fine-tunes the balance between performance and reliability, consistency, and reproducibility of results when multiple transactions are making changes and performing queries at the same time.</p><p>Now that you have a fair idea of the underlying MySQL server architecture, you know where exactly is the MySQL server executing various steps internally when you issue a query and promptly giving back the result.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2ff32a97d4af" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The HTTPS protocol explained! — Under the Hood]]></title>
            <link>https://anushadasari.medium.com/the-https-protocol-explained-under-the-hood-c7bd9f9aaa7b?source=rss-3ced87a5a4b1------2</link>
            <guid isPermaLink="false">https://medium.com/p/c7bd9f9aaa7b</guid>
            <category><![CDATA[software]]></category>
            <category><![CDATA[network]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[https]]></category>
            <dc:creator><![CDATA[Anusha Dasari]]></dc:creator>
            <pubDate>Tue, 18 Feb 2020 06:09:09 GMT</pubDate>
            <atom:updated>2020-02-18T07:03:49.432Z</atom:updated>
            <content:encoded><![CDATA[<h3>The HTTPS protocol explained! — Under the Hood</h3><p>Majority of software engineers, when asked, what HTTPS is, the most likely answer you are going to hear is that it is secure. And the answer ends there. If you think you are one of them and are eager to know in-depth about how HTTPS works, this article is for you. If you haven’t read my previous article on the HTTPS basics, you can head over <a href="https://medium.com/@anushadasari/the-https-protocol-explained-the-basics-5ae33b9d651f">here</a> before going in detail.</p><p>So let’s delve in!</p><p>HTTPS essentially involves preserving 3 things:</p><ul><li>Confidentiality: Ensures that sensitive data over the wire is not easily readable, by encryption</li><li>Integrity: Ensuring that only the server can read what you send it and only you can read what it sends back.</li><li>Authenticity: Verifying that you are talking directly to the server that you think you are talking to.</li></ul><p>HTTPS protects data using one of the 2 protocols: SSL, TLS. Let’s see what they are.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/374/1*GcMKXge3WCMibkJ6PDaPMQ.png" /></figure><p><strong>SSL</strong>: SSL is the abbreviation of Secure Socket Layer. It uses public-key encryption. Originally built by Netscape back in the early 90s, version 2.0 was launched in ’95 which was the first time we started using secure transport layer en masse in a web browser. Version 3.0 was released in ’96.</p><p><strong>TLS</strong>: TLS means Transport Layer Security. It is the latest industry-standard cryptography protocol and is a successor to SSL. The initial version was defined in 1999 as an upgrade to SSL 3.0. Version 1.1 released in 2006, 1.2 in Aug 2008, and 1.3 in Aug 2018, each fixing design flaws in the previous versions or adding features. With each new release, there are improvements in security and speed. The updates continue to make all communication safer, faster and more efficient.</p><p>One of the biggest turning points in internet history was the infamous POODLE attack in 2014, which was SSL’s death knell. It is a man-in-the-middle attack which exploits Internet and security software client’s fallback to SSL 3.0. On average, one only needs to make 256 SSL 3.0 requests to reveal one byte of encrypted messages. SSL support started being removed soon after this and SSL 3.0 is now considered broken and should no longer be used.</p><p>As standards evolved, that protocol has been deprecated and replaced by Transport Layer Security (TLS). Because so many got used to using ‘SSL’ we still use it. The two are interchangeable today, but the actual encryption is TLS, not SSL today. TLS 1.0 is, in reality, SSL 3.1, with just the name of the protocol being changed.</p><p>SSL and TLS simply refer to the handshake that takes place between a client and a server. The handshake doesn’t do any encryption itself, it just agrees on a shared secret and type of encryption that is going to be used.</p><h3>So how does HTTPS or SSL/TLS work?</h3><p>HTTPS is a secure form of the HTTP protocol. It wraps an encrypted layer around HTTP, Transport Layer Security (TLS).</p><p>HTTP is just a protocol, but when paired with TLS it becomes encrypted.</p><p>TLS and SSL are Socket oriented protocols thus encrypting a socket or transmission channel between sender and receiver but not the data. This is the main reason which makes these two protocols independent of the application layer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/807/0*_M_R1JvUpyu8xdWc.jpg" /><figcaption>The HTTPS Stack</figcaption></figure><p>HTTPS is based on public/private-key cryptography:</p><ul><li>The public key is used for encryption</li><li>The secret private key is required for decryption.</li></ul><p>A certificate is a public key with a label identifying the owner.</p><p>The beauty is that anyone can intercept every single one of the messages you exchange with a server, including the ones where you are agreeing on the key and encryption strategy to use, and still not be able to read any of the actual data you send.</p><p>Let’s now get acquainted with one more process you need to know about, before looking at the handshake, which is acquiring the digital certificate.</p><p>HTTPS requires a TLS certificate to be installed on your server. An SSL/TLS certificate works by storing your randomly generated keys (public and private) in your server. The public key is verified with the client and the private key used in the decryption process.</p><p>Certificate Authority (CA): In Cryptography, a CA is an entity that issues digital certificates. A digital certificate certifies the ownership of a public key by the named subject of the certificate. Every time you browse through a website using HTTPS, the owner of the site has used a CA to verify their ownership of their domain and obtain the certificate that the site can serve up. There are a huge number of CAs and the way this CA authority mechanics works is that,</p><ol><li>Your machine needs to trust a CA</li><li>The CA signs the certificate</li><li>When it is returned to the browser through the website</li><li>Your machine validates that the certificate is legitimate by referring to your local list of trusted authorities</li></ol><p>Different browsers and operating systems have different procedures. For example, Chrome takes the trust store of the operating system (except Extended Validity (EV) certificates) as seen on the <a href="http://www.chromium.org/Home/chromium-security/root-ca-policy">Root CA Policy</a> of chromium. Firefox, on the other hand, maintains all its CAs themselves and doesn’t use the systems store at all. They also have a published <a href="https://www.mozilla.org/projects/security/certs/policy/InclusionPolicy.html">Inclusion Policy</a>. And then there is the <a href="https://www.apple.com/certificateauthority/ca_program.html">Apples Root Certificate Program</a>.</p><p>Generally, all of them require that the CA is certified by an acknowledged authority like <a href="http://www.webtrust.org/">WebTrust</a> or something equivalent. To get certified the CA has to prove a few things, like how it determines the owner of a domain, how it keeps the root CAs private key secure, processes and a lot of other things. There is a <a href="http://www.webtrust.org/homepage-documents/item54279.pdf">PDF online from WebTrust with all the requirements</a>.</p><p>The SSL/TLS certificate is kind of like your passport. It contains various pieces of data, including the name of the owner, the property (eg. domain) it is attached to, the certificate’s public key, the digital signature and information about the certificate’s validity dates. The client checks that it either implicitly trusts the certificate, or that it is verified and trusted by one of several Certificate Authorities (CAs) that it also implicitly trusts. Note that the server is also allowed to require a certificate to prove the client’s identity, but this typically only happens in very sensitive applications. You can take a look at this certificate of any HTTPS website by clicking on the padlock in the address bar.</p><h4>Certificates are not the same as protocols</h4><p>Before anyone starts worrying that they need to replace their existing SSL Certificates with TLS Certificates, it’s important to note that certificates are not dependent on protocols. That is, you don’t need to use a TLS Certificate vs. an SSL Certificate. While many vendors tend to use the phrase “SSL/TLS Certificate”, it may be more accurate to call them “Certificates for use with SSL and TLS”, since the protocols are determined by your server configuration, not the certificates themselves.</p><p>Now that we are familiar with some required jargon such as SSL, TLS and CA, we are now ready to look at the actual handshake itself.</p><h3>The HTTPS Handshake</h3><p>When your browser connects to an HTTPS server, the server will answer with its certificate. The browser checks if the certificate is valid:</p><ul><li>The owner information needs to match the server name that the user requested.</li><li>The certificate needs to be signed by a trusted certification authority.</li></ul><p>If one of these conditions is not met, the user is informed about the problem.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/968/0*U6sdxjacq82WuyuE.png" /><figcaption>HTTPS Connection Sequence Diagram</figcaption></figure><p>A series of handshakes take place. The initial request is sent to the server for verification. When the server responds that it is the desired server the client then sends a hello message. This initialisation only needs to occur once for each unique connection. HTTP/2 has a distinct advantage over HTTP/1.1 since it multiplexes connections instead of opening multiple connections.</p><p>Once the connection is established, both parties can use the agreed algorithm and keys to securely send messages to each other. We will break the handshake up into 3 main phases — Hello, Certificate Exchange and Key Exchange.</p><p>Client and server negotiate on how to communicate securely</p><ol><li><strong>ClientHello</strong> — The handshake begins with the client sending a ClientHello message. This contains all the information the server needs to connect to the client via TLS, including the various Cipher suites it supports in order of preference and the maximum TLS version that it supports.</li><li><strong>ServerHello</strong> — The server responds with a ServerHello, agrees on protocol version and Cipher suite, and also provides it’s public key back to the client.</li></ol><p>The client verifies the public key against its list of trusted CAs. The data is not yet encrypted. It is still in the negotiation phase. ‘Man in the Middle’ can see identities of server and that they are trying to communicate. No content of the communication is being shared yet though.</p><p>3. <strong>Client key exchange</strong>: Client can perform a key exchange with the server and this response is encrypted with the server’s public key. The encryption of the actual message data exchanged by the client and server will be done using a symmetric algorithm, the exact nature of which was already agreed during the Hello phase. Both parties need to agree on this single, symmetric key, a process that is accomplished securely using asymmetric encryption and the server’s public/private keys.</p><p>4. <strong>Server Finished</strong>: Server now returns a server finished. And secure communication can begin.</p><p>At this point, the reader communication can proceed. The initial handshakes steps take place in a matter of milliseconds.</p><p><strong>When HTTPS is used, Which Elements of the Communication is Encrypted?</strong></p><p>Once the HTTPS handshake is complete all communication between the client and the server is encrypted. This includes the full URL, data (plain text or binary), cookies and other headers. The only part of the communication not encrypted is what domain or host the client requested a connection. This is because when the connection is initiated an HTTP request is made to the target server to create the secure connection. Once HTTPS is established the full URL is used.</p><p><strong>Is HTTPS Secure?</strong></p><p>From a purely technical sense yes. There are ways to attack and potentially hack the protocol, but they require compromising components outside the control of the client and server. And these attacks are not easy.</p><ul><li>Break into any Certificate Authority</li><li>Compromise a router near any Certificate Authority</li><li>Compromise a Certificate Authority’s recursive DNS server</li><li>Attack some other network protocol, such as TCP or BGP</li><li>A government could order a Certificate Authority to produce a malicious certificate (only speculative)</li></ul><p>Check out <a href="https://badssl.com/">https://badssl.com/</a> which is an interesting site to play around. Also Wireshark is an interesting tool to check out to see the handshake in action and in more detail. It helps debug any connection related issues as well.</p><p>To sum up, we have seen how HTTPS ensures confidentiality, message integrity and authenticity. It uses public and private key infrastructure (PKI) for a flexible encryption scheme. It uses asymmetric cryptography for key exchange and thereafter symmetric cryptography for channel encryption.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c7bd9f9aaa7b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The HTTPS protocol explained! — The basics]]></title>
            <link>https://anushadasari.medium.com/the-https-protocol-explained-the-basics-5ae33b9d651f?source=rss-3ced87a5a4b1------2</link>
            <guid isPermaLink="false">https://medium.com/p/5ae33b9d651f</guid>
            <category><![CDATA[web]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[application-development]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Anusha Dasari]]></dc:creator>
            <pubDate>Tue, 30 Jul 2019 09:53:07 GMT</pubDate>
            <atom:updated>2020-02-18T06:13:17.307Z</atom:updated>
            <content:encoded><![CDATA[<h3>The HTTPS protocol explained! — The basics</h3><p>To know about HTTPS, we should first know what HTTP is.</p><p>HTTP or the Hypertext Transfer Protocol is the protocol used for viewing webpages on the web and is the most widely used in the world today. All the information exchanged between the computer and the webserver is transferred over the public internet in plain/clear text, making it vulnerable to hacking. Sensitive data such as passwords and credit card information, name, address, etc. could easily be read by an attacker. You would be surprised by the number of ways or places where you are susceptible to have your data intercepted by bad guys in your day to day life. Most common of them being coffee shops, restaurants and public WiFi places where attackers have been known to meddle with the public Wi-Fi settings and just absorb the Internet traffic around them. They can then use sophisticated analysis to determine sensitive data that you may have considered safe.</p><p>There are several points of possible breaches before your request hits a web server from your browser and comes back to your browser, be it a wireless router, or Internet Service Provider(ISP), the fibre optics to internet exchanges. Some popular attacks being DNS spoofing and Man in the middle attacks. So using HTTP, your Internet sessions are public domain. You have no true privacy. This is why using a secure protocol is important when transferring personal and sensitive data.</p><p><strong>What is HTTPS?</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*FfNNSwixnI7VhHpOKIoS2Q.jpeg" /></figure><p>Here comes HTTPS. Which as most people rightly answer, is nothing but Secure HTTP. HTTP with a security feature. But it is not just a padlock that you see on your browser window! There is much more to it. The Internet world is rapidly moving towards it everywhere.</p><p>So how does HTTPS make it secure? Encryption. Instead of data flowing over the wire in plain text, it is now encrypted using encryption algorithms. An attacker can no longer comprehend your data and will only see scrambled data which they cannot make any sense of. The most common attack is the Man in the Middle Attack wherein an aggressive attacker could set up their own infrastructure to reroute your request! You think you are visiting a particular website <a href="http://www.abc.com/">www.abc.com</a> but they could reroute it and you could actually be looking at a similar-looking website served by an altogether different un-secure server which could do anything with the data you share such as your location, credit card info, etc. Without using HTTPS you have no surety you are talking to the desired server. And the server cannot determine if it really is talking to you.</p><p>With HTTPS, there is a level of data integrity that protects you from an attacker intercepting your requests and the server’s responses. The certificates require that each end knows how to encrypt and decrypt the data and only they know how to do this. Just in case you think the bad guy can fake a certificate, they can’t. At least they can’t forge the certificate or try to decrypt the data with the public key. They won’t have access to the private key. The certificate contains the public key of the webserver. The attacker’s proxy does not have the matching private key. If the proxy forwards the real certificate to the client, it cannot decrypt information the client sends to the webserver. The attacker may try to forge the certificate and provide their own public key. This will destroy the signature of the certification authorities. The browser will warn you about the invalid certificate.</p><p>On a high level this is what happens during an HTTPS Handshake conversation:</p><ol><li>Computer: Hey! Identify yourself!</li><li>Server: Here, take a look at my certificate.</li><li>Computer: Eh! That looks good to me. Let’s begin the exchange.</li><li>Server: Cool, I acknowledge. Let’s begin.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/360/1*JTTYm6wottKWGrfcYI6_IA.jpeg" /><figcaption>Or what the handshake would look like if it were a chat</figcaption></figure><p>In HTTPS the only two parties that can read the data are the server and your browser. The TLS (Transport Layer Security) or SSL(Secure Sockets Layer) layer acts as a shield, blocking unwanted eyes from watching your conversation.</p><p><strong>Why HTTPS?</strong></p><p>A lot of websites now use HTTPS by default, regardless of whether sensitive data is being exchanged.</p><p>Example: Go to any website which does not require you to share any personal information, for instance, some news site. Neither are you logged in nor are you providing any of your details or address. Have you wondered, why then is it using HTTPS when no sensitive data is being shared in this case?</p><p>There are several reasons. Google is flagging websites as non-secure if not using HTTPS protocol. It also penalizes the site in search rankings. You must have noticed, since the update from Chrome 55 to Chrome 56, they started displaying “Non-Secure” in the address bar beside the URL not using HTTPS for those websites collecting sensitive information, and gradually moved towards showing the warning to all HTTP sites irrespective of sensitive data involved, with the release of Chrome 68.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/728/1*hatWT25_aNeC8gGXDhMvYQ.jpeg" /></figure><p>Firefox started to show “This connection is not secure. Logins entered here could be compromised” next to input login fields in a form.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/252/1*Oiypkzlqv-OtLWyWJSU2Sg.png" /></figure><p>Using HTTPS also ensures that you as a user are served only the content that the website wants to show you, and is not modified in any way by the time it reaches you.</p><p>Browsers are now holding the websites more accountable to serve content securely. That is why major websites have now started to use HTTPS regardless. Not just that, you will also be able to use more functionality in browsers. For instance, HTTPS is one of the three core requirements to be a PWA. Plus your site won’t be marked as “NOT SECURE” by Chrome and other browsers.</p><p>HTTPS is also required to <a href="https://www.digicert.com/blog/https-only-features-in-browsers/">unlock modern browser features</a> like <a href="https://developers.google.com/web/fundamentals/primers/service-workers/">service workers</a> and hardware APIs like WebUSB and Bluetooth access. Features like getting a user’s location, accessing their microphone, or storing data locally on their device, all require that your website supports HTTPS.</p><p>If you still think that using HTTPS for your website is hard, think again. The commonly perceived barriers to incorporating HTTPS no longer hold true. For example, the cost of buying a certificate. In the past SSL certificates were expensive. That has changed today as most certificates are free. If you pay for a certificate, you are buying a certificate with a more rigorous screening process and possibly insurance. One more being complexity. Previously, it used to be hard to set up certificates which again is a fairly simplified process today. Speed was another concern due to the performance penalty involved because of the encryption/decryption, which again is negligible today with the recent protocol versions. There used to be compatibility issues, for example, an HTTPS website showing advertisements requires them to be HTTPS too, which is not that big of a concern today, given the universality of the protocol. By now, I hope you must have realized and have been sold on how all these are trivial compared to the security features and advantages that HTTPS provides.</p><p>HTTPS has now become a norm, and no, you cannot turn a blind eye to it.</p><p>To know more in-depth about the underlying protocol handshake in itself, you can read in my next article I published <a href="https://link.medium.com/XQ9cfAZHa4">here</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5ae33b9d651f" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>