<?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 Malaya Khuntia on Medium]]></title>
        <description><![CDATA[Stories by Malaya Khuntia on Medium]]></description>
        <link>https://medium.com/@malaya-khuntia?source=rss-37a694a25704------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*iJWQ3ERsoxZaarW7QK6gmg.png</url>
            <title>Stories by Malaya Khuntia on Medium</title>
            <link>https://medium.com/@malaya-khuntia?source=rss-37a694a25704------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 03:03:51 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@malaya-khuntia/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Beyond the Password [Part 7]: The Security Endgame — ZKPs, SSI, and Post-Quantum Defense]]></title>
            <link>https://malaya-khuntia.medium.com/beyond-the-password-part-7-the-security-endgame-zkps-ssi-and-post-quantum-defense-72082dd6eab5?source=rss-37a694a25704------2</link>
            <guid isPermaLink="false">https://medium.com/p/72082dd6eab5</guid>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[cryptography]]></category>
            <category><![CDATA[future]]></category>
            <category><![CDATA[privacy]]></category>
            <dc:creator><![CDATA[Malaya Khuntia]]></dc:creator>
            <pubDate>Sat, 22 Aug 2026 01:31:01 GMT</pubDate>
            <atom:updated>2026-08-22T01:31:01.395Z</atom:updated>
            <content:encoded><![CDATA[<p>We have reached the end of our journey.</p><p>Over the last six articles, we’ve traveled from the basics of <strong>Salts and Peppers</strong> to the cutting-edge world of <strong>Passkeys</strong>. We’ve built a robust framework for identity, session management, and authorization. If you’ve followed along, you now have the tools to build systems that are significantly more secure than 99% of what exists on the web today.</p><p>But the world of cybersecurity never stands still. Even as we adopt Passkeys, new challenges are emerging. How do we prove who we are without giving away our private data? Who truly owns our digital identity? And what happens when the computers of the future become powerful enough to break every encryption method we currently use?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9fLNEQGIQhx6Jk495LhawQ.png" /></figure><p>Welcome to the <strong>Endgame</strong>.</p><h3>1. Zero-Knowledge Proofs (ZKP): Truth Without Data</h3><p>In our current systems, to prove I am over 18, I usually have to show you my ID, which also reveals my full name, address, and exact birth date. This is a massive privacy leak.</p><p><strong>Zero-Knowledge Proofs (ZKP)</strong> change this. They allow one party (the prover) to prove to another (the verifier) that a statement is true, without revealing <em>any</em> information beyond the validity of the statement itself.</p><ul><li><strong>The Goal:</strong> Proving “I know the secret” without ever showing the secret.</li><li><strong>The Practical Use:</strong> Imagine a login where you prove to the server that you have the correct password, but the server <strong>never actually receives the password or even its hash.</strong> If the server is breached, there is absolutely nothing for the hacker to steal because the server never “knew” the secret to begin with.</li></ul><blockquote><strong>The Analogy:</strong><br>Imagine a “Where’s Waldo?” book. I want to prove to you that I found Waldo, but I don’t want you to see where he is. I take a giant sheet of cardboard with a tiny hole in it, place it over the book so only Waldo shows through the hole, and show it to you. You now know I found him, but you have no idea where he is on the page.</blockquote><h3>2. Self-Sovereign Identity (SSI): Reclaiming the Crown</h3><p>Currently, your digital identity is “rented.” It lives in the databases of Google, Facebook, or your employer. If they delete your account, your “identity” vanishes.</p><p><strong>Self-Sovereign Identity (SSI)</strong> shifts the power back to the user. Instead of a central company vouching for you, you hold “Verifiable Credentials” in a private digital wallet.</p><ul><li><strong>How it works:</strong> A trusted authority (like a government) signs a digital credential. You store that credential on your own device. When you need to log in to a service, you present a “proof” of that credential.</li><li><strong>The Shift:</strong> We move from <strong>Federated Identity</strong> (Part 4), where Google is the middleman, to <strong>Decentralized Identity,</strong> where <em>you</em> are the middleman.</li></ul><h3>3. The Ticking Time Bomb: Post-Quantum Cryptography (PQC)</h3><p>Everything we’ve discussed in this series — JWT signatures, OAuth, Passkeys relies on mathematical problems that are “hard” for today’s computers to solve (like factoring large prime numbers).</p><p>However, <strong>Quantum Computers</strong> are coming. Algorithms like <em>Shor’s Algorithm</em> have already proven that a sufficiently powerful quantum computer could break RSA and ECC (the math behind almost all current web security) in minutes.</p><ul><li><strong>The Threat:</strong> “Harvest Now, Decrypt Later.” Hackers are already stealing encrypted data today, waiting for the day they can use a quantum computer to unlock it.</li><li><strong>The Defense:</strong> The industry is currently racing to implement <strong>Post-Quantum Cryptography (PQC)</strong> — new mathematical puzzles that are resistant even to quantum attacks.</li></ul><h3>4. The Complete Framework: A Final Review</h3><p>As we close this series, let’s look at the “Secure Stack” we’ve built together:</p><ol><li><strong>The Foundation:</strong> Use strong, slow hashes (Argon2) with Salts and Peppers.</li><li><strong>The Session:</strong> Use HttpOnly, Secure cookies and understand the stateless nature of JWTs.</li><li><strong>The Second Wall:</strong> MFA is non-negotiable. Use TOTP or Hardware keys.</li><li><strong>The Bridge:</strong> Leverage OAuth 2.0 and OIDC for seamless, federated access.</li><li><strong>The Logic:</strong> Master RBAC and ABAC to ensure users only touch what they own.</li><li><strong>The Modern Standard:</strong> Transition to Passkeys to eliminate the “Password Problem” entirely.</li><li><strong>The Future:</strong> Keep an eye on ZKPs and Quantum-resistant algorithms to stay ahead of the curve.</li></ol><h3>5. Final Implementation Checklist</h3><ol><li>✅ <strong>Audit Regularly:</strong> Security is a snapshot in time. What is secure today may be broken tomorrow.</li><li>✅ <strong>Stay Informed:</strong> Follow the NIST standards for Post-Quantum Cryptography.</li><li>✅ <strong>Prioritize Privacy:</strong> Whenever possible, ask for “Proofs” rather than “Data” (The ZKP mindset).</li><li>✅ <strong>Build for Resilience:</strong> Assume your database <em>will</em> be leaked. Design your system so that a leak contains nothing of value to an attacker.</li></ol><h3>Conclusion: Security is a Journey</h3><p>If there is one thing I hope you take away from this 7-part series, it is this: <strong>Security is not a feature you “add” to an app; it is a mindset you use to build it.</strong></p><p>We have moved from simple strings of text to complex asymmetric handshakes and quantum-resistant math. The tools will continue to change, but the core goal remains the same: protecting the people who trust us with their data.</p><p>Thank you for following along with the <strong>Beyond the Password</strong> series. Now, go forth and build something secure!</p><p><strong>Missed any part of the series? Catch up here:</strong></p><p><a href="https://medium.com/@malaya-khuntia/beyond-the-password-part-1-the-definitive-guide-to-hashes-salts-and-peppers-c462ad2c8615">[Part 1: The Definitive Guide to Hashes, Salts, and Peppers]</a><br><a href="https://medium.com/@malaya-khuntia/beyond-the-password-part-2-the-token-trap-cookies-jwts-and-the-war-for-session-security-ed406b8884e1">[Part 2: The Token Trap — Cookies vs. JWTs]</a><br><a href="https://medium.com/@malaya-khuntia/beyond-the-password-part-3-the-second-wall-mfa-totp-and-adaptive-defense-7f906d4bfc44">[Part 3: The Second Wall — MFA and TOTP]</a><br><a href="https://medium.com/@malaya-khuntia/beyond-the-password-part-4-the-login-with-google-magic-understanding-oauth-2-0-and-oidc-e73f0890472d?sharedUserId=malaya-khuntia">[Part 4: The “Login with Google” Magic — OAuth 2.0 and OIDC]</a><br><a href="https://medium.com/@malaya-khuntia/beyond-the-password-part-5-who-goes-there-mastering-rbac-abac-and-authorization-de003d863c75?sharedUserId=malaya-khuntia">[Part 5: Who Goes There? — Mastering RBAC, ABAC, and Authorization]</a><br><a href="https://medium.com/@malaya-khuntia/beyond-the-password-part-6-the-passwordless-revolution-passkeys-and-webauthn-9885317d9b80?sharedUserId=malaya-khuntia">[Part 6: The Passwordless Revolution — Passkeys and WebAuthn]</a></p><p><em>Keywords: ZKP, Zero-Knowledge Proofs, SSI, Self-Sovereign Identity, Post-Quantum Cryptography, PQC, Cybersecurity Future, Blockchain Identity, Web3 Security.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=72082dd6eab5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Beyond the Password [Part 6]: The Passwordless Revolution — Passkeys and WebAuthn]]></title>
            <link>https://malaya-khuntia.medium.com/beyond-the-password-part-6-the-passwordless-revolution-passkeys-and-webauthn-9885317d9b80?source=rss-37a694a25704------2</link>
            <guid isPermaLink="false">https://medium.com/p/9885317d9b80</guid>
            <category><![CDATA[cryptography]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[Malaya Khuntia]]></dc:creator>
            <pubDate>Wed, 19 Aug 2026 01:31:01 GMT</pubDate>
            <atom:updated>2026-08-19T01:31:01.912Z</atom:updated>
            <content:encoded><![CDATA[<p>We have spent the last five parts of this series discussing how to hash passwords, secure sessions, add MFA, and manage permissions. But despite all these layers of defense, the industry has realized a painful truth: <strong>The password itself is the problem.</strong></p><p>Over 80% of data breaches are linked to stolen, weak, or reused passwords. No matter how much we salt or pepper them, as long as a “secret string” exists in a user’s head, it can be phished, guessed, or intercepted.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hLWn6zi-o-DzloefFXwWaA.png" /></figure><p>Welcome to the <strong>Passwordless Revolution</strong>. We are moving toward a world where your face, your fingerprint, or your hardware key is the only “password” you’ll ever need.</p><h3>1. The Core Definition: What is a Passkey?</h3><p>A <strong>Passkey</strong> is not just a fancy way to log in with Face ID. It is a digital credential based on a standard called <strong>WebAuthn</strong> (Web Authentication).</p><p>Unlike a password, which is a “Shared Secret” (both you and the server know it), a Passkey is based on <strong>Asymmetric Cryptography</strong>.</p><ul><li><strong>The Public Key:</strong> Stored on the server (like a lock).</li><li><strong>The Private Key:</strong> Stored securely in your device’s hardware (like the physical key).</li></ul><blockquote><strong>The Analogy:</strong><br>A password is like a <strong>Secret Code</strong> used to enter a clubhouse. If someone overhears you saying it, they can use it too.<br>A Passkey is like a <strong>Physical Signet Ring</strong>. You don’t tell the guard what the ring looks like; you just press the ring into a wax seal to prove you have it. The guard never needs to see the ring itself.</blockquote><h3>2. The Technical Deep-Dive: How WebAuthn Works</h3><p>When you register a Passkey on a website, a “Ceremony” happens behind the scenes:</p><ol><li><strong>Key Generation:</strong> Your device (phone or laptop) generates a new pair of cryptographic keys.</li><li><strong>Public Key Exchange:</strong> Your device sends the <strong>Public Key</strong> to the server. The <strong>Private Key</strong> never leaves your device’s Secure Enclave.</li><li><strong>The Challenge:</strong> When you try to log in, the server sends a random “Challenge.”</li><li><strong>The Signature:</strong> Your device asks for your biometric (FaceID/Fingerprint). Once verified, it uses the Private Key to “sign” the challenge and sends it back.</li><li><strong>The Verification:</strong> The server uses the Public Key to verify the signature. If it matches, you’re in.</li></ol><h3>3. The Comparison: Passwords vs. Passkeys</h3><p>Why is this so much better than what we have now?</p><ul><li><strong>Phishing Resistance:</strong> This is the “Killer Feature.” A Passkey is cryptographically “bound” to the specific website. If you land on a fake “phishing” version of Google, your browser will realize the domain doesn’t match and won’t even offer the Passkey. You cannot be tricked into giving it away.</li><li><strong>No More “Brute Force”:</strong> There is no string to guess. An attacker could try a trillion passwords, but they can’t “guess” a 256-bit cryptographic signature.</li><li><strong>Zero Database Risk:</strong> If a hacker leaks your database, they only get <strong>Public Keys</strong>. A Public Key is useless without the matching Private Key sitting in the user’s pocket.</li><li><strong>Ex:</strong> <em>YubiKey, TitanKey, etc.</em></li></ul><h3>4. The Challenges: What Could Go Wrong?</h3><p>If Passkeys are so perfect, why isn’t every site using them?</p><ol><li><strong>Device Support:</strong> While most modern iPhones, Androids, and Macs support Passkeys, older hardware does not. Developers must still provide “fallback” methods (like magic links).</li><li><strong>Implementation Complexity:</strong> Moving from a simple password column in a database to a WebAuthn-compatible architecture requires a significant shift in backend logic.</li><li><strong>The “Lost Phone” Problem:</strong> If your Private Key is on your phone and you drop your phone in the ocean, are you locked out forever?</li></ol><blockquote><strong>The Solution:</strong> Cloud Sync. Apple (iCloud Keychain) and Google (Password Manager) now sync Passkeys across your devices so you can recover them.</blockquote><h3>5. Under the Hood: How Asymmetric Verification Actually Proves It’s You</h3><p>To understand why Passkeys are unhackable via traditional means, we have to look at the engine under the hood: <strong>Asymmetric Cryptography</strong>.</p><p>In the old “Password” world, you and the server shared a secret. In the “Passkey” world, the server doesn’t know your secret; it only knows a mathematical “puzzle” that only your device can solve.</p><h4>The Technical Protocol: Challenge &amp; Response</h4><p>When you click “Login,” the following cryptographic “handshake” occurs:</p><ol><li><strong>The Challenge (The Nonce):</strong> The server sends a unique, random string of bits called a <strong>Challenge</strong> (or Nonce). This ensures that every login attempt is brand new and cannot be “replayed” by a hacker later.</li><li><strong>The Signature (The Private Key Action):</strong> Your device takes that Challenge and mixes it with your <strong>Private Key</strong> using a mathematical algorithm (usually <strong>ECDSA</strong> or <strong>EdDSA</strong>). This creates a <strong>Digital Signature</strong>.</li><li><strong>The Metadata (The Authenticator Data):</strong> Along with the signature, your device sends a bit of data proving that a human was actually there (User Presence) and that they successfully passed a biometric check (User Verification).</li><li><strong>The Verification (The Public Key Action):</strong> The server receives the Signature and the original Challenge. It then uses your <strong>Public Key</strong> to perform a calculation.</li></ol><blockquote><strong><em>The Mathematical Magic:</em></strong> Because of the way asymmetric math works, the Public Key can verify that the Signature was created by the <em>corresponding</em> Private Key, even though the server has never seen that Private Key.</blockquote><h4>Why this is “Phish-Proof”</h4><p>In a traditional login, if a hacker intercepts your password, they “are” you.<br>In a WebAuthn login, the signature is tied to the <strong>Origin</strong> (the website domain). Your device’s hardware will refuse to sign a challenge from fakegoogle.com using the key you generated for google.com. It&#39;s like the normal human eye doesn&#39;t intercept the actual difference, but the tech knows how to verify and prevent it, <strong>e.g., “microsoft” “rnicrosoft”</strong></p><p><strong>The Technical Takeaway:</strong><br>Even if a hacker sits in the middle of the connection and sees the Challenge and the Signature, they gain <strong>zero</strong> useful information. They cannot use that signature to log in again, and they cannot work backward from the signature to find your Private Key. The math only works one way.</p><h3>6. The Mathematical Fail-Safe: Why Another User’s Key Fails</h3><ul><li><strong>The Unique Pairing:</strong> During the registration phase (Part 5, Section 2), the server doesn’t just store a “generic” public key. It stores <strong>Your Specific Public Key</strong> linked directly to your user_id in the database.</li><li><strong>The Identity Binding:</strong> When you attempt to log in as “User A,” the server specifically fetches the Public Key registered to “User A.”</li><li><strong>The Mathematical Mismatch:</strong> Because of the nature of Elliptic Curve Cryptography (ECC), a signature is only valid if it is verified by its <strong>exact mathematical twin</strong>.</li><li>If an attacker tries to use their own Private Key, they will generate a perfectly “valid” signature for <em>their</em> key pair.</li><li>However, when the server tries to verify that signature using <strong>your</strong> Public Key, the math will simply not resolve. The result will be an immediate “Invalid Signature” error.</li></ul><blockquote><strong>The Analogy:</strong><br>Imagine a wall of millions of padlocks, and you own the only key to Lock #101. An attacker might have a key to Lock #500. Their key is a “real” key, and it works perfectly for their lock, but it is physically and mathematically impossible for their key to move the pins inside Lock #101.</blockquote><p><strong>The Security Benefit:</strong><br>This means an attacker cannot “spoof” a signature. To get in, they don’t just need <em>any</em> private key — they need <strong>the specific private key</strong> that was generated on your device during registration. Since that key is trapped inside your phone’s secure hardware chip, the only way into your account is to physically have your device and your biometric (fingerprint/face).</p><h3>7. Implementation Checklist: Preparing for Passwordless</h3><ol><li>✅ <strong>Don’t Build from Scratch:</strong> Implementing WebAuthn raw is extremely difficult. Use established libraries like <strong>SimpleWebAuthn</strong> or services like <strong>Passkeys.com</strong>.</li><li>✅ <strong>Offer it as an Option:</strong> Start by allowing users to “Add a Passkey” in their profile settings as an alternative to MFA.</li><li>✅ <strong>Handle Multiple Devices:</strong> Allow users to register more than one Passkey (e.g., their phone and their laptop).</li><li>✅ <strong>Educate the User:</strong> Users are used to passwords. Explain that using their fingerprint is safer, not just faster.</li><li>✅ <strong>Plan for Recovery:</strong> Always have a backup method (like a recovery email or “Magic Link”) for users who lose access to their synced Passkeys.</li></ol><h3>Conclusion</h3><p>We are witnessing the beginning of the end for the password. Passkeys offer the rare combination of <strong>better security</strong> and <strong>better user experience</strong>. By removing the “human element” from the secret-keeping process, we are closing the largest security hole in history.</p><blockquote><strong>What’s next?</strong><br>We’ve mastered the present and the immediate future. But what about the <em>distant</em> future? In our final installment, <strong>Part 7</strong>, we look at the <strong>Endgame</strong> — exploring <strong>Zero-Knowledge Proofs (ZKP)</strong>, <strong>Self-Sovereign Identity (SSI)</strong>, and how we are preparing for the era of <strong>Quantum Computing</strong>.</blockquote><p><strong>Missed the series?</strong><br><a href="https://medium.com/@malaya-khuntia/beyond-the-password-part-1-the-definitive-guide-to-hashes-salts-and-peppers-c462ad2c8615">[Part 1: The Definitive Guide to Hashes, Salts, and Peppers]</a><br><a href="https://medium.com/@malaya-khuntia/beyond-the-password-part-2-the-token-trap-cookies-jwts-and-the-war-for-session-security-ed406b8884e1">[Part 2: The Token Trap — Cookies vs. JWTs]</a><br><a href="https://medium.com/@malaya-khuntia/beyond-the-password-part-3-the-second-wall-mfa-totp-and-adaptive-defense-7f906d4bfc44">[Part 3: The Second Wall — MFA and TOTP]</a><br><a href="https://medium.com/@malaya-khuntia/beyond-the-password-part-4-the-login-with-google-magic-understanding-oauth-2-0-and-oidc-e73f0890472d?sharedUserId=malaya-khuntia">[Part 4: The “Login with Google” Magic — OAuth 2.0 and OIDC]</a><br><a href="https://medium.com/@malaya-khuntia/beyond-the-password-part-5-who-goes-there-mastering-rbac-abac-and-authorization-de003d863c75?sharedUserId=malaya-khuntia">[Part 5: Who Goes There? — Mastering RBAC, ABAC, and Authorization]</a></p><p><em>Keywords: Passkeys, WebAuthn, Passwordless, FIDO2, Cryptography, Cybersecurity, Biometrics, Future of Tech, Software Engineering.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9885317d9b80" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Beyond the Password [Part 5]: Who Goes There? — Mastering RBAC, ABAC, and Authorization]]></title>
            <link>https://malaya-khuntia.medium.com/beyond-the-password-part-5-who-goes-there-mastering-rbac-abac-and-authorization-de003d863c75?source=rss-37a694a25704------2</link>
            <guid isPermaLink="false">https://medium.com/p/de003d863c75</guid>
            <category><![CDATA[ami]]></category>
            <category><![CDATA[authorization]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Malaya Khuntia]]></dc:creator>
            <pubDate>Sun, 16 Aug 2026 01:31:02 GMT</pubDate>
            <atom:updated>2026-08-16T01:31:02.006Z</atom:updated>
            <content:encoded><![CDATA[<p>In the previous parts of this series, we focused entirely on <strong>Authentication (AuthN), </strong>the process of proving <em>who</em> a user is. Whether through hashes, JWTs, MFA, or Google logins, we’ve successfully opened the front door of our application.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_yZMgo6eUB85Zo19GG96rQ.png" /></figure><p>But once the user is inside, a new question arises: <strong>What are they allowed to do?</strong></p><p>In security terms, this is <strong>Authorization (AuthZ)</strong>. Just because I am a logged-in user doesn’t mean I should be able to delete the database or view another user’s private messages. If Authentication is the “Front Door,” Authorization is the “Internal Locks” on every room in the building.</p><h3>1. The Core Definition: AuthN vs. AuthZ</h3><p>It is common for developers to mix these up, but the distinction is vital for security:</p><ul><li><strong>Authentication (AuthN):</strong> “Who are you?” (Passport/ID).</li><li><strong>Authorization (AuthZ):</strong> “What can you do?” (Job description/Permissions).</li></ul><blockquote><strong>The Analogy:</strong><br>Think of a <strong>Hospital</strong>.<br><strong>Authentication</strong> is the badge you swipe to get into the building.<br><strong>Authorization</strong> is what determines that a Surgeon can enter the Operating Room, but a Pharmacist can only enter the Medicine Storage, and a Patient can enter neither.</blockquote><h3>2. The Standard: RBAC (Role-Based Access Control)</h3><p>Most applications start with <strong>RBAC</strong>. It is the most common and intuitive way to manage permissions. You group permissions into “Roles” and assign those roles to users.</p><ul><li><strong>Admin:</strong> Can create, read, update, and delete everything.</li><li><strong>Editor:</strong> Can create and edit content but cannot delete users.</li><li><strong>Viewer:</strong> Can only read content.</li></ul><p><strong>The Workflow:</strong><br>When a user tries to access a resource, the system checks: <em>“Does this user have the ‘Admin’ role?”</em> If yes, access is granted.</p><p><strong>The Pros:</strong> It is incredibly easy to set up and understand.<br><strong>The Cons:</strong> It becomes “Role Explosion” as your app grows. What if you need a “Junior Editor” who can only edit on weekends? You’d have to create a new role for every tiny variation.</p><h3>3. The Modern Evolution: ABAC (Attribute-Based Access Control)</h3><p>As systems become more complex, we need <strong>ABAC</strong>. Instead of looking at “Roles,” it looks at “Attributes.”</p><p>ABAC evaluates four things:</p><ol><li><strong>The Subject:</strong> Who is the user? (e.g., Seniority Level).</li><li><strong>The Resource:</strong> What are they trying to access? (e.g., A “Secret” document).</li><li><strong>The Action:</strong> What are they trying to do? (e.g., “Edit”).</li><li><strong>The Environment:</strong> Where and when? (e.g., “From a Company IP” and “During Office Hours”).</li></ol><blockquote><strong>The Logic:</strong><br><em>“Allow access if the Subject’s department is ‘Finance’ AND the Resource’s sensitivity is ‘High’ AND the Environment is ‘Office-VPN’.”</em></blockquote><h3>4. The Comparison: Which One Should You Choose?</h3><p><strong>Feature — — -— — RBAC- — — — — — — — — — — — ABAC</strong></p><p><strong>Complexity- — — </strong>Simple / Low — — — — — — — — Complex / High</p><p><strong>Flexibility- — — — </strong>Rigid- — — — — — — — — — — — -Extremely Flexible</p><p><strong>Use Case- — — —</strong>Small to Medium Apps — — — Enterprise / High-Security</p><p><strong>Logic- — — — — — </strong>”Is he an Admin?” — — — — — ”Does he meet the criteria?”</p><p><strong>The Hybrid Approach:</strong> Most modern systems use <strong>RBAC for the basics</strong> (standard user vs admin) and <strong>ABAC for the exceptions</strong> (special access rules).</p><h3>5. Security Pitfalls: Broken Access Control</h3><p>According to the <strong>OWASP Top 10</strong>, “Broken Access Control” is currently the <strong>#1 security risk</strong> for web applications. Here are the two most common ways it fails:</p><ol><li><strong>Horizontal Privilege Escalation:</strong> A user changes a URL from myapp.com/api/user/123 to myapp.com/api/user/456 and can suddenly see User B’s private data.</li><li><strong>Vertical Privilege Escalation:</strong> A regular user discovers they can access /admin/delete-user simply by typing the URL, because the server only checked if they were logged in, not if they were an Admin.</li></ol><h3>6. Implementation Checklist: The “Principle of Least Privilege”</h3><ol><li>✅ <strong>Principle of Least Privilege (PoLP):</strong> Give users the <em>minimum</em> amount of access they need to do their job. Nothing more.</li><li>✅ <strong>Deny by Default:</strong> If a rule doesn’t explicitly say “Allow,” the system should automatically “Deny.”</li><li>✅ <strong>Centralize Authorization:</strong> Don’t write if(user.role == ‘admin’) on every single page. Use a centralized middleware or a library (like Casl or CanCan) to manage permissions in one place.</li><li>✅ <strong>Never Trust the Frontend:</strong> Just because you hid the “Delete” button in the UI doesn’t mean the API is safe. Always verify permissions on the <strong>Backend</strong>.</li><li>✅ <strong>Audit Logs:</strong> Always record <em>who</em> accessed <em>what</em> and <em>when</em>. This is crucial for forensic analysis after a breach.</li></ol><h3>Conclusion</h3><p>Authentication gets people through the door, but <strong>Authorization</strong> keeps them in their lanes. By choosing the right model, whether it’s the simplicity of RBAC or the granular power of ABAC, you ensure that your application remains a secure environment where data stays in the right hands.</p><blockquote><strong>What’s next?</strong><br>We’ve built a very secure system using traditional methods. But what if we could get rid of passwords entirely? In <strong>Part 6</strong>, we look at the <strong>Immediate Future</strong> — exploring <strong>Passkeys, WebAuthn</strong>, and why the world is moving toward a passwordless reality.</blockquote><p><strong>Missed the series?</strong><br><a href="https://medium.com/@malaya-khuntia/beyond-the-password-part-1-the-definitive-guide-to-hashes-salts-and-peppers-c462ad2c8615">[Part 1: The Definitive Guide to Hashes, Salts, and Peppers]</a><br><a href="https://medium.com/@malaya-khuntia/beyond-the-password-part-2-the-token-trap-cookies-jwts-and-the-war-for-session-security-ed406b8884e1">[Part 2: The Token Trap — Cookies vs. JWTs]</a><br><a href="https://medium.com/@malaya-khuntia/beyond-the-password-part-3-the-second-wall-mfa-totp-and-adaptive-defense-7f906d4bfc44">[Part 3: The Second Wall — MFA and TOTP]</a><br><a href="https://medium.com/@malaya-khuntia/beyond-the-password-part-4-the-login-with-google-magic-understanding-oauth-2-0-and-oidc-e73f0890472d?sharedUserId=malaya-khuntia">[Part 4: The “Login with Google” Magic — OAuth 2.0 and OIDC]</a></p><p><em>Keywords: RBAC, ABAC, Authorization, Access Control, OWASP Top 10, Web Security, Software Architecture, Least Privilege, IAM.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=de003d863c75" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Beyond the Password [Part 4]: The “Login with Google” Magic — Understanding OAuth 2.0 and OIDC]]></title>
            <link>https://malaya-khuntia.medium.com/beyond-the-password-part-4-the-login-with-google-magic-understanding-oauth-2-0-and-oidc-e73f0890472d?source=rss-37a694a25704------2</link>
            <guid isPermaLink="false">https://medium.com/p/e73f0890472d</guid>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[api]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[authentication]]></category>
            <dc:creator><![CDATA[Malaya Khuntia]]></dc:creator>
            <pubDate>Fri, 14 Aug 2026 01:31:01 GMT</pubDate>
            <atom:updated>2026-08-14T01:31:01.399Z</atom:updated>
            <content:encoded><![CDATA[<p>In <strong>Part 3</strong>, we built a “Second Wall” using MFA. But as your application grows, you’ll notice a frustrating trend: users hate creating new accounts. They suffer from “login fatigue.”</p><p>This is why you see the “Login with Google,” “Sign in with Apple,” or “Continue with GitHub” buttons everywhere. This is <strong>Federated Identity</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5F9_CQqibjFMZTAftr8bBQ.png" /></figure><p>Instead of building your own login system and taking on the massive risk of storing credentials, you trust a “Giant” (an Identity Provider) to do it for you. But how does this data exchange happen without you ever seeing the user’s actual Google password?</p><p>Welcome to the world of <strong>OAuth 2.0</strong> and <strong>OpenID Connect (OIDC)</strong>.</p><h3>1. The Core Definition: OAuth vs. OIDC</h3><p>These two terms are often lumped together, but they serve two very different purposes:</p><ul><li><strong>OAuth 2.0 (Authorization):</strong> This is about <strong>permissions</strong>. It allows an app to “do something” on behalf of a user (e.g., “Let this app post a photo to my Facebook”). It does <em>not</em> prove who the user is.</li><li><strong>OpenID Connect (Authentication):</strong> This is a thin layer on top of OAuth 2.0 that handles <strong>identity</strong>. It tells the app “Who” the user is (e.g., “This is Malaya, and here is his email address”).</li></ul><blockquote><strong>The Analogy:</strong><br><strong>OAuth 2.0</strong> is like a <strong>Hotel Key Card</strong>. The card doesn’t have your name on it; it just tells the elevator and the room door that you have <em>permission</em> to enter.<br><strong>OIDC</strong> is like your <strong>Passport</strong>. It proves exactly who you are, verified by a government authority.</blockquote><h3>2. The Technical Deep-Dive: The “OAuth Dance”</h3><p>To understand how this works, we need to meet the four players in the “OAuth Dance”:</p><ol><li><strong>The Resource Owner:</strong> The User (You).</li><li><strong>The Client:</strong> Your Application (The one wanting access).</li><li><strong>The Authorization Server:</strong> The Giant (Google, GitHub, etc.).</li><li><strong>The Resource Server:</strong> The API that holds the data (e.g., Google Contacts).</li></ol><p><strong>The Flow (Authorization Code Grant):</strong></p><ol><li><strong>The Request:</strong> The User clicks “Login with Google.” Your app redirects them to Google.</li><li><strong>The Consent:</strong> Google asks the user, “Do you allow this App to see your email?”</li><li><strong>The Code:</strong> If the user says yes, Google sends a temporary <strong>Authorization Code</strong> back to your app.</li><li><strong>The Exchange:</strong> Your app sends that code + a <strong>Client Secret</strong> back to Google.</li><li><strong>The Reward:</strong> Google verifies the secret and sends back an <strong>Access Token</strong> (and an <strong>ID Token</strong> if using OIDC).</li></ol><h3>3. Understanding the Tokens</h3><p>In Federated Identity, you deal with three specific tokens:</p><ul><li><strong>Access Token (OAuth):</strong> A key that allows your app to call Google’s APIs on behalf of the user.</li><li><strong>ID Token (OIDC):</strong> A JWT that contains the user’s profile information (Name, Email, Picture). This is what you use to create a user record in your own database.</li><li><strong>Refresh Token:</strong> A long-lived key used to get a new Access Token once the old one expires.</li></ul><h3>4. The Comparison: Social Login vs. Internal Auth</h3><p>Should you always use Federated Identity?</p><ul><li><strong>Social Login Pros:</strong> Massive UX boost (one-click login), zero responsibility for password storage, and built-in MFA (handled by Google/Apple).</li><li><strong>Social Login Cons:</strong> You are dependent on a third party. If Google goes down or bans your developer account, your users can’t log in.</li><li><strong>Internal Auth Pros:</strong> Full control over user data and the login experience.</li><li><strong>Internal Auth Cons:</strong> You are responsible for hashes, salts, peppers, and defending against every attack we’ve discussed in Parts 1–3.</li></ul><h3>5. Security Pitfalls: Where OAuth Breaks</h3><ul><li><strong>The “Implicit Grant” Trap:</strong> Old tutorials tell you to send the token directly to the browser. <strong>Don’t do this.</strong> It is insecure. Use the “Authorization Code Flow” with <strong>PKCE</strong> (Proof Key for Code Exchange).</li><li><strong>Permissive Scopes:</strong> Don’t ask for “Full Read/Write access to Gmail” if you only need the user’s email address. Follow the <strong>Principle of Least Privilege</strong>.</li><li><strong>Not Validating the ID Token:</strong> When you get an ID Token (JWT), you <strong>must</strong> verify the signature and the aud (audience) claim to ensure the token was actually meant for <em>your</em> app.</li></ul><h3>6. Implementation Checklist: Secure Federated Identity</h3><ol><li>✅ <strong>Use PKCE:</strong> Even for web apps, PKCE is now the recommended standard for OAuth 2.0.</li><li>✅ <strong>Whitelist Redirect URIs:</strong> Only allow redirects to your official, secured domains to prevent “Token Theft” attacks.</li><li>✅ <strong>Keep Secrets Secret:</strong> Never put your Client Secret in your frontend code or GitHub. It stays on the backend.</li><li>✅ <strong>Use State Parameters:</strong> Use a random state string in the request to prevent CSRF attacks during the OAuth dance.</li><li>✅ <strong>Validate Signatures:</strong> Use libraries (like Passport.js or NextAuth) that automatically verify the cryptographic signatures of tokens.</li></ol><h3>Conclusion</h3><p>Federated Identity is a win-win: users get a faster experience, and developers get to offload the highest-risk parts of security to experts. By understanding the “Dance” between OAuth 2.0 and OIDC, you can build a login flow that is both seamless and incredibly secure.</p><blockquote><strong>What’s next?</strong><br>We know who the user is (Authentication). We have a session (Part 2). But what are they actually <em>allowed</em> to do inside the app? In <strong>Part 5</strong>, we move into <strong>Permissions</strong> — exploring RBAC, ABAC, and the fine art of Authorization.</blockquote><p><strong>Missed the series?</strong><br><a href="https://medium.com/@malaya-khuntia/beyond-the-password-part-1-the-definitive-guide-to-hashes-salts-and-peppers-c462ad2c8615">[Part 1: The Definitive Guide to Hashes, Salts, and Peppers]</a><br><a href="https://medium.com/@malaya-khuntia/beyond-the-password-part-2-the-token-trap-cookies-jwts-and-the-war-for-session-security-ed406b8884e1">[Part 2: The Token Trap — Cookies vs. JWTs]</a><br><a href="https://medium.com/@malaya-khuntia/beyond-the-password-part-3-the-second-wall-mfa-totp-and-adaptive-defense-7f906d4bfc44">[Part 3: The Second Wall — MFA and TOTP]</a></p><p><em>Keywords: OAuth 2.0, OpenID Connect, OIDC, Social Login, Federated Identity, JWT, Web Security, App Development, Software Engineering.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e73f0890472d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Beyond the Password [Part 3]: The Second Wall — MFA, TOTP, and Adaptive Defense]]></title>
            <link>https://malaya-khuntia.medium.com/beyond-the-password-part-3-the-second-wall-mfa-totp-and-adaptive-defense-7f906d4bfc44?source=rss-37a694a25704------2</link>
            <guid isPermaLink="false">https://medium.com/p/7f906d4bfc44</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[app-security]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[infosec]]></category>
            <category><![CDATA[mfa]]></category>
            <dc:creator><![CDATA[Malaya Khuntia]]></dc:creator>
            <pubDate>Wed, 12 Aug 2026 01:31:01 GMT</pubDate>
            <atom:updated>2026-08-12T01:31:01.508Z</atom:updated>
            <content:encoded><![CDATA[<p>In <strong>Part 1</strong>, we secured the database. In <strong>Part 2</strong>, we secured the session. But there is a hard truth in cybersecurity: <strong>No matter how strong your locks are, a user can still give away the key.</strong></p><p>A user might reuse their password on a compromised site, fall for a phishing scam, or have their device stolen. If the password is the “First Wall,” it is a wall that can be climbed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Kh9OiCLDoqRrGvZuS06cDw.png" /></figure><p>To truly protect an application, we need a <strong>Second Wall</strong>: Multi-Factor Authentication (MFA) and active defense layers.</p><h3>1. The Core Definition: What is MFA?</h3><p>Security professionals categorize “factors” into three buckets:</p><ol><li><strong>Something you know:</strong> A password or PIN.</li><li><strong>Something you have:</strong> A smartphone, a security key (YubiKey), or an email account.</li><li><strong>Something you are:</strong> Biometrics like fingerprints or FaceID.</li></ol><p><strong>Multi-Factor Authentication</strong> is simply the requirement of at least two of these different buckets to grant access.</p><p><strong>The Analogy:</strong><br>Think of a high-security bank vault. To get in, you need a <strong>physical key</strong> (Something you have) AND the <strong>secret combination</strong> to the dial (Something you know). If a thief steals only the key, they still can’t open the vault.</p><h3>2. The Technical Deep-Dive: How TOTP Works</h3><p>The most common form of MFA today is the 6-digit code generated by apps like Google, Microsoft Authenticator. This is called <strong>TOTP (Time-based One-Time Password)</strong>.</p><p><strong>The Mechanics (RFC 6238):</strong><br>When a user sets up MFA, your server generates a “Shared Secret” (that long string or QR code). Both the server and the user’s phone now have this secret.</p><ol><li>The phone takes the <strong>Current Unix Time and a Secrete Key </strong>and do some math to generate a code in for next 30 seconds.</li><li>It hashes that time with the <strong>Shared Secret</strong>.</li><li>It truncates the result into a <strong>6-digit code</strong>.</li></ol><p>Because the “Time” is the same on both the phone and the server, they both calculate the same code. Every 30 seconds, the “Time” variable changes, and a new code is born.</p><h3>3. The Comparison: SMS vs. Authenticator Apps vs. Hardware Keys</h3><p>Not all “Second Walls” are equally strong.</p><ul><li><strong>SMS OTP (The Weakest):</strong> Sending a code via text is better than nothing, but it is vulnerable to <strong>SIM Swapping</strong>, where a hacker tricks a carrier into moving your phone number to their device.</li><li><strong>Authenticator Apps (The Standard):</strong> Apps like Authy or Microsoft Authenticator are much safer because the “Shared Secret” never leaves the device. It cannot be intercepted over the air.</li><li><strong>Hardware Keys / FIDO2 (The Gold Standard):</strong> Devices like YubiKeys use “Public Key Cryptography.” They are virtually impossible to phish because the key only works on the specific website it was registered for.</li></ul><h3>4. Advanced Defense: Adaptive Authentication</h3><p>Smart security doesn’t just ask for a code; it looks at the <strong>Context</strong>. This is known as <strong>Adaptive or Risk-Based Auth</strong>.</p><p>Your server should analyze “Signals” during a login attempt:</p><ul><li><strong>IP Reputation:</strong> Is the login coming from a known malicious IP or a data center?</li><li><strong>Geographic Velocity:</strong> Did the user log in from New York 10 minutes ago and now they are logging in from London? (Impossible Travel).</li><li><strong>Device Fingerprinting:</strong> Is this a browser and operating system the user has used before?</li></ul><p>If the signals look “weird,” the server can trigger a <strong>Step-up Authentication</strong> (demanding MFA), even if the user didn’t previously have it turned on for that session.</p><h3>5. Defensive Coding: Throttling and Rate Limiting</h3><p>Even with MFA, you must stop an attacker from trying millions of passwords a second. This is where <strong>Rate Limiting</strong> comes in.</p><p>You should implement middleware (using Redis or Nginx) to:</p><ul><li><strong>Limit by IP:</strong> Block an IP if it fails 10 logins in a minute.</li><li><strong>Limit by Account:</strong> Lock an account for 15 minutes after 5 failed attempts to prevent <strong>Brute Force</strong>.</li><li><strong>Exponential Backoff:</strong> Make the wait time longer after every failed attempt (1s, 2s, 4s, 8s…).</li></ul><h3>6. Implementation Checklist: Strengthening the Wall</h3><ol><li>✅ <strong>Stop using SMS:</strong> If possible, encourage users to use Authenticator apps or Passkeys.</li><li>✅ <strong>Enforce Rate Limiting:</strong> Never let an endpoint be hit without a “throttle” in place.</li><li>✅ <strong>Store MFA Secrets Safely:</strong> Just like passwords, MFA shared secrets should be encrypted at rest.</li><li>✅ <strong>Provide Backup Codes:</strong> Always give users one-time “Recovery Codes” in case they lose their phone.</li><li>✅ <strong>Log Everything:</strong> Record failed MFA attempts. It’s the first sign of a targeted attack.</li></ol><h3>Conclusion</h3><p>MFA isn’t just an “extra feature” — it is the baseline for modern security. By combining <strong>Something you know</strong> (Password) with <strong>Something you have</strong> (TOTP), you eliminate 99% of bulk hacking attempts.</p><p><strong>What’s next?</strong><br>We’ve talked about how users log into <em>your</em> app. But what happens when you want to let them log in using <em>another</em> app? In <strong>Part 4</strong>, we dive into <strong>Federated Identity</strong> — the magic behind “Login with Google” and the complex world of OAuth 2.0 and OIDC.</p><p><strong>Missed the previous parts?</strong><br><a href="https://medium.com/@malaya-khuntia/beyond-the-password-part-1-the-definitive-guide-to-hashes-salts-and-peppers-c462ad2c8615?sharedUserId=malaya-khuntia">[Part 1: The Definitive Guide to Hashes, Salts, and Peppers]</a><br><a href="https://medium.com/@malaya-khuntia/beyond-the-password-part-1-the-definitive-guide-to-hashes-salts-and-peppers-c462ad2c8615?sharedUserId=malaya-khuntia">[Part 2: The Token Trap — Cookies vs. JWTs]</a></p><p><em>Keywords: MFA, TOTP, Multi-Factor Authentication, Rate Limiting, Brute Force, Cybersecurity, Adaptive Auth, Information Security, Web Development.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7f906d4bfc44" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Beyond the Password [Part 2]: The Token Trap — Cookies, JWTs, and the War for Session Security]]></title>
            <link>https://malaya-khuntia.medium.com/beyond-the-password-part-2-the-token-trap-cookies-jwts-and-the-war-for-session-security-ed406b8884e1?source=rss-37a694a25704------2</link>
            <guid isPermaLink="false">https://medium.com/p/ed406b8884e1</guid>
            <category><![CDATA[authentication]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Malaya Khuntia]]></dc:creator>
            <pubDate>Mon, 10 Aug 2026 01:31:01 GMT</pubDate>
            <atom:updated>2026-08-10T01:31:01.256Z</atom:updated>
            <content:encoded><![CDATA[<p>In <strong>Part 1</strong>, we built a fortress around our user’s password using Argon2, Salts, and Peppers. The user has entered their credentials, the hash matches, and the gates have opened.</p><p><strong>But now what?</strong></p><p>Every time that user clicks “View Profile” or “Checkout,” your server needs to know it’s still them. Does the server ask for the password again every 5 seconds? Of course not. That would be a user experience nightmare. Instead, we use <strong>Sessions</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lq7OR606Apa4AlZtJO7AUQ.png" /></figure><p>But here is where most developers stumble: <strong>How do you “remember” a user without making your application vulnerable to hijacking?</strong></p><h3>1. The Core Definition: Stateful vs. Stateless</h3><p>Before we choose a tool, we have to choose an architecture. There are two main ways a server “remembers” you:</p><ul><li><strong>Stateful Authentication (The “Guest List”):</strong> The server creates a “Session ID” and saves it in its memory (or a database). It gives the user a cookie containing that ID. Every time the user makes a request, the server checks its “Guest List” to see if that ID is valid.</li><li><strong>Stateless Authentication (The “Wristband”):</strong> The server gives the user a <strong>JWT (JSON Web Token)</strong>. This token contains all the user’s info encrypted/signed within itself. The server doesn’t need to check a database; it just looks at the “Wristband” to see if the signature is authentic.</li></ul><blockquote><strong>The Analogy:</strong><br>Stateful is like a <strong>VIP Club with a guest list</strong>. You give your name at the door, and they check the book.<br>Stateless is like a <strong>Music Festival Wristband</strong>. The security guard doesn’t have a list of 50,000 names; they just check if the wristband has the official holographic seal.</blockquote><h3>2. The Technical Deep-Dive: Anatomy of a JWT</h3><p>Since modern web development favors scalability, <strong>JWTs</strong> have become the industry standard. A JWT looks like a string of gibberish, but it is actually three parts separated by dots: header.payload.signature</p><ol><li><strong>The Header:</strong> Tells the server which algorithm was used to sign the token (e.g., HS256).</li><li><strong>The Payload:</strong> This is the data. It contains “claims” like user_id, name, and expiration_time. <strong>Crucial Note:</strong> This data is only Base64 encoded. Anyone can decode it. <strong>Never put passwords or sensitive secrets here.</strong></li><li><strong>The Signature:</strong> This is the most important part. It takes the header, the payload, and a <strong>Secret Key</strong> known only to your server to create a hash. If a hacker changes the user_id in the payload, the signature will no longer match, and the server will reject it.</li></ol><h3>3. Token Types</h3><p>Not all tokens serve the same purpose. In a professional security architecture, you don’t just use one “token” to rule them all. You use a system of specialized keys:</p><h4>a. Access Tokens (The Key)</h4><p>This is usually the JWT we discussed. It is short-lived (typically 5–15 minutes). Its only job is to prove to the API that the bearer has permission to access a specific resource.</p><ul><li><strong>Security Rule:</strong> Because these are sent with every request, they are high-risk. That is why they must expire quickly.</li></ul><h4>b. Refresh Tokens (The Key Generator)</h4><p>If the Access Token expires every 15 minutes, you don’t want to force the user to log in again. Instead, you use a <strong>Refresh Token</strong>.</p><ul><li><strong>The Workflow:</strong> When the Access Token expires, the app sends the Refresh Token to a specific “Refresh Endpoint.” If the Refresh Token is still valid, the server issues a <em>new</em> Access Token.</li><li><strong>Security Rule:</strong> Refresh Tokens are long-lived (days or weeks) and should be stored with maximum security (like an HttpOnly cookie or a secure database). They should also be “one-time use” (Refresh Token Rotation) to prevent replay attacks.</li></ul><h4>c. Opaque Tokens (The Claim Check)</h4><p>Unlike a JWT, which contains data you can read, an <strong>Opaque Token</strong> is just a random string of characters (e.g., abc123xyz). It carries no information.</p><ul><li><strong>How it works:</strong> The server stores the data associated with that string in a database. When the server gets the token, it “looks up” the info.</li><li><strong>The Benefit:</strong> If you need to revoke access instantly (e.g., a user is fired or a phone is stolen), Opaque tokens are better because you can just delete the entry from your database. JWTs, by design, are valid until they expire.</li></ul><blockquote><strong>The Analogy:</strong><br>i. An <strong>Access Token</strong> is like a movie ticket — it gets you into the theater for a specific time.<br>ii. A <strong>Refresh Token</strong> is like the receipt you kept in your pocket — if you lose your ticket, you show the receipt to the manager to get a new one.<br>iii. An <strong>Opaque Token</strong> is like a coat-check tag — it means nothing to anyone else, but when you give it to the attendant, they know exactly which coat belongs to you.</blockquote><h3>4. The Conflict: Local Storage vs. Cookies</h3><p>You have the token. Where do you put it on the user’s browser? This is the “Great Debate” of web security.</p><h4>Option A: Local Storage</h4><ul><li><strong>The Pro:</strong> Very easy to use with JavaScript frameworks (React/Vue).</li><li><strong>The Con:</strong> Vulnerable to <strong>XSS (Cross-Site Scripting)</strong>. If a hacker successfully injects a malicious script into your site, they can read your Local Storage and steal the token instantly.</li></ul><h4>Option B: HttpOnly Cookies</h4><ul><li><strong>The Pro:</strong> When a cookie is marked as HttpOnly, JavaScript <strong>cannot</strong> read it. Even if your site has an XSS vulnerability, the hacker cannot “grab” the session token.</li><li><strong>The Con:</strong> Vulnerable to <strong>CSRF (Cross-Site Request Forgery)</strong> — an attack that tricks a user into performing actions on a different website where they are logged in.</li></ul><blockquote><strong>Feature</strong> — — — — — — —<strong> Local Storage</strong> — — — — — <strong>HttpOnly Cookie</strong></blockquote><blockquote><strong><em>Accessibility</em>- —- — — — </strong>Easy (JS can read)- —- — Hard (JS is blocked)</blockquote><blockquote><strong><em>XSS Protection</em>- —- — — </strong>❌ Poor- — — — — — — — ✅ Excellent</blockquote><blockquote><strong><em>CSRF Protection</em> — — — </strong>✅ Excellent- — — — — — ❌ Requires extra care</blockquote><p><strong>The Verdict:</strong> For high-security applications, <strong>HttpOnly, Secure Cookies</strong> are almost always the better choice, provided you implement CSRF protection (like SameSite attributes).</p><h3>5. Security Pitfalls: The “Don’ts” of Session Management</h3><ul><li><strong>Don’t use weak Secrets:</strong> If your JWT secret is 123456, an attacker can brute-force it and start forging their own “Admin” tokens.</li><li><strong>Don’t make tokens “Forever”:</strong> A token should have a short lifespan (e.g., 15 minutes). Use <strong>Refresh Tokens</strong> to get a new one. If a token is stolen, you want it to expire quickly.</li><li><strong>Don’t forget the “Logout”:</strong> Since JWTs are stateless, the server “forgets” it issued them. You need a “Blacklist” or a short expiry strategy to ensure that when a user clicks logout, their token actually stops working.</li></ul><h3>6. Implementation Checklist: Secure Your Sessions Today</h3><ol><li>✅ <strong>Use HttpOnly and Secure flags</strong> for all cookies to hide them from JS and ensure they only travel over HTTPS.</li><li>✅ <strong>Set SameSite=Strict or Lax</strong> on cookies to kill most CSRF attacks instantly.</li><li>✅ <strong>Keep your JWT Payload light.</strong> Only store the user_id and essential roles.</li><li>✅ <strong>Use a strong environment variable</strong> for your JWT Secret. Never hardcode it in your logic.</li><li>✅ <strong>Implement Token Expiry.</strong> A session that never ends is a ticking time bomb.</li></ol><h3>Conclusion</h3><p>Authentication identifies the user, but <strong>Session Management</strong> protects that identity for the duration of their visit. Choosing between the “Guest List” (Sessions) and the “Wristband” (JWTs) depends on your scale, but protecting those tokens from XSS and CSRF is non-negotiable.</p><p><strong>What’s next?</strong><br>Even with a secure session, what happens if the user’s computer is stolen or their password is guessed? In <strong>Part 3</strong>, we’ll look at <strong>The Second Wall</strong> — how to implement Multi-Factor Authentication (MFA) and why “Adaptive Security” is the future of defense.</p><p><strong>Missed Part 1?</strong> [Read: <a href="https://malaya-khuntia.medium.com/beyond-the-password-part-1-the-definitive-guide-to-hashes-salts-and-peppers-c462ad2c8615?sharedUserId=malaya-khuntia">Beyond the Password (Part-1): The Definitive Guide to Hashes, Salts, and Peppers</a>]</p><p><em>Keywords: JWT, Cookies, Session Management, XSS, CSRF, Local Storage, Web Security, Authentication, Stateless Auth.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ed406b8884e1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Beyond the Password (Part-1): The Definitive Guide to Hashes, Salts, and Peppers]]></title>
            <link>https://malaya-khuntia.medium.com/beyond-the-password-part-1-the-definitive-guide-to-hashes-salts-and-peppers-c462ad2c8615?source=rss-37a694a25704------2</link>
            <guid isPermaLink="false">https://medium.com/p/c462ad2c8615</guid>
            <category><![CDATA[infosec]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[password-security]]></category>
            <category><![CDATA[cryptography]]></category>
            <dc:creator><![CDATA[Malaya Khuntia]]></dc:creator>
            <pubDate>Sat, 08 Aug 2026 05:44:22 GMT</pubDate>
            <atom:updated>2026-08-08T05:44:22.720Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7NzvmGtYm2aKnzSuP8sEgw.png" /></figure><p>In the world of cybersecurity, we often treat passwords like keys to a vault. But as any security engineer will tell you, a key is only as good as the lock it fits into. When a database is breached, the “lock” is no longer the login screen it’s the way you’ve stored that password behind the scenes.</p><p>If you are building an application today, understanding the nuances of <strong>cryptography</strong>, <strong>hashing algorithms</strong>, and <strong>secure password storage</strong> isn’t just a “nice-to-have” it’s a fundamental requirement.</p><h3>1. The Confusion: Encoding vs. Encryption vs. Hashing</h3><p>Before we dive into the “how,” we must clarify the “what.” These three terms are often used interchangeably by beginners, but they serve entirely different masters.</p><ul><li><strong>Encoding (The Translator):</strong> Encoding transforms data into a new format so it can be consumed by different systems (like Base64 or URL encoding). It is <strong>not</strong> a security measure. If you “secure” a password with Base64, you’ve essentially just written it in a different font. It is 100% reversible without a key.</li><li><strong>Encryption (The Courier):</strong> Encryption is designed for confidentiality. It turns plaintext into cipher-text using a <strong>key</strong>. It is <strong>reversible </strong>if you have the key, you can get the original data back. This is great for sending private messages, but dangerous for passwords (if a hacker steals the key, they steal every password).</li><li><strong>Hashing (The Fingerprint):</strong> This is the gold standard for <strong>authentication</strong>. Hashing is a <strong>one-way</strong> mathematical function. It takes an input (password) and turns it into a fixed-length string (the hash). You can never “un-hash” it. To check a login, you hash the entered password and see if it matches the stored fingerprint.</li></ul><h3>2. Spicing Things Up: Salt and Pepper</h3><p>Even a strong hash can be vulnerable if it’s “naked.” This is where <strong>Salt</strong> and <strong>Pepper</strong> come in.</p><h4>The Salt</h4><p>If two users use the same password (like Password123), they will have the same hash. An attacker can use a <strong>Rainbow Table</strong> a precomputed list of millions of passwords and their corresponding hashes to “lookup” the password instantly.<br><strong>Salt</strong> is a unique, random string added to the password <em>before</em> it is hashed. Because every user has a different salt, identical passwords result in completely different hashes, rendering rainbow tables useless.</p><h4>The Pepper</h4><p>If a salt is stored in the database next to the hash, what happens if the whole database is leaked? The attacker has the hash and the salt.<br><strong>Pepper</strong> is a secret value added to the password that is <strong>not</strong> stored in the database. Instead, it’s hidden in your application code or a secure vault. Even if a hacker steals your entire user table, they still can’t crack the hashes because they are missing the “secret ingredient” hidden elsewhere.</p><h3>3. The Hall of Algorithms: What to Use (and Avoid)</h3><p>Not all <strong>hashing algorithms</strong> are created equal. As hardware gets faster, old algorithms become “broken.”</p><ul><li><strong>MD5 &amp; SHA-1:</strong> <strong>Legacy/Broken.</strong> These are too fast. A modern computer can guess billions of MD5 hashes per second, making them easy prey for <strong>Brute Force attacks</strong>.</li><li><strong>SHA-256:</strong> Great for integrity (checking if a file changed), but too fast for passwords.</li><li><strong>bcrypt:</strong> The veteran. It’s “slow by design,” meaning it forces the computer to work harder, making brute-forcing incredibly expensive for attackers.</li><li><strong>scrypt:</strong> Takes things a step further by being “memory-hard.” It requires a lot of RAM, which makes it very difficult for attackers to use specialized hardware like GPUs or ASICs to crack passwords.</li><li><strong>Argon2:</strong> The modern champion. Winner of the 2015 Password Hashing Competition, it is highly configurable and offers the best protection against all known types of attacks.</li></ul><h3>4. The Threats: Brute Force and Rainbow Tables</h3><p>Understanding the enemy helps us build better walls.</p><ul><li><strong>Brute Force Attack:</strong> A systematic “trial and error” where an attacker tries every possible combination (aaaa, aaab, aaac…) until they find a match. Using a “slow” hash like <strong>Argon2</strong> or <strong>bcrypt</strong> makes this process so slow that it would take years to crack a single password.</li><li><strong>Rainbow Table Attack:</strong> As mentioned, this uses a “cheat sheet” of precomputed hashes. <strong>Salting</strong> is the direct antidote to this threat.</li></ul><h3>5. Summary: The Secure Coding Checklist</h3><p>To ensure <strong>login security</strong> and <strong>information security</strong> in your next project, follow these rules:</p><ol><li><strong>Never store plaintext:</strong> Ever.</li><li><strong>Don’t roll your own:</strong> Use established libraries for <strong>Argon2</strong> or <strong>bcrypt</strong>.</li><li><strong>Use a Salt:</strong> Unique for every single user.</li><li><strong>Add a Pepper:</strong> Stored separately from your database.</li><li><strong>Stay Slow:</strong> Configure your algorithm’s “work factor” to be as slow as your users’ patience allows (usually around 200–500ms per login).</li></ol><p>In <strong>cybersecurity</strong>, there is no such thing as “unbreakable,” only “too expensive to break.” By using modern hashing, salts, and peppers, you make the cost of attacking your users so high that hackers will look for an easier target.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c462ad2c8615" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Security is Not a Feature: Building Day Zero Foundations in the Age of AI Agents]]></title>
            <link>https://malaya-khuntia.medium.com/security-is-not-a-feature-building-day-zero-foundations-in-the-age-of-ai-agents-3f53ceef806a?source=rss-37a694a25704------2</link>
            <guid isPermaLink="false">https://medium.com/p/3f53ceef806a</guid>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[web-security]]></category>
            <category><![CDATA[devsecops]]></category>
            <dc:creator><![CDATA[Malaya Khuntia]]></dc:creator>
            <pubDate>Mon, 03 Aug 2026 13:36:11 GMT</pubDate>
            <atom:updated>2026-08-03T13:36:11.449Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XFwRJV7X56oOFEmzrcsZ_A.jpeg" /></figure><h3><em>Insights from Google I/O Connect 2026, Bengaluru</em></h3><p>In the time it took you to read this headline, a professional threat actor could have already compromised a network and handed off access to a ransomware group.</p><p>At <strong>Google I/O Connect 2026 in Bengaluru</strong>, a startling statistic from the <strong>Mandiant M-Trends 2026</strong> report served as a wake-up call for the global developer community: <strong>The median time for a threat actor to hand off access from an initial compromise to a secondary group (like a ransomware operator) has collapsed to just 22 seconds.</strong></p><p>This single data point changes everything for modern software engineering. We are no longer in an era where we can “build first and secure later.” If security is treated as a final coat of paint applied before a release, we have already lost the race.</p><h3>The Community Lounge Revelation: Security is Not a Feature</h3><p>While attending a session in the Community Lounge led by Bryant Gipson and Tim Willis, the conversation centered on a fundamental shift in the bridge between developers and security researchers.</p><p>The core message was clear: <strong>Security and privacy are not features; they are Day Zero foundations.</strong></p><p>The responsibility has shifted left. It is now the developer’s mandate to take action before a line of code ever reaches a penetration tester. Security must be effective from the moment of inception to ensure the technology is inherently secure by design, rather than secured by a patch.</p><h3>Roadblocking the Hijackers: Device Bound Session Credentials (DBSC)</h3><p>One of the most significant “roadblocks” introduced at the event is the open-sourcing of the <strong>Device Bound Session Credentials (DBSC)</strong> protocol specification.</p><p>For years, session cookie hijacking has been a thorn in the side of web security. If an attacker steals a cookie, they steal the session. DBSC changes the game by using cryptographic protection to bind a session to the physical hardware (TPM or Secure Enclave).</p><h4>Mapping to OWASP Top 10</h4><p>By implementing DBSC, developers can proactively address two critical categories in the <strong>OWASP Top 10</strong>:</p><ul><li><strong>A07:2025 — Identification and Authentication Failures:</strong> By ensuring that a stolen session is useless on any device other than the original.</li><li><strong>A02:2025 — Security Misconfiguration:</strong> By standardizing a hardened cryptographic protocol for session management instead of relying on vulnerable traditional cookie implementations.</li></ul><h3>Securing the Agentic Era: Payments and Sandboxing</h3><p>As we transition into an era of autonomous AI agents, Google introduced two pivotal protocols to ensure these agents don’t become new attack vectors:</p><ol><li><strong>Agent Payment Protocol:</strong> This protocol allows AI agents to securely handle transitions by using <strong>pre-approved payment information</strong>. It enables agents to act on behalf of users buying tickets, subscribing to services without ever exposing raw financial credentials, ensuring a secure and controlled financial hand-off.</li><li><strong>Capsum Sandbox:</strong> To verify the security of the environments where these agents run, Google open-sourced the <strong>Capsum Sandbox</strong>. This resource allows developers to isolate agent runtimes, ensuring that even if an agent’s logic is compromised, the “blast radius” is contained within a secure, sandboxed environment.</li></ol><h3>The New Frontier: Gemini 3.5, 3.6, and Gemini 4</h3><p>Google also unveiled a massive expansion of the Gemini family, specifically tuned for the speed and precision required for modern security:</p><ul><li><strong>Gemini 3.5 Flash Cyber:</strong> A specialized model fine-tuned for discovering and patching software security flaws, currently available in a pilot for governments and trusted partners.</li><li><strong>Gemini 3.6 Flash:</strong> The new workhorse for high-volume agent execution, offering <strong>17% better token efficiency</strong> and “near-Pro” reasoning capabilities.</li><li><strong>Gemini 3.5 Flash-Lite:</strong> Optimized for the lowest cost and extreme speed in basic developer workflows.</li><li><strong>Gemini 4 (Pre-training):</strong> Google officially announced the start of pre-training for Gemini 4, its most ambitious model to date, focusing heavily on <strong>autonomous agent planning</strong> and advanced coding.</li></ul><h3>AI vs. AI: The Rise of Autonomous Remediators</h3><p>With the “22-second” threat window, human-speed response is no longer sufficient. Google’s private preview of two new agents marks the move toward autonomous security operations:</p><ul><li><strong>Sec Gemini 3:</strong> An experimental reasoning framework designed for Security Operations (SecOps). It connects Gemini’s reasoning layer with real-time telemetry from <strong>Mandiant</strong> and <strong>Google Threat Intelligence (GTI)</strong> to automate complex forensics and root cause analysis.</li><li><strong>Code Mender:</strong> This tool focuses on the defensive side, automating digital forensics and malware analysis. It doesn’t just find the “leak” — it mends the code autonomously, closing the window of opportunity for threat actors.</li></ul><h3>The Path Forward: Day Zero Thinking</h3><p>The takeaway from I/O Connect Bengaluru is clear: the line between “Developer” and “Security Researcher” has blurred. In a landscape where exploits happen at machine speed, our defense must be equally autonomous.</p><p>We must stop treating security as a checkbox and start treating it as the foundation.</p><p><em>Did you attend I/O Connect 2026? I’d love to hear your thoughts on DBSC and the future of AI Agent security in the comments below.</em></p><p><strong>#GoogleIO #CyberSecurity #SoftwareDevelopment #AI #DBSC #AppSec #TechTrends #Bengaluru</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3f53ceef806a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Diatery_Planner: Your AI-Powered Recipe & Diet Planner with Google’s ADK ]]></title>
            <link>https://medium.com/google-cloud/diatery-planner-your-ai-powered-recipe-diet-planner-with-googles-adk-5c402802c094?source=rss-37a694a25704------2</link>
            <guid isPermaLink="false">https://medium.com/p/5c402802c094</guid>
            <category><![CDATA[dietary-plan]]></category>
            <category><![CDATA[agent-development-kit]]></category>
            <category><![CDATA[google-cloud-platform]]></category>
            <dc:creator><![CDATA[Malaya Khuntia]]></dc:creator>
            <pubDate>Mon, 26 May 2025 04:43:14 GMT</pubDate>
            <atom:updated>2025-05-26T04:43:14.246Z</atom:updated>
            <content:encoded><![CDATA[<h3>Dietary_Planner: Your AI-Powered Recipe &amp; Diet Planner with Google’s ADK 🍲🥗🍴</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/654/1*cxdwyntVbX2CpJMV9Bv1pA.gif" /></figure><p>At <strong>Google Cloud Next ’25</strong>, Google unveiled a wave of AI innovations that have developers buzzing — and one standout is the <strong>Agent Development Kit (ADK)</strong>. Paired with the <strong>Agent2Agent Protocol</strong>, this open-source framework empowers developers to build powerful, flexible AI agents that can collaborate across systems. We’re stepping into the age of agent-based AI, where systems made of specialized, intelligent components (agents) work together to tackle complex tasks. Whether you’re crafting an AI assistant or automating a business process, the ADK provides the structure, scalability, and intelligence you need to make it happen.</p><p>Let’s explore what the ADK is, how it works, and why it’s a game-changer — before diving into how I used it to build <strong>Dietary_Planner</strong>, a tool that’s revolutionizing recipe searches and dietary planning! 🌟</p><h3>🤖 What Is the Agent Development Kit (ADK)?</h3><p>The <strong>Agent Development Kit (ADK)</strong> is a modular framework designed by Google to simplify the creation, testing, and deployment of AI agents. It supports a wide range of applications — from chatbots that engage in natural conversations to background automation agents that streamline workflows — all built from a common foundation.</p><p>In the ADK, an agent is like a specialized team member, trained for a specific role: answering questions, scheduling tasks, running processes, or even making decisions powered by large language models (LLMs). These agents are built from a shared starting point called <strong>BaseAgent</strong>, which ensures they share a common “language” while allowing endless customization to fit your needs.</p><h3>🧱 Core Agent Types in ADK</h3><p>The ADK provides different agent types to suit various tasks:</p><ol><li><strong>LLM Agents<br></strong>These agents harness large language models (like Gemini 1.5 or GPT-4o) for tasks requiring reasoning, natural language understanding, or planning.<br><em>Example</em>: A “Speaker Coordinator” that chats with speakers, suggests topics, and builds a conference schedule.</li><li><strong>Workflow Agents<br></strong>These agents orchestrate other agents to execute a plan, whether in sequence, parallel or loops.<br><em>Example</em>: An “Event Manager” that sends invites, schedules sessions, and ensures everything runs on time.</li><li><strong>Custom Agents<br></strong>These are tailored to connect with external systems or perform highly specific jobs.<br><em>Example</em>: A “Venue Booker” that checks third-party systems for room availability and books venues.</li></ol><p>Each agent type can operate independently or collaborate within larger systems, much like microservices, but for AI.</p><h3>🔗 Agent2Agent Protocol: Making Agents Play Nice</h3><p>Alongside the ADK, Google introduced the <strong>Agent2Agent Protocol</strong>, an open standard that enables agents to communicate securely, even if they’re built by different teams or companies. This is a game-changer for enterprise AI, allowing you to mix and match agents from various frameworks while ensuring seamless collaboration.</p><p>Imagine an LLM-powered assistant from one vendor working hand-in-hand with a workflow automation bot from another — all thanks to this protocol. It’s a step toward a more interconnected AI ecosystem, and it’s exactly the kind of innovation that makes projects like Dietary_Planner possible.</p><h3>🍲 Let&#39;s build it</h3><p>Imagine this: you’re craving a delicious Indian chicken curry, but you’re on a weight gain journey, need at least 20g of protein per meal, and have to avoid nuts due to allergies. Finding the perfect recipe or meal plan that ticks all these boxes can feel overwhelming. Enter <strong>Dietary_Planner</strong> — an AI-powered agent system designed to make personalized recipe searches and dietary planning a breeze! 🌟</p><p>In this article, I’ll walk you through the Dietary_Planner project — a tool I’ve been working on to help users find recipes and craft tailored meal plans using the Spoonacular API. Whether you’re a foodie, a developer, or someone looking to meet specific health goals, this project has something for you. Let’s dive in! 🍽️</p><h3>What is Dietary_Planner? 🤔</h3><p>Inspired by the capabilities of the ADK, I set out to build <strong>Dietary_Planner</strong> — an AI-powered agent system that makes personalized recipe searches and dietary planning effortless. Imagine craving a delicious Indian chicken curry while on a weight gain journey, needing at least 20g of protein per meal, and avoiding nuts due to allergies. Finding a meal plan that meets all these requirements can be daunting, but Dietary_Planner makes it simple! 🍽️</p><p>Dietary_Planner leverages the ADK to assist users in two key areas:</p><ul><li><strong>Single Recipe Requests</strong> 🍗: Need a quick recipe for chicken curry? Just ask, and the system fetches a suitable option.</li><li><strong>Full Dietary Plans</strong> 📅: Want a weekly meal plan for weight loss, considering allergies and health conditions like diabetes? Dietary_Planner has you covered.</li></ul><p>The system uses the<a href="https://spoonacular.com/food-api"> Spoonacular API</a> to fetch recipe data and applies AI-driven analysis to ensure the results align with your preferences, dietary goals, and health constraints. It’s like having a personal nutritionist and chef rolled into one, powered by the ADK and a bit of coding magic! 🥄</p><h3>Key Features ✨</h3><p>Here’s what makes Dietary_Planner stand out:</p><ul><li><strong>Recipe Search</strong> 🔍: Find recipes based on cuisine, diet type, and ingredients.</li><li><strong>Dietary Planning</strong> 📅: Create daily or weekly meal plans with nutritional analysis.</li><li><strong>Allergy Management</strong> 🚫: Avoid allergens like nuts or dairy in your meals.</li><li><strong>Health Condition Support</strong> 🩺: Adjust recipes for conditions like diabetes by prioritizing low-sugar options.</li><li><strong>Nutritional Tracking</strong> 📊: Track calories, protein, and other nutrients to meet your goals.</li></ul><p><strong>Fun Fact</strong>: Dietary_Planner can ensure each meal in your plan has at least 50g of protein — perfect for muscle gain or high-protein diets! 💪</p><h3>How Does It Work? 🔄</h3><p>Dietary_Planner is built with a modular, hierarchical agent structure, making it both powerful and flexible. Here’s a peek at its architecture:</p><h3>System Architecture 🏗️</h3><p>The system consists of a <strong>Root Agent</strong> and four specialized sub-agents, each handling a specific task:</p><ol><li><strong>Root Agent</strong> 🌳: The coordinator that manages the entire process and delegates tasks.</li><li><strong>User_Requirement SubAgent</strong> 📝: Extracts your preferences (e.g., dietary goals, allergies, cuisine) from your query.</li><li><strong>Recipe_Finder SubAgent</strong> 🔍: Uses the Spoonacular API to fetch recipes or generate meal plans.</li><li><strong>Health SubAgent</strong> 🩺: Analyzes nutritional content and ensures compliance with health constraints.</li><li><strong>Final SubAgent</strong> ✅: Validates the output and refines it to meet your needs.</li></ol><h3>Here’s a simplified flow:</h3><ul><li>You ask: “I need a weekly diet plan for weight gain with Indian-style meals, 20g protein per meal.”</li><li>The <strong>User_Requirement SubAgent</strong> parses your request into structured data.</li><li>The <strong>Recipe_Finder SubAgent</strong> queries the Spoonacular API for a high-protein Indian meal plan.</li><li>The <strong>Health SubAgent</strong> checks the nutritional data, ensuring each meal has 20g of protein and aligns with your goals.</li><li>The <strong>Final SubAgent</strong> polishes the plan and delivers it to you via the Root Agent.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bnG0KSU5-2YHaniFPxFGrg.png" /></figure><h3>Under the Hood: Implementation Details 🛠️</h3><p>Dietary_Planner is built using the Google ADK, which allows for seamless agent orchestration. The project is inspired by modular designs like the Travel Concierge system but tailored for recipe and dietary planning.</p><h3>Directory Structure 📁</h3><p>The project is organized for clarity and scalability:</p><ul><li><strong>APP/Dietary_Planner/</strong> 🏠</li><li><strong>Sub_agents/</strong> 🧩: Contains sub-agents like Recipe_Finder, Health, and Final.</li><li><strong>Tools/</strong> 🛠️: Houses the spoonacular.py wrapper for API calls.</li><li><strong>agent.py</strong> &amp; <strong>prompt.py</strong>: Define the Root Agent and its instructions.</li></ul><h3>Spoonacular API Integration 🌐</h3><p>The Spoonacular API powers the core functionalities:</p><ul><li><strong>Recipe Search</strong> 🔎: Uses /recipes/complexSearch to find recipes by cuisine, diet, or ingredients.</li><li><strong>Meal Plan Generation</strong> 📅: Uses /mealplanner/generate to create plans with specific calorie and diet constraints.</li><li><strong>Nutritional Data</strong> 📊: Fetches details like protein and sugar content via /recipes/{id}/nutritionWidget.json.</li></ul><p>The API key is securely stored in a .env file, ensuring safe access. 🔑</p><h3>Leveraging the Agent Development Kit (ADK) 🤖</h3><p>A key enabler of Dietary_Planner’s architecture is the Google Agent Development Kit (ADK), which we’ve already introduced. Here’s how we specifically used it in this project:</p><h4>How We Used ADK in Dietary_Planner</h4><ul><li><strong>Agent Definitions</strong>: Each agent is defined using ADK’s agent specification format, with instructions in prompt.py files that guide their behavior (e.g., how the Health agent analyzes nutritional data).</li><li><strong>Session State Management</strong>: The ADK’s session state management ensures data (like user requirements or fetched recipes) is shared efficiently across agents, reducing redundancy.</li><li><strong>Model Integration</strong>: The ADK integrates with models like gemini-2.0-flash, powering the agents’ decision-making capabilities with advanced AI.</li><li><strong>Collaboration via Agent2Agent Protocol</strong>: The protocol ensures our agents (e.g., Recipe_Finder and Health) communicate effectively, even as we plan to integrate external agents in the future.</li></ul><p>Using the ADK streamlined the development process and made Dietary_Planner extensible for future enhancements. If you’re building an AI agent system, I highly recommend exploring the Google ADK — it’s a game-changer! 🚀</p><h3>Why Dietary_Planner Matters 💡</h3><p>In a world where dietary needs are as diverse as the people who have them, Dietary_Planner offers a personalized solution. It’s not just about finding a recipe — it’s about ensuring that the recipe fits your lifestyle, health goals, and taste preferences. Here are a few scenarios where it shines:</p><ul><li><strong>Busy Professionals</strong>: Quickly find a healthy recipe for dinner after a long day.</li><li><strong>Fitness Enthusiasts</strong>: Plan high-protein meals to support muscle gain.</li><li><strong>People with Dietary Restrictions</strong>: Avoid allergens and manage conditions like diabetes with ease.</li></ul><h3>➡️Codebase:</h3><p><a href="https://github.com/Malya-Khuntia/Diatery_Planner_with_Recipe_Using_GCP_Agent_Development_Kit"><strong><em>Malaya/Diatery_Planner_with_Recipe_Using_GCP_Agent_Development_Kit</em></strong></a></p><h3>📽️ Final Output Example (Simplified)</h3><p>Recipe of a single food:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8FESJe3PJyUwWMqM6kordA.png" /><figcaption>Single Recipe (1)</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Lq_Fepmjz2uCUsBb7ztTTA.png" /><figcaption>Single Recipe (2)</figcaption></figure><p>Dietary Plan for a day:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GLHHx8PUTvTJXfe9EBx17g.png" /><figcaption>Dietary Plan (1)</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zBAVhmFOwKLBT8yUpiKoDw.png" /><figcaption>Dietary Plan (2) Generated by Recipe Finder Agent</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Xe0Pn77-iZOpyRESQ0s_WQ.png" /><figcaption>Dietary Plan (3) Generated by Final agent</figcaption></figure><h3>Try It Yourself: Installation Guide 🚀</h3><p>Ready to give Dietary_Planner a spin? Follow these steps to set it up on your machine:</p><p><strong>Create a Virtual Environment</strong> 🏕️</p><pre>python3 -m venv .venv</pre><ol><li><strong>Activate the Virtual Environment</strong> ✅</li></ol><p>On macOS/Linux:</p><pre>source .venv/bin/activate</pre><p>On Windows:</p><pre>.venv\Scripts\activate</pre><p><strong>Clone the Repository</strong> 📥</p><pre>git clone https://github.com/Malya-Khuntia/Diatery_Planner_with_Recipe_Using_GCP_Agent_Development_Kit.git</pre><p><strong>Rename the Project Directory</strong> 📂</p><pre>#rename the file<br>mv Diatery_Planner_with_Recipe_Using_GCP_Agent_Development_Kit Diatery_Planner</pre><p><strong>Navigate to the Project Directory</strong> 📂</p><pre>cd Diatery_Planner</pre><p><strong>Install Dependencies</strong> 📦</p><pre>pip install -r requirements.txt</pre><p><strong>Set Up Environment Variables</strong> 🔑<br>Create a .env file with your Spoonacular API key:</p><ol><li>Sign up at<a href="https://spoonacular.com/food-api"> Spoonacular</a> to get your key.</li></ol><p><strong>Run the Application</strong> 🌐</p><pre>cd ..<br>adk web</pre><ol><li>Access it at <a href="http://localhost:8080.">http://localhost:8080.</a></li></ol><h3>Challenges and Limitations ⚠️</h3><p>Like any project, Dietary_Planner has its challenges:</p><ul><li><strong>API Quotas</strong> 📉: Spoonacular’s free tier has request limits — consider a paid plan for heavy use.</li><li><strong>Nutritional Precision</strong> 📊: The API lacks metrics like glycemic index, so we rely on diet types for conditions like diabetes.</li><li><strong>User Input</strong> 📝: The system assumes clear user queries. Future updates will handle vague inputs better.</li></ul><p>Despite these, the modular design allows easy enhancements, like adding session memory to save user preferences! 🧩</p><h3>What’s Next? 🚀</h3><p>Dietary_Planner is just getting started. Future updates could include:</p><ul><li><strong>Session Memory</strong>: Save user preferences across sessions.</li><li><strong>Interactive Input</strong>: Prompt users for missing details in their queries.</li><li><strong>Expanded API Support</strong>: Integrate more food APIs for broader recipe options.</li></ul><p>I’m excited to see where this project goes, and I’d love your feedback! 🌟</p><h3>Conclusion: Let’s Cook Smarter 🍳</h3><p>Dietary_Planner is more than a tool — it’s a companion for anyone looking to eat smarter, healthier, and tastier. Whether you’re a developer interested in AI agents or a food lover seeking the perfect meal plan, I invite you to try it out and share your thoughts.</p><p>Have ideas to make Dietary_Planner even better? Drop a comment below or contribute to the project on GitHub! Let’s make dietary planning as delightful as the meals we create. 🍴</p><p><em>Happy cooking, and happy coding!</em></p><p><em>Follow me on Medium for more tech and food projects! If you enjoyed this article, give it a clap 👏 and share it with your network.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5c402802c094" width="1" height="1" alt=""><hr><p><a href="https://medium.com/google-cloud/diatery-planner-your-ai-powered-recipe-diet-planner-with-googles-adk-5c402802c094">Diatery_Planner: Your AI-Powered Recipe &amp; Diet Planner with Google’s ADK 🍲🥗🍴</a> was originally published in <a href="https://medium.com/google-cloud">Google Cloud - Community</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ Building a Short Video Script Writer with Google’s Agent Development Kit (ADK)]]></title>
            <link>https://medium.com/google-cloud/building-a-short-video-script-writer-with-googles-agent-development-kit-adk-7b0e55d132cc?source=rss-37a694a25704------2</link>
            <guid isPermaLink="false">https://medium.com/p/7b0e55d132cc</guid>
            <category><![CDATA[gemini]]></category>
            <category><![CDATA[google-cloud-platform]]></category>
            <category><![CDATA[adk]]></category>
            <category><![CDATA[gcp-app-dev]]></category>
            <category><![CDATA[agent-development-kit]]></category>
            <dc:creator><![CDATA[Malaya Khuntia]]></dc:creator>
            <pubDate>Wed, 23 Apr 2025 09:57:00 GMT</pubDate>
            <atom:updated>2025-04-23T09:57:00.244Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*GPe5b1bIyDdiyGYaT6ii_A.gif" /></figure><p>At <strong>Google Cloud Next ’25</strong>, Google dropped some major AI innovations — and among them, the <strong>Agent Development Kit (ADK)</strong> stood out. This open-source framework, paired with the <strong>Agent2Agent Protocol</strong>, is a game-changer for developers looking to build AI systems that are both intelligent and collaborative.</p><p>We’re entering the age of <strong>agent-based AI</strong> — modular systems made of multiple specialized components that work together seamlessly. Whether you’re building an AI assistant, orchestrating workflows, or powering enterprise automation, ADK provides a structure that scales.</p><p>In this article, we’ll explore how we used ADK to build a fully automated <strong>short video script writer</strong>, powered by a team of AI agents and Google’s Gemini APIs. Let’s dive in!</p><h3>🤖 What Is the Agent Development Kit (ADK)?</h3><p>The <strong>Agent Development Kit</strong> helps developers create, test, and deploy AI agents with modular building blocks. These agents can be conversational (like chatbots) or perform background tasks (like orchestrating workflows). At their core, all ADK agents are subclasses of a shared <strong>BaseAgent</strong> — think of it as a common foundation that ensures consistency while allowing specialization.</p><h4>🧱 Core Agent Types in ADK</h4><ol><li><strong><em>LLM Agents</em><br></strong> Use powerful models like Gemini 1.5 or GPT-4o for tasks requiring reasoning, planning, or natural language understanding.<br> <em>Example: A chatbot that schedules events or answers complex queries.</em></li><li><strong><em>Workflow Agents</em><br></strong> Coordinate the execution of multiple agents in sequence, in parallel, or in loops.<br> <em>Example: A system that sends emails, then books meetings, then follows up automatically.</em></li><li><strong><em>Custom Agents</em><br></strong> Extend Base Agent with unique logic, custom APIs, or third-party integrations.<br> <em>Example: An API-driven agent that books venues or pulls data from internal tools.</em></li></ol><h3>🔗 Agent2Agent Protocol</h3><p>Google’s <strong>Agent2Agent Protocol</strong> is an open communication standard allowing agents — even from different frameworks — to collaborate securely. This makes enterprise-grade multi-agent systems interoperable and future-proof.</p><h3>🎯 Real-World Example: Automating a Tech Conference</h3><p>Let’s say you’re organizing an event like <strong>Google Cloud Next</strong>. With ADK, you could design:</p><ul><li><strong>LLM Agent</strong> — “Speaker Coordinator”: Uses natural language to manage speaker invites and schedules.</li><li><strong>Workflow Agent</strong> — “Event Manager”: Handles step-by-step orchestration (invitations ➝ sessions ➝ reminders).</li><li><strong>Custom Agent</strong> — “Venue Booker”: Integrates with venue APIs to reserve locations.</li></ul><p>Each agent is autonomous but communicates and coordinates with others to execute a larger mission — a great model for real-world automation.</p><h3>🎬 My Project: A Short Video Script Writer Using ADK</h3><p>Now, let’s apply this concept to a creative use case: <strong>automated short video scripting</strong>.</p><p>In traditional workflows, this takes a team: a writer, a visual strategist, and an editor. With ADK, I recreated that team using <strong>a parent agent</strong> and <strong>three sub-agents</strong> — all powered by Gemini and orchestrated via ADK.</p><h3>🧠 The AI Agent Team</h3><h4>👤 Parent Agent: LLM Chatbot</h4><p>This agent is the orchestrator — a Gemini-powered chatbot that manages the flow between three specialized sub-agents.</p><h4>📝 1. Script Writer Agent</h4><ul><li><strong>Task</strong>: Collect raw content from Google based on a search topic (e.g., “AI in 2025”).</li><li><strong>Tool</strong>: Uses Gemini API to find diverse, relevant data.</li><li><strong>Output</strong>: Stores results in a shared output_key for later agents to access.</li></ul><h4><strong>👁️ 2. Visualizer Agent</strong></h4><ul><li><strong>Task</strong>: Enhances the script with visual cues and content instructions.</li><li><strong>Input</strong>: Reads from the Script Writer’s output.</li><li><strong>Instruction File</strong>: Guides analysis — highlights keywords, suggests imagery, etc.</li><li><strong>Output</strong>: Stores refined version in a new output key.</li></ul><h4>🎨 3. Formatter Agent</h4><ul><li><strong>Task</strong>: Creates a final video script with narration, colors, transitions, and formatting.</li><li><strong>Input</strong>: Pulls from both Script Writer and Visualizer.</li><li><strong>Output</strong>: A full, polished, production-ready script.</li></ul><h4>🔁 Bonus: LoopAgent for Revisions</h4><p>To further refine the script, I added a <strong>LoopAgent</strong> — a special type of Workflow Agent that allows repeated iteration through the three sub-agents.</p><p>This enables:</p><ul><li>Progressive enhancement</li><li>Iterative revisions based on predefined rules</li><li>Automatic feedback loops without human input</li></ul><p>Example criteria for stopping the loop:</p><ul><li>After 3 iterations</li><li>Upon meeting a confidence score</li><li>Manual or AI-based approval</li></ul><h3>⚙️ Building an Agent in ADK: Anatomy of a Config</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/831/0*1k0pJLHJlszv5M_N" /></figure><p>Every agent in ADK is defined using a structured configuration. Here’s a breakdown:</p><h4>🏷️ name</h4><p>This is the <strong>unique identifier</strong> for the agent. Other agents use this name to reference or communicate with it. Think of it like the agent’s username in the multi-agent workspace.</p><blockquote>name: “ShortsVisualizer”</blockquote><h4>🧠 model</h4><p>This defines which <strong>AI model</strong> the agent uses — such as Gemini 1.5 Flash, GPT-4, etc. This is particularly important for LLM agents that need reasoning, summarizing, or content generation capabilities.</p><blockquote>model: “gemini-1.5-flash”</blockquote><h4>📘 instruction</h4><p>This is a <strong>file containing a list of step-by-step instructions</strong> that guide how the agent should complete its task. It works like a mini “playbook” or recipe — ensuring the agent follows the right process.</p><blockquote>instruction: “Visualizer_instruction.txt”</blockquote><p>These instruction files are super important for non-LLM agents (like visualizers or workflow agents), helping them stay focused and consistent.</p><h4>📝 description</h4><p>This is a short summary of what the agent does. It helps other agents (and developers) understand the role of the agent, especially when they need to coordinate.</p><blockquote>description: “This agent collects topic-related data from Gemini API and creates a rough content draft.”</blockquote><h4>🗃️ output_key</h4><p>This defines <strong>where the agent’s result will be stored</strong>. Other agents can access the output by referencing this key, making data flow seamless.</p><blockquote>output_key: “visual_concepts”</blockquote><h3>📘 Sample Instruction File</h3><p>The <strong>instruction file</strong> is like a playbook — a simple, human-readable list of steps the agent should follow to perform its assigned task.</p><p>Here’s a simplified example:</p><p>steps:</p><p>- Search Google using Gemini API for topic keyword</p><p>- Collect 5–7 unique pieces of content</p><p>- Remove duplicates and unrelated results</p><p>- Store cleaned content into output key</p><p>Whether it’s writing scripts, analyzing content, or formatting final results, the instruction file ensures agents don’t just “wing it” — they follow a consistent and logical workflow.</p><h3>➡️Codebase:</h3><p><a href="https://github.com/Malya-Khuntia/GCP_Agent_Development_Kit_Short_Video_script_Generator"><strong><em>Malaya/GCP_Agent_Development_Kit_Short_Video_script_Generator</em></strong></a></p><h3>📽️ Final Output Example (Simplified)</h3><p>Input: Write a short video script on topic “AI in 2025”</p><p>1st iteration output:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*vLeFOaqVlZHmrqL8" /><figcaption>1st Output</figcaption></figure><p>Final output after 3 iteration:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*PAqV-oqiwVayAeGo" /><figcaption>Final Output</figcaption></figure><h3>🧰 Tools &amp; APIs Used</h3><ul><li><strong>Gemini API</strong> — For content generation and search</li><li><strong>ADK Base Agent + Workflow Agents</strong> — For logic and coordination</li><li><strong>Instruction Files</strong> — To guide agent behavior</li><li><strong>Memory</strong> — For cross-agent context management</li></ul><h3>🚀 The Future of AI Creativity</h3><p>What I have built is just one example of what’s possible. From scripting to scheduling, from customer support to design — agent-based AI is the next evolution.</p><p>And the best part? ADK makes it modular, scalable, and ready for production.</p><p>If you’re building with AI, <strong>start thinking in agents.</strong> With Google’s ADK and the Agent2Agent Protocol, you’re not just building bots — you’re creating <strong>collaborative AI systems</strong>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7b0e55d132cc" width="1" height="1" alt=""><hr><p><a href="https://medium.com/google-cloud/building-a-short-video-script-writer-with-googles-agent-development-kit-adk-7b0e55d132cc">🎬 Building a Short Video Script Writer with Google’s Agent Development Kit (ADK)</a> was originally published in <a href="https://medium.com/google-cloud">Google Cloud - Community</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>