<?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" xmlns:media="http://search.yahoo.com/mrss/" version="2.0">
    <channel>
        
        <title>
            <![CDATA[ Rohit Jacob Mathew - freeCodeCamp.org ]]>
        </title>
        <description>
            <![CDATA[ Browse thousands of programming tutorials written by experts. Learn Web Development, Data Science, DevOps, Security, and get developer career advice. ]]>
        </description>
        <link>https://www.freecodecamp.org/news/</link>
        <image>
            <url>https://cdn.freecodecamp.org/universal/favicons/favicon.png</url>
            <title>
                <![CDATA[ Rohit Jacob Mathew - freeCodeCamp.org ]]>
            </title>
            <link>https://www.freecodecamp.org/news/</link>
        </image>
        <generator>Eleventy</generator>
        <lastBuildDate>Fri, 15 May 2026 22:29:35 +0000</lastBuildDate>
        <atom:link href="https://www.freecodecamp.org/news/author/rohitjmathew/rss.xml" rel="self" type="application/rss+xml" />
        <ttl>60</ttl>
        
            <item>
                <title>
                    <![CDATA[ Online Safety – A Guide to Protecting Yourself ]]>
                </title>
                <description>
                    <![CDATA[ Navigating digital accounts safely is a concern for many in the modern age.  Digital accounts have become an integral part of our daily lives. From email and online banking to accounts on ride-sharing platforms like Uber and e-commerce platforms like... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/online-safety-a-guide-to-protecting-yourself/</link>
                <guid isPermaLink="false">66bb458db55bcb0df590ddd0</guid>
                
                    <category>
                        <![CDATA[ cybersecurity ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Security ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Rohit Jacob Mathew ]]>
                </dc:creator>
                <pubDate>Mon, 20 May 2024 15:13:00 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2024/05/rohit-2400-x-1260.jpg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>Navigating digital accounts safely is a concern for many in the modern age. </p>
<p>Digital accounts have become an integral part of our daily lives. From email and online banking to accounts on ride-sharing platforms like Uber and e-commerce platforms like Amazon, protecting our digital lives online is becoming imperative.</p>
<p>When computing began, we used computers for complex calculations on individual machines. </p>
<p>Gradually, we started connecting these machines through the internet, leading to the dot-com boom. This boom resulted in the creation of many websites like chat rooms and forums. </p>
<p>To access these, you needed to identify yourself, which led to the use of the common username and password system we use today to create accounts. </p>
<p>This username and password became a way to uniquely identify a person and their account on these sites, forming a type of digital identity.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/05/image-47.png" alt="Image" width="600" height="400" loading="lazy">
<em>Common Cyber Attack Vectors (<a target="_blank" href="https://www.balbix.com/insights/attack-vectors-and-breach-methods/">Source</a>)</em></p>
<p>Nowadays, some of the most common incidents we see are phishing scams, identity theft, <a target="_blank" href="https://www.cisco.com/c/en/us/products/security/what-is-social-engineering.html">socially engineered attacks</a>, ransomware, and compromised or weak credentials. Most, if not all, of these are directly or indirectly related to our digital identity and how we access it. Therefore, we need to ensure we secure ourselves online.</p>
<h2 id="heading-how-to-secure-yourself-online">How To Secure Yourself Online? 🙋</h2>
<p>I will discuss one aspect of securing yourself online, which relates to digital accounts and how we access them. The most recommended strategy for that is:</p>
<ol>
<li>Use a Passwordless login method like Face ID, Fingerprint Login, or Passkeys.</li>
<li>Use a password manager, like BitWarden or 1Password, for sites that still require a username and password.</li>
<li>Implement multi-factor authentication (MFA) to verify your identity. This can include a Time-Based OTP (TOTP) or a deep link verification through email.</li>
</ol>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/05/image-48.png" alt="Image" width="600" height="400" loading="lazy">
<em>Table From Bad To Good On Protecting Your Account (<a target="_blank" href="https://www.microsoft.com/en-us/security/business/solutions/passwordless-authentication">Source</a>)</em></p>
<p>Let me also share the strategy I use:</p>
<ul>
<li>I currently use 1Password as my password manager.</li>
<li>I have TOTP or Passwordless MFA implemented on most sites.</li>
<li>I have removed most social logins and Single Sign-On.</li>
<li>I regularly conduct a security audit to see who has access to my data.</li>
<li>In the event of a data leak or hack, I immediately change my passwords.</li>
<li>Passwordless account creation using passkeys is a recent improvement, and I will likely start adopting them soon.</li>
</ul>
<h2 id="heading-but-im-still-confused-why-should-we-do-all-this">But ... 🤔 I'm Still Confused. Why Should We Do All This?</h2>
<p>Good question. Let's explore why we find password-based logins inefficient, inconvenient, and frustrating.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/05/image-49.png" alt="Image" width="600" height="400" loading="lazy">
<em>Login &amp; Signup Page</em></p>
<p>Let's start with a login screen. You see above the traditional username/password login or signup page and a few <a target="_blank" href="https://blog.rohitjmathew.space/why-is-a-social-login-more-secure">social logins</a>. These are currently the most common methods of accessing an account. </p>
<p>Let's examine how these methods contribute to feelings of inefficiency, inconvenience, and frustration.</p>
<h3 id="heading-inefficient">Inefficient</h3>
<ul>
<li><strong>We Create Terrible Passwords -</strong> Below are some of the most common passwords in the world. There are open-source lists of these passwords that hackers use. Simple passwords like these or those related to you are not secure at all. They can easily be guessed from the list or with a little social engineering.</li>
</ul>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/05/image-50.png" alt="Image" width="600" height="400" loading="lazy">
<em>Common Passwords In The World (<a target="_blank" href="https://www.quora.com/Is-using-password-as-a-password-really-common">Source</a>)</em></p>
<ul>
<li><strong>We Reuse the Same Passwords -</strong> To make things easier, we often use the same passwords for multiple accounts. This is very insecure because if one account is compromised, a hacker can easily access other accounts.</li>
<li><strong>Compromised Social Logins -</strong> While social logins are easier to use, they also present a single point of failure. If one social login is compromised, it can lead to other accounts being compromised as well.</li>
<li><strong>SMS &amp; Voice-Based Multi-Factor Authentication (MFA) Can Be Hacked -</strong> While MFA has improved security, hackers have adapted and found ways to intercept SMS or voice-based MFA. Therefore, these methods are no longer the most secure.</li>
</ul>
<p><strong><em>Note:</em></strong> <em>If you visit the site</em> <a target="_blank" href="https://haveibeenpwned.com"><em>haveibeenpwned</em></a>, <em>you can see which of your data has been compromised.</em></p>
<h3 id="heading-inconvenient">Inconvenient</h3>
<ul>
<li><strong>Resetting Passwords is Not Easy -</strong> When we forget our passwords, we often have to go through multiple steps to regain access to our accounts.</li>
<li><strong>Password Requirements Are Sometimes Hard To Remember -</strong> Creating a new password that meets all the security requirements, such as including uppercase letters, numbers, and special characters, can be difficult to remember.</li>
<li><strong>Social Logins Might Not Work Sometimes -</strong> With recent downtimes of social media sites, your logins might also face interruptions.</li>
<li><strong>Multi-Factor Authentication (MFA) Can Add Friction -</strong> MFA often requires an extra step and is linked to a device, which can complicate the process. Additionally, backing up and recovering MFA methods is not straightforward.</li>
</ul>
<h3 id="heading-frustrating">Frustrating</h3>
<ul>
<li><strong>Remembering Different Passwords -</strong> Memorable passwords are easy for hackers to guess or crack. It's frustrating to have different passwords for various accounts and to remember each one.</li>
<li><strong>Social Login Providers &amp; Data Privacy -</strong> Some social login providers or websites may share or sell their user data to third-party entities. This means that when you use social logins, your personal information, browsing habits, and other data, might be accessed by companies you didn't intend to share it with.</li>
<li><strong>Multi-Factor Authentication (MFA) Not Working -</strong> SMS or voice call containing the authentication code not being received, delays in receiving push notifications, or Time-based One-Time Passwords (TOTP) can expire are a few examples. These issues can cause significant frustration and hinder the login process.</li>
<li><strong>Multi-Factor Authentication (MFA) Abuse -</strong> There has been an increase in hackers abusing MFA to access accounts. They exploit MFA solutions that send sign-in approval notifications after account access attempts, knowing that people often get frustrated by a flood of messages. Hackers have breached <a target="_blank" href="https://www.wired.com/story/uber-hack-mfa-phishing/">Uber</a>, <a target="_blank" href="https://tech.co/news/mfa-fatigue-hackers">Microsoft, and Cisco</a> using this method.</li>
</ul>
<h2 id="heading-right-so-why-is-the-recommended-strategy-better">Right, So Why Is The Recommended Strategy Better? 😅</h2>
<p>Let's break down the recommended strategy:</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/05/image-48.png" alt="Image" width="600" height="400" loading="lazy">
<em>Table From Bad To Good On Protecting Your Account (<a target="_blank" href="https://www.microsoft.com/en-us/security/business/solutions/passwordless-authentication">Source</a>)</em></p>
<h3 id="heading-use-a-passwordless-login-method">Use a Passwordless Login Method</h3>
<p>Passwordless methods are more secure than password-based logins. If you want to know why, you can read my article on <a target="_blank" href="https://blog.rohitjmathew.space/intro-to-webauthn">How Does Face ID or Touch ID Work</a>. </p>
<p>In simple terms, passwordless methods, like Passkey, use biometric authentication along with device identifiers to enable multifactor authentication (something you are and something you have) instead of a password (something you know).</p>
<p>This approach is not only easier and more secure but also resistant to many of the issues we discussed earlier. Although still new, there has been a significant industry push to adopt this, especially with the rise of biometric authenticators in our devices.</p>
<p><em><strong>Note:</strong> You can find a list of websites and apps that support passwordless login or MFA, along with instructions on how to set it up, at <a target="_blank" href="https://passkeys.directory/">passkeys.directory</a>.</em></p>
<h3 id="heading-use-a-password-manager-for-sites-that-still-require-a-username-and-password">Use a Password Manager for Sites That Still Require a Username and Password</h3>
<p>While not every site has adopted passwordless logins, a better way to secure your accounts that still use passwords is by using a password manager like <a target="_blank" href="https://bitwarden.com/">Bitwarden</a> or <a target="_blank" href="https://1password.com/">1Password</a>. </p>
<p>They help you create strong, unique passwords and remember them easily. Most password managers come with autofill features that make it easy to use across devices.</p>
<p>While they can be a single point of failure and might be a bit of a hassle to set up initially, the benefits far outweigh the drawbacks. </p>
<p>Remembering just one master password to manage your accounts securely is much better than dealing with the issues mentioned earlier.</p>
<p><strong><em>Note:</em></strong> <em>1Password (the password manager I use) has provided more</em> <a target="_blank" href="https://blog.1password.com/what-if-1password-gets-hacked/"><em>details</em></a> <em>on what happens if they are hacked. While there have been recent</em> <a target="_blank" href="https://www.forbes.com/sites/daveywinder/2023/10/24/no-1password-has-not-just-been-hacked-your-passwords-are-safe/"><em>hacking incidents</em></a><em>, I am not aware of any compromised data.</em></p>
<h3 id="heading-implement-multi-factor-authentication-to-verify-your-identity">Implement Multi-factor Authentication to Verify Your Identity</h3>
<p>Multi-factor Authentication (MFA) is a security measure that requires users to provide more than one form of identification to access their accounts. </p>
<p>This typically involves a combination of something you know, like a traditional password, and something you have, such as a one-time password (OTP) sent via SMS or email. </p>
<p>By adding this extra layer of security, MFA significantly reduces the risk of unauthorized access, even if your password is compromised.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/05/image-51.png" alt="Image" width="600" height="400" loading="lazy">
<em>What Is Multi-factor Authentication (<a target="_blank" href="https://www.hsph.harvard.edu/information-technology/2022/10/03/october-is-cybersecurity-month-week-1/">Source</a>)</em></p>
<p>Implementing MFA is a crucial step in protecting your online accounts and personal information. It may take a bit of extra time during the login process, but the added security is well worth the effort.</p>
<p><strong><em>Note:</em></strong> <em>Most websites and services we use provide 2FA. You can check based on your use case at</em> <a target="_blank" href="https://2fa.directory/"><em>2fa.directory</em></a><em>.</em></p>
<h2 id="heading-conclusion">Conclusion</h2>
<p>This article explores common security threats and offers strategies to protect yourself online. </p>
<p>Some recommendations include using passwordless login methods like Face ID or Passkeys, using password managers like 1Password, and implementing multi-factor authentication (MFA). </p>
<p>These measures can greatly improve your online security and reduce the risk of unauthorized access to your accounts.</p>
<p>Hopefully, this article helps you understand why online security is important and enables you to stay safe on the internet.</p>
<p>Thanks for reading! I really hope that you find this article useful. If you think this post was useful, please share the post to help promote this piece to others.</p>
<p>If you want to read more of my articles, visit my <a target="_blank" href="https://blog.rohitjmathew.space/"><strong>blog</strong></a><strong>.</strong></p>
<p>Thanks again for reading! :)</p>
<p>P.S Do feel free to connect with me on <a target="_blank" href="https://www.linkedin.com/in/rohitjmathew"><strong>LinkedIn</strong></a> or <a target="_blank" href="https://twitter.com/iamrohitjmathew"><strong>Twitter</strong></a>.</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ What is WebAuthn? How to Authenticate Users Without a Password ]]>
                </title>
                <description>
                    <![CDATA[ Most of us are used to logging into different accounts using a password. For years this has been the norm. But passwords face a number of security issues: They are extremely annoying when we don’t remember them and even harder to reset They can be q... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/intro-to-webauthn/</link>
                <guid isPermaLink="false">66bb4589cd114247c2941f36</guid>
                
                    <category>
                        <![CDATA[ authentication ]]>
                    </category>
                
                    <category>
                        <![CDATA[ passwords ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Rohit Jacob Mathew ]]>
                </dc:creator>
                <pubDate>Wed, 20 Apr 2022 23:45:39 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2022/04/webauthn.jpeg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>Most of us are used to logging into different accounts using a password. For years this has been the norm. But passwords face a number of security issues:</p>
<ul>
<li>They are extremely annoying when we don’t remember them and even harder to reset</li>
<li>They can be quite insecure with the most common password being <code>password</code> or <code>123456</code></li>
<li>Phishing attacks are commonplace in today’s internet era, and using this technique hackers can steal your passwords</li>
</ul>
<p>Would it not be simpler to move towards a more passwordless login? A place where we don’t have to remember or have to enter passwords to gain access to our accounts? One such passwordless solution is WebAuthn.</p>
<h2 id="heading-what-is-webauthn">What is WebAuthn? 😅</h2>
<p>The Web Authentication API (also known as WebAuthn) is an API that enables strong authentication with public-key cryptography. It lets you implement passwordless authentication and/or secure second-factor authentication without SMS texts.</p>
<p>Let’s break that down to quickly understand the parts:</p>
<ul>
<li><strong>Public Key Cryptography</strong> — So we use a key-based authentication (public and private key) to login and not a password. If you are not sure how it works I suggest watching this <a target="_blank" href="https://youtu.be/6-JjHa-qLPk?t=277">video</a>.</li>
<li><strong>Passwordless Authentication</strong> — In this type of authentication we will not be using a password to login but will use some form of user interaction to verify and login. This uses a hardware authenticator like a fingerprint sensor on your device or a YubiKey.</li>
<li><strong>Secure Second-Factor Authentication Without SMS Texts</strong> — Two-Factor Authentication today is predominantly driven by SMS-based OTP, but these are also susceptible to SIM swap. SIM swap is essentially taking control of someone’s phone number, and tricking a carrier into transferring it to a new phone. A two-factor authentication scenario-driven through a hardware authenticator using WebAuthn would be a safer solution to the above problem.</li>
</ul>
<p>WebAuthn is a specification written by the <a target="_blank" href="https://www.w3.org/">W3C</a> and <a target="_blank" href="https://fidoalliance.org/">FIDO</a>, with the participation of Google, Mozilla, Microsoft, Yubico, and others. </p>
<p>Web Authentication works hand in hand with other industry standards such as <a target="_blank" href="https://www.w3.org/TR/credential-management-1/">Credential Management Level 1</a> and <a target="_blank" href="https://fidoalliance.org/specs/fido-v2.0-rd-20170927/fido-client-to-authenticator-protocol-v2.0-rd-20170927.html">FIDO 2.0 Client to Authenticator Protocol 2</a>.</p>
<h2 id="heading-how-does-webauthn-work">How Does WebAuthn Work? 🤔</h2>
<p>So like every other login situation:</p>
<ul>
<li>A user would be prompted for a username to identify them.</li>
<li>The browser would then prompt the user to use their hardware authenticator and verify themselves.</li>
<li>On successful authentication, they would be logged into the system.</li>
</ul>
<p>Now what we don’t often see is what goes on in the background to facilitate this process. Let me explain a little more.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/04/webauthn_flow_diagram.png" alt="Image" width="600" height="400" loading="lazy">
<em>Generic WebAuthn Flow</em></p>
<h3 id="heading-registration-flow">Registration Flow</h3>
<p>In this process, a new set of key credentials are created against the username entered by the user. This key credential is the crux of the process which enables us to make sure this authentication is in a passwordless manner.</p>
<p>There is a simple 8 step process that takes place:</p>
<ol>
<li>A user clicks on the register button on a site on their browser (user agent).</li>
<li>The authenticating server (relying party) issues a challenge (a random set of data sent as an array) to the user’s browser to be able to enable WebAuthn login.</li>
<li>The browser sends this challenge to the authenticator device.</li>
<li>The authenticator device then prompts the user to authenticate themselves. This would be different based on the device, for example   Touch ID on a Macbook or touching a YubiKey.</li>
<li>Once the user authorizes the authenticator device, the authenticator will then create a new key pair (a public and private key) and will then use the private key to sign the challenge.</li>
<li>The authenticator device will then return the signed challenge, the public key as well as details pertaining to the process, back to the authenticating server.</li>
<li>The authenticating server will then confirm the authenticity of the private key by using the public key to ensure the challenge was signed by the private key.</li>
<li>It will then store the received details against the username for future use and respond that the user is registered.</li>
</ol>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/04/Registration.png" alt="Image" width="600" height="400" loading="lazy">
<em>Registration Flow</em></p>
<h3 id="heading-the-webauthn-authentication-flow">The WebAuthn Authentication Flow</h3>
<p>Authentication is a similar process where the above-generated credentials are used to verify the user’s identity by going through a signed challenge process again.</p>
<p>There is a simple 8 step process that takes place:</p>
<ol>
<li>A user clicks on the login button on a site on their browser (user agent) and enters their username.</li>
<li>The authenticating server (relying party) issues a challenge (a random set of data sent as an array) to the user’s browser along with the saved private key ID registered with the username.</li>
<li>The browser sends this challenge &amp; private key ID to the authenticator device.</li>
<li>The authenticator device then prompts the user to authenticate themselves. This would be different based on the device (again,  Touch ID on a Macbook or touching a YubiKey).</li>
<li>Once the user authorizes the authenticator device, the authenticator will then retrieve the generated key pair saved on it with the provided private key ID. It will then use the private key to sign the challenge.</li>
<li>The authenticator device will then return the signed challenge as well as details pertaining to the process back to the authenticating server.</li>
<li>The authenticating server will then confirm the authenticity of the private key by using its saved public key to ensure the challenge was signed by the private key.</li>
<li>It will then log the user in.</li>
</ol>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/04/Login.png" alt="Image" width="600" height="400" loading="lazy">
<em>Authentication Flow</em></p>
<h2 id="heading-benefits-of-webauthn">Benefits of WebAuthn</h2>
<p>That sounds awesome, right? 😮 Absolutely. Let’s quickly see some of the benefits:</p>
<ul>
<li><strong>Private/Public Key Based Authentication</strong> — It’s a more secure way to authenticate users compared to the current norm of password-based authentication as it uses asymmetric cryptography by default.</li>
<li><strong>Phishing Resistant</strong> — WebAuthn is resistant to phishing attacks due to the domain name being stored on the authenticator. This makes it harder for hackers to be able to spoof websites and gain access to credentials.</li>
<li><strong>Store Public Data in Your DB</strong> — Only public data is stored in the DB. No sensitive data such as passwords are required to be stored in this flow.</li>
<li><strong>Fine-Grained Control</strong> — You can control what sort of user interaction you want as a part of the flow, for example a specific hardware device.</li>
<li><strong>Better UX</strong> — A user won’t need to remember any passwords or such and will only need to use a hardware authenticator to be able to login to the device.</li>
<li><strong>W3C Recommendation</strong> — This means it should be supported by all major browsers across devices.</li>
</ul>
<p>and lastly <strong>NO MORE PASSWORDS.</strong></p>
<h3 id="heading-disadvantages-of-webauthn">Disadvantages of WebAuthn</h3>
<p>All that being said, it does have some issues which are still to be solved:</p>
<ul>
<li><strong>User Credential Management</strong> — The user experience with respect to credential management is still in a very primitive state.</li>
<li><strong>Cross-Device Credentials</strong> — Being able to pass credentials from one device to another is not very easy unless you use a roaming hardware authenticator like a YubiKey.</li>
<li><strong>Lost/Stolen Authenticator Device Recovery</strong> — In case you don’t have access or lose your roaming hardware authenticator, the fallback scenario is generally a password to gain access to an account but would need to be explicitly setup.</li>
<li><strong>WebAuthn Might Replace Passwords</strong> — WebAuthn is still in a very early phase and is slowly being adopted and supported. It might replace password-based login in the future but it might be a while before we see that happening.</li>
</ul>
<p>Note — this doesn’t replace things like token-based authentication flows like OAuth or OIDC or identity providers like Auth0, Okta, Google, and others.</p>
<h2 id="heading-conclusion">Conclusion</h2>
<p>WebAuthn is a much more secure authentication flow than simply using a password. It is phishing resistant and only stores public data on a database with most private data generally stored on the hardware authenticator only. </p>
<p>It makes use of asymmetric cryptography to do a user check and provides a much better UX compared to the existing login flow.</p>
<p>Currently, WebAuthn is majorly being driven as a two-factor authentication or universal 2nd factor workflow. But it could possibly replace password-based login in the future.</p>
<p>Hopefully, this article helps you understand what WebAuthn is and how it works.</p>
<p>Thanks for reading! I really hope that you find this article useful. I’m always interested to know your thoughts and happy to answer any questions you might have in your mind. If you think this post was useful, please share it so others can see it, too.</p>
<p>Also, do feel free to connect with me on <a target="_blank" href="https://www.linkedin.com/in/rohitjmathew">LinkedIn</a> or <a target="_blank" href="https://twitter.com/iamrohitjmathew">Twitter</a>.</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ How to Extend Your Login Flow With Auth0 Actions ]]>
                </title>
                <description>
                    <![CDATA[ I recently attended a training session with the Auth0 Dev Rel team to learn about a cool new feature called Auth0 Actions.  In this article, I am going to explain what Auth0 Actions are, why you'd want to use them, and how to set one up. What are Aut... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/intro-to-auth0-actions/</link>
                <guid isPermaLink="false">66bb4586ce106b2510feda0f</guid>
                
                    <category>
                        <![CDATA[ Auth0 ]]>
                    </category>
                
                    <category>
                        <![CDATA[ authentication ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Rohit Jacob Mathew ]]>
                </dc:creator>
                <pubDate>Wed, 22 Dec 2021 15:46:00 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2021/12/rohit-code-idk-2400-x-1260.jpg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>I recently attended a training session with the Auth0 Dev Rel team to learn about a cool new feature called Auth0 Actions. </p>
<p>In this article, I am going to explain what Auth0 Actions are, why you'd want to use them, and how to set one up.</p>
<h2 id="heading-what-are-auth0-actions">What are Auth0 Actions?</h2>
<p>Actions are secure, tenant-specific, versioned functions written in Node.js that execute at certain points during the Auth0 runtime. Actions are used to customize and extend Auth0's capabilities with custom logic.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1639214635781/VFyOmuqRg.png" alt="&quot;Sample Actions Flow&quot;" width="1600" height="768" loading="lazy"></p>
<p>Above you can see a sample flow. In it, once the user logs into the system, you add a trigger to verify the user's identity using Onfido and then confirm consent using OneTrust before completing the login flow and issuing the token.</p>
<p>In brief, an action is a programmatic way to add custom business logic into your login flow.</p>
<h2 id="heading-why-use-auth0-actions">Why use Auth0 Actions? 🤔</h2>
<p><strong>Extensibility</strong> – they're built to give developers more tooling and a better experience in their login workflows.</p>
<p><strong>Drag N Drop Functionality</strong> – The flow editor lets you visually build custom workflows with drag and drop Action blocks for complete control.</p>
<p><strong>Monaco Code Editor</strong> – Designed with developers in mind, you can easily write JavaScript functions with validation, intelligent code completion, and type definitions with TypeScript support.</p>
<p><strong>Serverless Environment</strong> – Auth0 hosts your custom Action functions and processes them when desired. The functions are stored and run on their infrastructure.</p>
<p><strong>Version Control</strong> – You have the ability to store a history of individual Action changes and the power to revert back to previous versions as needed.</p>
<p><strong>Pre-Production Testing</strong> – Your personal Actions can be drafted, reviewed, and tested before deploying into production</p>
<h2 id="heading-how-to-set-up-auth0-actions">How to Set Up Auth0 Actions</h2>
<p>For the purposes of this demo, we are going to be creating an action to enforce Multi-Factor Authentication (MFA) for a specific role. I will take you through the process of:</p>
<ol>
<li>Creating a role</li>
<li>Adding users</li>
<li>Setting up a demo application</li>
<li>Creating an Action to enforce MFA</li>
<li>Testing the code</li>
</ol>
<p>Let's get started:</p>
<h3 id="heading-1-login-to-your-auth0-account">1) Login to Your Auth0 Account</h3>
<p>The first step to secure your application is to access the Auth0 Dashboard in order to create your Auth0 application. </p>
<p>If you haven’t created an Auth0 account, you can <a target="_blank" href="https://a0.to/signup-for-auth0">sign up for a free one now</a>.</p>
<h3 id="heading-2-create-an-application">2) Create an Application</h3>
<p>Once in the dashboard, move to the Applications tab in the left sidebar.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1639214927748/WpImjm7mg.png" alt="Application Page" width="2880" height="1572" loading="lazy"></p>
<p>Click on Create Application.</p>
<p>Provide a friendly name for your application (like Test Actions App) and choose Single Page Web Applications as an application type.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1639215005392/uhXHjQpPZ.png" alt="Create Application Page" width="2880" height="1572" loading="lazy"></p>
<p>From the quick start tab choose React. Download the sample app. This will have most of the necessary details already in place.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1639215038833/KmbmIA1nt.png" alt="Quick Start Sample" width="2880" height="1572" loading="lazy"></p>
<p>We also need to set up a few settings for this application. Choose the Settings tab (next to quick start). Add your localhost URL to the following places:</p>
<ol>
<li>Allowed Callback URLs</li>
<li>Allowed Logout URLs</li>
<li>Allowed Web Origins</li>
</ol>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1639215091880/cwD9fJnFd.png" alt="Update Application Settings" width="2880" height="1572" loading="lazy"></p>
<h3 id="heading-3-setup-application">3) Setup Application</h3>
<p>Unzip the code we downloaded in a location of your choice. Then open it in the code editor of your choice.</p>
<p>Cross verify that the details of your application are correctly configured in <code>src/auth_config.json</code>.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/12/Screenshot-2021-12-16-at-7.56.39-PM.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>We will run this code locally, so install the dependencies and run it in dev mode (so we have hot reload enabled). To do this, <code>npm install &amp; npm run dev</code>.</p>
<p>Once the application starts you should be shown an SPA like below. If you click on Log In it will take you to your login box.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1639215261508/-E672eefw.png" alt="Sample Application" width="2880" height="1800" loading="lazy"></p>
<h3 id="heading-4-setup-users-and-roles">4) Setup Users and Roles</h3>
<p>Click on the User Management tab in the left sidebar.</p>
<p>Go to the Users tab and click on the Create User button. We need to create 2 users:</p>
<ol>
<li>Admin User</li>
<li>Test User</li>
</ol>
<p>Remember these credentials as these are the test users we will use for this demo.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1639215392817/I51zfr-Ov.png" alt="User Creation" width="2880" height="1572" loading="lazy"></p>
<p>Go to the Roles tab and click on the Create Role button. Call the role <code>Admin</code> and, once it's created, go to the user tab and assign it to your Admin user.</p>
<p>Once this is done go back to your locally running SPA and try logging in with one credential. You should be able to access a user portal like below:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1639215500834/SgGX7vE_5.png" alt="Initial Login" width="2878" height="1796" loading="lazy"></p>
<h3 id="heading-5-setup-actions">5) Setup Actions</h3>
<p>Click on the Actions Tab in the left sidebar. Then go to the Flows category.</p>
<p>Select the Login Flow. This will run the flow of an action once the login process in your login box is complete.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1639215815525/N-h2y-tlI.png" alt="Login Flow" width="2880" height="1574" loading="lazy"></p>
<p>Click on the <code>+</code> button in Add Action and select Build Custom.</p>
<p>Name it MFA for Role and leave the rest as is.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1639215793963/Rj2rC2T6f.png" alt="Action Creation Flow" width="2880" height="1570" loading="lazy"></p>
<p>Once created, you'll come to a screen as follows:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1639215844044/VrPsqFVBz.png" alt="Action Code Editor" width="2870" height="1576" loading="lazy"></p>
<p>Add the below code into the <code>onExecutePostLogin</code> function:</p>
<pre><code>  <span class="hljs-keyword">if</span> (event.authorization != <span class="hljs-literal">undefined</span> &amp;&amp; event.authorization.roles.includes(<span class="hljs-string">"Admin"</span>)) {
      api.multifactor.enable(<span class="hljs-string">"any"</span>);
  };
</code></pre><p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1639215869129/2ELHfGy5s.png" alt="Action Code" width="2880" height="1574" loading="lazy"></p>
<p>On the left side you can see a play button. This is your testing environment inside the actions editor. You will find the <a target="_blank" href="https://auth0.com/docs/actions/triggers/post-login/event-object">event</a> object in which you can test the actions flow by adding <code>Admin</code> to the <code>authorization.roles</code> array.  </p>
<p>When you add the <code>Admin</code> role you should see a response with MFA like below. When it's not present you should get an empty array.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1639215931493/zai-96biU.png" alt="Action Test Case" width="2880" height="1570" loading="lazy"></p>
<p>Click on save draft and deploy. </p>
<p>Go to the flow now and click on the custom actions tab on the right and you should be able to drag and drop the <code>MFA for Roles</code> action into the flow. Click on Apply so that this new flow will work with your login box.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1639215949399/nK49n1ZHZ.png" alt="Action Flow" width="2880" height="1574" loading="lazy"></p>
<p>You will also need to enable MFA on the Auth0 dashboard. </p>
<p>Open the Securities tab and choose multi-factor auth. In the next screen, enable One-time Password. This will let users use an application like Google Authenticator for a one-time password. </p>
<p>There are other factors you can enforce as well, like SMS or Email-based OTP, but for this demo we will be using just the one-time password.  </p>
<p>In the policies section leave everything as is and save your changes.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1639216209703/f54daE0Jo.png" alt="MFA Screen" width="2880" height="1570" loading="lazy"></p>
<h3 id="heading-6-testing-with-your-application">6) Testing With Your Application</h3>
<p>Now when you go to login on the locally running application, you should be triggered to do a MFA for the admin user. So let's test that.</p>
<p>Click on login and redirect to your login box. If you are logged in already, log out and then do the same.</p>
<p>Enter your admin users credentials:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1639216252587/jyNxUdkU9.png" alt="Admin Login" width="2880" height="1800" loading="lazy"></p>
<p>Once the login goes through, you will be prompted to authenticate with your preferred authenticator app. I used google authenticator and entered my OTP.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1639216272416/9BGhY_91S.png" alt="Admin MFA" width="2880" height="1796" loading="lazy"></p>
<p>You will then be asked to consent to share your user data with the application.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1639216291893/v2IITRcrF.png" alt="MFA Consent" width="2880" height="1798" loading="lazy"></p>
<p>Once you accept the above, you should be logged in.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1639216404160/YnZZikEzZ.png" alt="Admin Logged In" width="2880" height="1800" loading="lazy"></p>
<p>If you try the same flow with the test user, you will notice that you are directly logged in after the consent page and no MFA request was triggered. </p>
<p>This is because in our actions code, as shown below, you can see that we check to see if the user roles have the Admin role. If so, then we ask Auth0 to trigger am MFA workflow with any of the enabled MFA use cases of the tenant.</p>
<pre><code>  <span class="hljs-keyword">if</span> (event.authorization != <span class="hljs-literal">undefined</span> &amp;&amp; event.authorization.roles.includes(<span class="hljs-string">"Admin"</span>)) {
      api.multifactor.enable(<span class="hljs-string">"any"</span>);
  };
</code></pre><h2 id="heading-conclusion">Conclusion</h2>
<p>Congrats! You have just created a custom Auth0 Actions flow and tested it. This was a simple example to help you understand what Auth0 Actions are, and how they can be built and used in your workflows. </p>
<p>There are many more complex flows you can build, and you can find some examples provided by Auth0 below. Just click on the trigger and you will find specific examples.</p>
<p><a target="_blank" href="https://auth0.com/docs/actions/triggers/">Sample Actions Code</a></p>
<p>Thanks for reading! I really hope that you find this article useful. If so, please share it so others can see it.</p>
<p>Thanks for reading! :)</p>
<p>P.S Do feel free to connect with me on <a target="_blank" href="https://www.linkedin.com/in/rohitjmathew">LinkedIn</a> or <a target="_blank" href="https://twitter.com/iamrohitjmathew">Twitter</a></p>
<h2 id="heading-appendix">Appendix</h2>
<p>The following sources were really helpful in writing this article:</p>
<ul>
<li><a target="_blank" href="https://auth0.com/blog/introducing-auth0-actions/">Introducing Auth0 Actions - Auth0</a></li>
<li><a target="_blank" href="https://auth0.com/docs/actions">Auth0 Actions - Auth0 Docs</a></li>
</ul>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ How to Use Social Login with OAuth to Make Your Apps More Secure ]]>
                </title>
                <description>
                    <![CDATA[ Many developers have written a demo login application at some point in time. We all start with the simple user defined ID and password. We then try to implement something like a social login with, say, Google or Twitter. There is, of course, a more c... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/how-to-use-social-login-with-oauth-for-more-secure-apps/</link>
                <guid isPermaLink="false">66bb458361078de848a7e0e4</guid>
                
                    <category>
                        <![CDATA[ Application Security ]]>
                    </category>
                
                    <category>
                        <![CDATA[ oauth ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Security ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Rohit Jacob Mathew ]]>
                </dc:creator>
                <pubDate>Fri, 29 Oct 2021 14:50:00 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2021/10/MzBKTcnJA.jpeg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>Many developers have written a demo login application at some point in time. We all start with the simple user defined ID and password. We then try to implement something like a social login with, say, Google or Twitter.</p>
<p>There is, of course, a more complex process involved in setting up social login, but for a user it's as simple as clicking a button to log in. </p>
<p>The ease of not having to remember an ID/password and just being able to signup/login through the click of a button is extremely beneficial to the user.</p>
<h2 id="heading-what-if-i-told-you-this-was-way-more-secure">What if I Told You This Was Way More Secure? 😉</h2>
<p>Social logins really help us achieve a few things:</p>
<ul>
<li>Support for multiple devices</li>
<li>Single Sign On</li>
<li>Simple to implement</li>
<li>The ability to share data for users without having to release personal information</li>
<li>Ability revoke an active session i.e not allow a third party access to the login and data</li>
<li>There are no long-lasting credentials being exchanged</li>
</ul>
<h2 id="heading-so-what-technology-drives-social-login">So What Technology Drives Social Login? 🤔</h2>
<p>The underlying protocol used is something called <a target="_blank" href="https://oauth.net/">OAuth</a>. It is defined as:</p>
<blockquote>
<p>An open protocol to allow secure authorization in a simple and standard method from web, mobile, and desktop applications.</p>
</blockquote>
<p>Now with a basic understanding of social login and the above definition you probably have some idea of how this works – but let me use a simple example to explain how to use OAuth.</p>
<p>I remember my friend <a target="_blank" href="https://twitter.com/lunatic_monk">Sumedh</a> describing it as an interaction between a Mother, Father, and their Son. Imagine that the mother wants some groceries from the market and she wants the son to buy them for her.</p>
<p>Before I go into the conversation let me set some context.</p>
<blockquote>
<p><strong>Mother:</strong> The user of the application</p>
<p><strong>Son:</strong> Third party client or in technical terms the OAuth Client</p>
<p><strong>Father:</strong> The Social Account or in technical terms the OAuth Provider</p>
</blockquote>
<p>The conversation could possibly go like this:</p>
<blockquote>
<p><strong>Mother:</strong> Hey son, go to the market and bring me some coffee powder. Take the required money from your father.</p>
<p><strong>Son:</strong> Okay.</p>
<p><em>Son (OAuth client) goes to father (OAuth provider)</em></p>
<p><strong>Son:</strong> Hey dad, mom told me to take money from you since she wants some things from the market.</p>
<p><em>Father (OAuth provider) asks mother (User) about the permission to give money to their son (OAuth client)</em></p>
<p><strong>Father:</strong> Hey, shall I give him the money and how much?</p>
<p><em>Authorization of your application takes place here.</em></p>
<p><strong>Mother:</strong> Yes, please give it to him.</p>
<p><em>Permission grant by mother (User)</em></p>
<p><em>Son (OAuth client) gets the required things from the market and returns them to mother (User). Here returning things to mother (User) can be thought of redirecting the user (or logging them) into the third party site.</em></p>
</blockquote>
<p>For a more technical understanding of how this works in code, <a target="_blank" href="https://twitter.com/schneems">Richard Schneeman</a> has this amazing video below:</p>
<div class="embed-wrapper">
        <iframe width="560" height="315" src="https://www.youtube.com/embed/tFYrq3d54Dc" style="aspect-ratio: 16 / 9; width: 100%; height: auto;" title="YouTube video player" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen="" loading="lazy"></iframe></div>
<h2 id="heading-now-lets-put-all-of-this-in-context">Now Lets Put All of This in Context</h2>
<p>Let's take as an example <a target="_blank" href="https://dev.to/">the DEV Community</a>. If you wanted to create an account on the DEV Community using Twitter, what would happen?</p>
<p>Basically, if the "Sign up with Twitter" button exists, then the initial setup between the OAuth Client (Dev.to) and the OAuth Provider (Twitter) is already done.</p>
<p>The Client triggers a permission granting page for the OAuth Provider based on the credentials it receives from the initial setup. This looks something like below:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1622980489496/IrLawupb6.png" alt="Permission Grant Page" width="1398" height="1106" loading="lazy"></p>
<p>Once you login and grant permission, the OAuth Provider redirects you back to the client and the client gets a token to access your information from the OAuth Provider. This access token enables the client to get specific data from the provider</p>
<p>Based on that data the client then creates an account and logs you in</p>
<h3 id="heading-what-happens-on-successive-login">What Happens on Successive Login?</h3>
<p>Thats a good question. Now OAuth has multiple grant types, and based on that we have different ways to get an access token from the OAuth Provider. </p>
<p>For all subsequent logins, the OAuth Client will hit the provider and generate a new access token to get access to the data and do the login.</p>
<p>Thus this enables us to achieve Single Sign On, the ability to share data for users without having to release personal information, the ability to revoke access, and the ability to not have long lasting credentials exchanged.</p>
<p>This all leads to a more secure experience.</p>
<h2 id="heading-conclusion">Conclusion</h2>
<p>I hope this short blog post helps you understand why social logins are more secure than the traditional username/password option. I will be writing about the different OAuth Grant types in the future and will be providing code examples as well.</p>
<p>Thanks for reading! I really hope that you find this article useful. I'm always interested to know your thoughts and happy to answer any questions you might have in your mind. If you think this post was useful, please share it to help promote this piece to others.</p>
<p>Thanks for reading! :)</p>
<p>P.S Do feel free to connect with me on <a target="_blank" href="https://www.linkedin.com/in/rohitjmathew">LinkedIn</a> or <a target="_blank" href="https://twitter.com/iamrohitjmathew">Twitter</a></p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ How to Run a Postgres Docker Container on Oracle Cloud Infrastructure ]]>
                </title>
                <description>
                    <![CDATA[ In this article, I will show you how I quickly set up and ran a Docker container for free on Oracle Cloud Infrastructure.  In short, I used a VM in the Always Free Tier of OCI, and for a side project I set up a dockerised Postgres database. Let's ]]>
                </description>
                <link>https://www.freecodecamp.org/news/run-a-postgres-docker-container-on-oracle-cloud-infrastructure/</link>
                <guid isPermaLink="false">66bb459002bd925c2f723222</guid>
                
                    <category>
                        <![CDATA[ Cloud Computing ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Docker ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Oracle ]]>
                    </category>
                
                    <category>
                        <![CDATA[ postgres ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Rohit Jacob Mathew ]]>
                </dc:creator>
                <pubDate>Thu, 28 Oct 2021 15:33:00 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2021/10/1QBgoEFNf.jpeg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>In this article, I will show you how I quickly set up and ran a Docker container for free on Oracle Cloud Infrastructure. </p>
<p>In short, I used a VM in the Always Free Tier of OCI, and for a side project I set up a dockerised Postgres database.</p>
<p>Let's get into the details a bit more now.</p>
<h2 id="heading-why-oracle-cloud-infrastructure">Why Oracle Cloud Infrastructure</h2>
<p>Oracle offers an Always Free cloud services option. You can see the details below:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1627392039154/de-tKbxcu.png" alt="Oracle Cloud Free Offering" width="2880" height="1146" loading="lazy"></p>
<p>Note that the workload of a container has to fit in the shape of this always free VM: VM.Standard.E2.1.Micro, 1/8 OCPU, 1 GB RAM and up to 480 Mbps network bandwidth (see the <a target="_blank" href="https://docs.cloud.oracle.com/en-us/iaas/Content/FreeTier/resourceref.htm">docs</a>). The boot volume offers just over 45GB of disk storage.</p>
<p>In order for the container to be accessible, the ports mapped on the VM to container also have to be configured in ingress rules in the security list. We need to install Docker ourselves in the VM – it's provisioned with just an Oracle Linux image.</p>
<p>Lets get started.</p>
<h2 id="heading-step-1-get-yourself-a-tenancy-and-create-a-virtual-machine">Step 1 – Get yourself a tenancy and create a virtual machine</h2>
<p>The first thing we need to do is create a VM. If you've got a cloud tenancy then you probably already know how to create an instance. If you're new to Oracle Cloud, then watch the below video and create an "always free" VM by signing up at <a target="_blank" href="https://cloud.oracle.com/free">https://cloud.oracle.com/free</a>:</p>
<div class="embed-wrapper">
        <iframe width="560" height="315" src="https://www.youtube.com/embed/Fiu9BiNocJ4" style="aspect-ratio: 16 / 9; width: 100%; height: auto;" title="YouTube video player" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen="" loading="lazy"></iframe></div>
<p>Note: Most of the details like availability zone, image details, and networking options are already pre-filled by Oracle. But you can adjust them if you want something specific. I went ahead with the standard settings.</p>
<p>The VM will now be provisioned as is indicated here:</p>
<p><img src="https://miro.medium.com/max/1400/0*xGhUET08TkqbImko.png" alt="Example of provisioned VM from Oracle Developer Blog" width="600" height="400" loading="lazy"></p>
<p>After a little while, the VM will be up and running — and has a public IP address assigned to it:</p>
<p><img src="https://miro.medium.com/max/1400/0*h0JYNsMZtsitKN2t.png" alt="Example of running VM from Oracle Developer Blog" width="600" height="400" loading="lazy"></p>
<p>The situation at this point can be visualized as is shown in the below figure:</p>
<p><img src="https://miro.medium.com/max/1272/0*buppgWcJ5Wqgm3TK.png" alt="Visualization of the VM setup from Oracle Developer Blog" width="600" height="400" loading="lazy"></p>
<h2 id="heading-step-2-setup-the-ingress-rules-in-the-security-list-for-your-vm">Step 2 – Setup the Ingress Rules in the Security List for your VM</h2>
<p>This lets you open up the ports required for whatever container you want to run.</p>
<p>The VM is associated with a public subnet in a Virtual Cloud Network. The security list(s) for this subnet should be configured with ingress rules that make the required traffic possible to the port(s) that will be mapped to the container image.</p>
<p>Open the details page for the public subnet. Click on the security list (or create a new one):</p>
<p><img src="https://miro.medium.com/max/1400/0*fgaHDl-hyONzSeh9.png" alt="Subnet Screen from Oracle Developer Blog" width="600" height="400" loading="lazy"></p>
<p>We will run the Postgres container image. The port we map in the VM to the Postgres container is one we can choose ourselves. Let’s pick 5432 which is the default port for Postgres. </p>
<p>We need to configure an ingress rule as below:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1627395159097/36GiB4i22.png" alt="Ingress Rule Screenshot" width="1440" height="1212" loading="lazy"></p>
<p>Source CIDR is set to 0.0.0.0/0, and Source Port Range is left blank (that is, All) which means that this rule applies to any client.</p>
<h2 id="heading-step-3-ssh-into-the-vm-and-install-docker">Step 3 – SSH into the VM and install Docker</h2>
<p>At this point, we have a running VM instance with just a Linux Operating System but no Docker. Let’s SSH into the VM using this command:</p>
<pre><code>ssh opc@public-id-address -i private-key-file
</code></pre><p>Replace the public-id-address with the public IP assigned to the VM. Replace private-key-file with a reference to the file that contains the SSH private key.</p>
<p>Now to install Docker, execute these commands:</p>
<pre><code>sudo yum-config-manager --enable ol7_addons 
sudo yum install docker-engine -y 
sudo systemctl start docker 
sudo systemctl enable docker
</code></pre><p><img src="https://miro.medium.com/max/1400/0*tAhI8bQyLIaDPQ3T.png" alt="Docker installation screenshot from Oracle Developer Blog" width="600" height="400" loading="lazy"></p>
<p>To run Docker as a non-root user, read <a target="_blank" href="https://docs.docker.com/engine/security/rootless/">these instructions</a>.</p>
<h2 id="heading-how-to-run-the-docker-container-image">How to Run the Docker Container Image</h2>
<p>With Docker installed, we can now run the Postgres container image.</p>
<p>Run the container image with this command. Don't forget to add a different password for <code>POSTGRES_PASSWORD</code>:</p>
<pre><code>sudo docker run -d -p <span class="hljs-number">5432</span>:<span class="hljs-number">5432</span> --name postgres -e POSTGRES_PASSWORD=mysecretpassword postgres
</code></pre><p>Use <code>sudo docker ps</code> to verify if the container is running. The above command will start a PostgreSQL database and map ports using the following pattern: <code>-p &lt;host_port&gt;:&lt;container_port&gt;</code>.</p>
<p>Port 5432 of our container will be mapped on port 5432 of our host or server.</p>
<p>Access the container on your host or server. We will create a database inside our Postgres container.</p>
<pre><code>sudo docker exec -it postgres bash
</code></pre><p>Now you are ‘inside’ your container. We can access Postgres and create the database.</p>
<pre><code>root@<span class="hljs-number">12</span>d48fde2627:/# psql -U postgres
psql (<span class="hljs-number">13.3</span> (Debian <span class="hljs-number">13.3</span><span class="hljs-number">-1.</span>pgdg100+<span class="hljs-number">1</span>))
Type <span class="hljs-string">"help"</span> <span class="hljs-keyword">for</span> help.

postgres=# CREATE DATABASE testdb;
CREATE DATABASE
postgres=# \q
</code></pre><p>And with that we're done! You can exit your container (<code>\q</code>) and go to your local machine. </p>
<p>Here you need a PostgreSQL Client tool installed like <a target="_blank" href="https://dbeaver.io/">DBeaver</a> or <a target="_blank" href="https://www.pgadmin.org/">pgAdmin</a>. Connect to the DB server by using the public IP as the host, <code>5432</code> as the port, <code>postgres</code> as the username, the <code>POSTGRES_PASSWORD</code> as the password and connect to the <code>testdb</code>. Save the connect and you should now be able to access your DB.</p>
<h2 id="heading-congrats-you-have-now-run-a-postgres-docker-container-on-oracle-cloud-infrastructure">Congrats, you have now run a Postgres Docker Container on Oracle Cloud Infrastructure!</h2>
<p>Thanks for reading! I really hope that you find this article useful. I'm always interested to know your thoughts and happy to answer any questions you might have in your mind. If you think this post was useful, please share it to help promote this piece to others.</p>
<p>Thanks for reading! :)</p>
<p>P.S. Do feel free to connect with me on <a target="_blank" href="https://www.linkedin.com/in/rohitjmathew">LinkedIn</a> or <a target="_blank" href="https://twitter.com/iamrohitjmathew">Twitter</a>.</p>
<h2 id="heading-resources">Resources</h2>
<p>This article leans heavily on the following material:</p>
<ul>
<li><a target="_blank" href="https://medium.com/oracledevs/run-always-free-docker-container-on-oracle-cloud-infrastructure-c88e36b65610">Run Always Free Docker Container on Oracle Cloud Infrastructure</a> - Lucas Jellema</li>
<li><a target="_blank" href="https://betterprogramming.pub/connect-from-local-machine-to-postgresql-docker-container-f785f00461a7">Connect From Your Local Machine to a PostgreSQL Database in Docker</a> - Lorenz Vanthillo</li>
</ul>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ How to Manage Encryption at Scale with Envelope Encryption & Key Management Systems ]]>
                </title>
                <description>
                    <![CDATA[ Recently at work, I came across an interesting method to handle encryption at scale called envelope encryption.  First of all, it increases security and helps you ease out the management of encryption keys. But it's also a highly recommended pattern ... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/envelope-encryption/</link>
                <guid isPermaLink="false">66bb457cce106b2510feda0d</guid>
                
                    <category>
                        <![CDATA[ Application Security ]]>
                    </category>
                
                    <category>
                        <![CDATA[ encryption ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Rohit Jacob Mathew ]]>
                </dc:creator>
                <pubDate>Wed, 27 Oct 2021 22:52:59 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2021/10/1400-x-600.jpg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>Recently at work, I came across an interesting method to handle encryption at scale called envelope encryption. </p>
<p>First of all, it increases security and helps you ease out the management of encryption keys. But it's also a highly recommended pattern by PCI-DSS (Security Standard for Credit Card Processing) and results in much stronger data privacy and data protection of Personally Identifiable Information (PII). </p>
<p>When we think of data, there are 3 places we can think of encrypting it:</p>
<ul>
<li>At Rest – on hardware storage devices like a disk or in your devices</li>
<li>In Transit – while moving data between different locations like server to server through API calls</li>
<li>In Use – while it's being used by a server (this is a new concept and is still being researched)</li>
</ul>
<p>We will be dealing primarily with encryption at rest, and envelope encryption is a popular pattern for this use case.</p>
<h2 id="heading-so-what-is-envelope-encryption">So What is Envelope Encryption? 🤔</h2>
<p>Envelope encryption involves encrypting your data with a Data Encryption Key, then encrypting the Data Encryption Key (DEK) with a Customer Master Key (CMK). </p>
<p>You then store both the encrypted data and the encrypted DEK alongside each other in the database. This practice of using a wrapping key to encrypt data keys is known as envelope encryption.</p>
<p>You need to understand these two keys before we see how the encryption process takes place:</p>
<ol>
<li>Customer Master Key (CMK)</li>
<li>Data Encryption Key (DEK)</li>
</ol>
<h3 id="heading-customer-master-keysroot-keyskey-encryption-keys-cmk">Customer Master Keys/Root Keys/Key Encryption Keys (CMK)</h3>
<p>These are symmetric keys used to encrypt, decrypt, and re-encrypt data. They can also generate Data Encryption Keys that you can use outside of the KMS system. They follow the below rules:</p>
<ul>
<li>Access to these keys must be restricted to the least endpoints</li>
<li>Access to these keys should be secured through ACL</li>
<li>These keys must be stored in a location that is secure like a KMS of a Hardware Security Module (to comply with <a target="_blank" href="https://en.wikipedia.org/wiki/FIPS_140-2">FIPS 140-2</a>)</li>
</ul>
<p>In systems like Google Cloud Key Management Service, you have a hierarchy of keys as seen below (you can find more information <a target="_blank" href="https://cloud.google.com/security/encryption/default-encryption#encryption_key_hierarchy_and_root_of_trust">here</a>):</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1635198625726/DgTfDZpGk.png" alt="Encryption Key Hierarchy at Google" width="1281" height="1625" loading="lazy"></p>
<h3 id="heading-data-encryption-keys-dek">Data Encryption Keys (DEK)</h3>
<p>Data keys are encryption keys you can use to encrypt data, including large amounts of data and other data encryption keys. </p>
<p>Unlike CMK's, which can't be downloaded, data keys are returned to you for use outside of the KMS. Some of the best practices for DEKs are as follows:</p>
<ul>
<li>You should generate DEKs locally</li>
<li>When stored, always ensure DEKs are encrypted at rest</li>
<li>For easy access, store the DEK near the data that it encrypts</li>
<li>Generate a new DEK every time you write the data. This means you don't need to rotate the DEKs.</li>
<li>Do not use the same DEK to encrypt data from two different users</li>
<li>Use a strong algorithm such as 256-bit Advanced Encryption Standard (AES)</li>
</ul>
<h2 id="heading-envelope-encryption-process">Envelope Encryption Process</h2>
<p>First, an API request is sent to KMS to generate Data key using CMK.</p>
<p>Then the KMS returns a response with Plain Data key and Encrypted Data key (using CMK).</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1635198711784/Bm05yko4g.png" alt="Generate Data Keys" width="426" height="531" loading="lazy"></p>
<p>Data is encrypted using the Plain Data key, and then the Plain Data key is removed from memory.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1635198735343/vjqUrCTa1.png" alt="Encryption Process" width="479" height="289" loading="lazy"></p>
<p>The Encrypted Data and Encrypted Data Key are packaged together as an envelope and stored.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1635198756845/mXf8rwGhU.png" alt="Encryption Process With Data Stored at Rest" width="654" height="238" loading="lazy"></p>
<h2 id="heading-decryption-process">Decryption Process</h2>
<p>First, the Encrypted Data key is extracted from the envelope.</p>
<p>Then an API request is sent to KMS using Encrypted Data key which has information about CMK to be used in KMS for decryption.</p>
<p>The KMS returns a response with the Plain Data Key.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1635198816460/dl8Q5RoPKew.png" alt="Getting Plaintext Data Key" width="564" height="366" loading="lazy"></p>
<p>Then the Encrypted Data is decrypted using the Plain Data key, and the Plain Data Key is removed from memory.</p>
<h2 id="heading-how-is-envelope-encryption-different-from-other-encryption-patterns"><strong>How is Envelope Encryption Different From Other Encryption Patterns</strong>? 🤔</h2>
<p>Every service you build requires encryption at some point. This could be passwords or PII in a database, credentials for an external service, or even files in a filesystem.</p>
<h3 id="heading-configuration-files">Configuration Files</h3>
<p>You can easily handle some of these situations with a configuration file but they pose their own security risks like:</p>
<ul>
<li>Proper planning is needed to keep the data secure</li>
<li>Multiple formats are present, like YAML, JSON and XML to name a few</li>
<li>Exact storage locations may be hard-coded in the app, making deployment potentially problematic</li>
<li>Parsing of the config files can be problematic.</li>
</ul>
<h3 id="heading-symmetric-encryption">Symmetric Encryption</h3>
<p>You can encrypt data using a symmetric key but they suffer from a major issue which is Key Management.</p>
<p>You need to find a way to get the key to the party with whom you are sharing data. But if someone gets their hands on a symmetric key, they can decrypt everything encrypted with that key.</p>
<h3 id="heading-asymmetric-encryption">Asymmetric Encryption</h3>
<p>You can encrypt data using Asymmetric Encryption which is considered a standard now a days. However, some of its cons are:</p>
<ul>
<li>It is a slow process which makes its not suitable for decrypting bulk messages</li>
<li>When you lose your private key, your received messages will not be decrypted</li>
<li>If your private key is identified by an attacker, they can read all of your messages </li>
</ul>
<h3 id="heading-envelope-encryption">Envelope Encryption</h3>
<p>Some of the benefits offered by envelope encryption are:</p>
<ul>
<li><strong>A combination of benefits from symmetric and asymmetric encryption</strong> – The data is encrypted using a DEK which follows symmetric encryption. The DEK is encrypted by a CMK which follows asymmetric encryption. By using asymmetric encryption, encrypted DEKs can be shared and unencrypted only by those with access to the CMK, mitigating the key exchange problem of symmetric algorithms.</li>
<li><strong>Easier key management</strong> – Multiple DEKs can be encrypted under a singular root key and ease the management of keys in a KMS. You can also do more secure key maintenance by rotating your root keys, instead of rotating and re-encrypting all of your DEKs.</li>
<li><strong>Data key protection</strong> – Because we encrypt the data key with the CMK, we don't have to worry about storing the encrypted data key. Thus, we can safely store the encrypted data key alongside the encrypted data.</li>
</ul>
<h2 id="heading-why-key-management-systems-work-well-at-scale">Why Key Management Systems Work Well at Scale</h2>
<p>Envelope Encryption and KMSs working so well at scale because of <strong>Performance.</strong> Like we mentioned before, Asymmetric Encryptions are typically slow and Symmetric Encryptions are very fast but managing keys can be an issue. </p>
<p>So in Envelope Encryption, for a large quantity of data, you quickly encrypt it using symmetric encryption with a random key. Then just the key is encrypted using asymmetric encryption. This gives the benefits of asymmetric encryption, with the performance of symmetric encryption.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1635198563732/1E9VcEqZ-.png" alt="KMS Used at Scale in Google" width="2158" height="742" loading="lazy"></p>
<p>Key Management Systems like AWS KMS, Azure Key Vault, and Google Cloud Key Management Service gives you a fully managed service to store and manage encryption keys. These use envelope encryption internally, and they’re used by default in a lot of services that support encryption in cloud infrastructure providers like AWS, GCP, Azure, and others.</p>
<p>An ideal key management system should be highly available, it should control access to the master key(s), it should audit the key(s) usage, and finally, it should manage key(s) lifecycle.</p>
<p>Thus by having the above characteristics and by using envelope encryption internally, Key Management Systems are ideal to handle encryption at scale.</p>
<h2 id="heading-summary">Summary</h2>
<p>Envelope Encryption is one of the most trusted application security design patterns used at scale. It is the default encryption method used in services like AWS S3, GCP, and others. </p>
<p>Hopefully, this helps you understand how you can encrypt/decrypt a large amount of data using the envelope encryption method at scale in a more trusted setup.</p>
<p>Thanks for reading! I really hope that you find this article useful. I'm always interested to know your thoughts and am happy to answer any questions you might have. If you think this post was useful, please share it so others can read it, too.</p>
<p>P.S. – Do feel free to connect with me on <a target="_blank" href="https://www.linkedin.com/in/rohitjmathew">LinkedIn</a> or <a target="_blank" href="https://twitter.com/iamrohitjmathew">Twitter</a>.</p>
<h2 id="heading-resources">Resources</h2>
<p>This article leans heavily on the following material:</p>
<ul>
<li><a target="_blank" href="https://jayendrapatil.com/tag/envelope-encryption/">Google Cloud Data Encryption - Jayendra's Cloud Certification Blog -</a></li>
<li><a target="_blank" href="https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html">AWS KMS concepts - AWS</a></li>
<li><a target="_blank" href="https://lobster1234.github.io/2017/09/29/aws-kms-envelope-encryption/">AWS KMS and Envelope Encryption - Manish Pandit</a></li>
<li><a target="_blank" href="https://blog.nilayparikh.com/security/application/cloud-architecture-patterns-envelope-encryption-or-digital-envelope-with-public-cloud-providers-part-1/">Cloud Architecture Pattern: Envelope Encryption (or Digital Envelope) with Public Cloud Providers Part 1 - Nilay Parikh</a></li>
<li><a target="_blank" href="https://dev.to/chiragdm/aws-kms-envelope-encryption-3689">AWS KMS Envelope Encryption - Chirag Modi</a></li>
<li><a target="_blank" href="https://cloud.ibm.com/docs/key-protect?topic=key-protect-envelope-encryption">Protecting data with envelope encryption - IBM</a></li>
<li><a target="_blank" href="https://cloud.google.com/kms/docs/envelope-encryption">Envelope encryption - GCP</a></li>
<li><a target="_blank" href="https://cloud.google.com/security/encryption/default-encryption">Encryption at rest in Google Cloud - GCP</a></li>
</ul>
<div class="embed-wrapper">
        <iframe width="560" height="315" src="https://www.youtube.com/embed/StJ1NOQjAjo" style="aspect-ratio: 16 / 9; width: 100%; height: auto;" title="YouTube video player" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen="" loading="lazy"></iframe></div>
 ]]>
                </content:encoded>
            </item>
        
    </channel>
</rss>
