<?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 Gaurav Tripathi on Medium]]></title>
        <description><![CDATA[Stories by Gaurav Tripathi on Medium]]></description>
        <link>https://medium.com/@tripathi.gaurav86?source=rss-8ace4ae97359------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*pVLYqi6Rg-BHNaOW.jpg</url>
            <title>Stories by Gaurav Tripathi on Medium</title>
            <link>https://medium.com/@tripathi.gaurav86?source=rss-8ace4ae97359------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 10:00:32 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@tripathi.gaurav86/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[OWASP TOP 10]]></title>
            <link>https://medium.com/@tripathi.gaurav86/owasp-top-10-2bf22ad49e29?source=rss-8ace4ae97359------2</link>
            <guid isPermaLink="false">https://medium.com/p/2bf22ad49e29</guid>
            <category><![CDATA[owasp-top-10-2021]]></category>
            <category><![CDATA[owasp-vulnerabilities]]></category>
            <category><![CDATA[owasp-top-10]]></category>
            <category><![CDATA[owasp-2021]]></category>
            <category><![CDATA[owasp-web-security-risks]]></category>
            <dc:creator><![CDATA[Gaurav Tripathi]]></dc:creator>
            <pubDate>Sat, 06 Jul 2024 17:11:30 GMT</pubDate>
            <atom:updated>2024-07-06T17:11:30.844Z</atom:updated>
            <content:encoded><![CDATA[<h3>Securing the Web: OWASP’s Top 10 Threats Developers Must Know</h3><p>When you browse the web, stopping to think about security might not be at the forefront of your mind. But behind the scenes, developers and security professionals constantly work to ensure your online experience is safe. A crucial resource in making web applications safe is the <strong>OWASP Top 10</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/1*qwxTWe1iUGmaOInJuz3ayg.png" /></figure><p><strong>OWASP</strong> stands for the Open Web Application Security Project, a non-profit organization focused on improving the security of web applications. Their <strong>Top 10</strong> is a regularly updated list outlining the most critical web application security risks. Think of it as a consensus among security experts on the biggest threats facing websites today.</p><p>By understanding and addressing these top 10 risks, developers can build more secure applications and browse the web with greater peace of mind.</p><p>Even you can be part of this community. Anyone can opt for membership of <a href="https://app.slack.com/workspace-signin">Slack</a> community and contribute to data collection to decide the latest <strong>OWASP Top 10</strong>.</p><h4><strong>Contribution Process</strong></h4><p>Templates: <a href="https://github.com/OWASP/Top10/tree/master/2024/Data">https://github.com/OWASP/Top10/tree/master/2024/Data</a></p><p>There are a few ways that data can be contributed:</p><ol><li>Email a CSV/Excel/JSON file with the dataset(s) to <a href="/service/mailto:brian.glas@owasp.org">brian.glas@owasp.org</a></li><li>Upload a CSV/Excel/JSON file to <a href="https://bit.ly/OWASPTop10Data">https://bit.ly/OWASPTop10Data</a></li></ol><p>You might have seen different lists for ‘OWASP Top 10’ for different years. This is because the <strong>OWASP Top 10</strong> isn’t static.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/936/1*EjWNd6sMeVN5Wvkf4Ylmeg.png" /></figure><p>It changes to reflect:</p><ul><li><strong>New Threats:</strong> As attackers get craftier, new risks emerge and may be added to the list.</li><li><strong>Tech Evolution:</strong> New ways of building web apps (cloud, APIs) introduce new security challenges that the Top 10 needs to address.</li><li><strong>Deeper Understanding:</strong> Security research helps us better understand existing threats and identify new ones, keeping the <strong>Top 10</strong> relevant.</li></ul><p>This constant update ensures the <strong>OWASP Top 10</strong> remains a powerful tool for building secure web applications.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/1*_YgTuJ8XTk7TVHATBoaM1A.png" /></figure><p>Here’s the <strong>OWASP Top 10</strong> for 2021 explained in simpler terms:</p><ol><li><strong>Broken Access Control:</strong> Imagine someone sneaking into a restricted area. This means applications allow unauthorized users to access sensitive data or functionality.</li><li><strong>Cryptographic Failures:</strong> Think of weak locks on your treasure chest. These are issues with encryption or key management that could expose your data.</li><li><strong>Injection:</strong> Like an attacker injecting malicious code into a conversation, this is when untrusted data gets inserted into an application, potentially taking control.</li><li><strong>Insecure Design:</strong> Building a house on sand isn’t a good idea. This category highlights the importance of secure design principles from the beginning of development.</li><li><strong>Security Misconfiguration:</strong> It’s like leaving your house door unlocked! Misconfigured security settings in applications leave them vulnerable.</li><li><strong>Vulnerable and Outdated Components:</strong> Using outdated software with known weaknesses is like having a rusty lock on your door. Update your components!</li><li><strong>Identification and Authentication Failures:</strong> Think of forgetting your password or someone else impersonating you. This category deals with weaknesses in how users are identified and authenticated.</li><li><strong>Software and Data Integrity Failures:</strong> This emphasizes verifying the integrity of software updates and critical data to ensure they haven’t been tampered with.</li><li><strong>Security Logging and Monitoring Failures:</strong> Not having security cameras or keeping poor records is a big risk. This category focuses on inadequate logging and monitoring of security events.</li><li><strong>Server-Side Request Forgery:</strong> Imagine a trickster manipulating a server into doing something it shouldn’t. This is a new entry based on community input, highlighting a potential attack method.</li></ol><p>By understanding these top 10 risks, developers can build more secure web applications and keep our online experiences safer.</p><p>Even we have <strong>OWASP Mobile Top 10</strong>! It tackles security risks specific to mobile apps, unlike the Web version. Here’s why:</p><ul><li><strong>Different Architecture:</strong> Mobile apps have their own game compared to web apps, requiring unique security considerations.</li><li><strong>Platform Specifics:</strong> Android and iOS each have security quirks that the Mobile Top 10 addresses, separate from the broader web focus.</li><li><strong>Hardware Integration:</strong> Mobile apps tap into device features like cameras, opening new security doors (and the Mobile Top 10 helps lock them tight).</li></ul><p>This targeted approach ensures mobile app developers build secure experiences for users.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BVnDyujY6TJJJSnS5VLlEg.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2bf22ad49e29" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Redis Search]]></title>
            <link>https://medium.com/@tripathi.gaurav86/redis-search-f99c380dab17?source=rss-8ace4ae97359------2</link>
            <guid isPermaLink="false">https://medium.com/p/f99c380dab17</guid>
            <dc:creator><![CDATA[Gaurav Tripathi]]></dc:creator>
            <pubDate>Sat, 03 Feb 2024 10:09:01 GMT</pubDate>
            <atom:updated>2024-02-03T10:09:01.538Z</atom:updated>
            <content:encoded><![CDATA[<h3>Unlocking Powerful Search Capabilities</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/661/1*qeJEisfXBZw0X9gZfeAZpQ.png" /></figure><p>Redis, renowned for its lightning-fast in-memory data storage, doesn’t limit its prowess to simple key-value storage. Redis Search, an extension to the core Redis, empowers developers with efficient and scalable search capabilities. In this blog, we’ll dive into Redis Search, explore its key features, and demonstrate its usage through illustrative examples.</p><h3>Understanding Redis Search:</h3><h3>What is Redis Search?</h3><p>Redis Search is an extension module for Redis that provides full-text search capabilities. It introduces an inverted index to efficiently search through textual data stored in Redis.</p><h3>Key Features:</h3><ul><li>Full-Text Search: Search through textual data efficiently.</li><li>Inverted Index: Indexing mechanism for rapid searches.</li><li>Document-based Storage: Store and retrieve complex data structures.</li><li>Query Syntax: Support for complex queries.</li></ul><h3>Getting Started:</h3><h3>1. Installing Redis Search:</h3><p>Redis Search is an extension module, and you need to install it separately. Visit the GitHub repository for Redis Search for installation instructions.</p><h3>2. Creating an Index:</h3><p>To use Redis Search, start by creating an index. For instance, let’s create an index for a product catalog:</p><pre>FT.CREATE idx:products ON HASH PREFIX 1 &quot;product:&quot; SCHEMA name TEXT SORTABLE price NUMERICbashCopy codeFT.CREATE idx:products ON HASH PREFIX 1 &quot;product:&quot; SCHEMA name TEXT SORTABLE price NUME</pre><p>Here, we’ve created an index named idx:products with fields for product names and prices.</p><h3>Text vs. Tag:</h3><p>Tags:</p><ul><li>Purpose: For categorical or label-based information.</li><li>Indexing: Treated as keywords for exact match queries.</li><li>Efficiency: Efficient for filtering and grouping documents.</li><li>Example: Creating an index for books:</li></ul><pre>FT.CREATE idx:books ON HASH PREFIX 1 &quot;book:&quot; SCHEMA title TEXT SORTABLE author TAG SORTABLE genre TAG</pre><p>Text Fields:</p><ul><li>Purpose: For storing and searching through textual content.</li><li>Indexing: Supports full-text search capabilities.</li><li>Flexibility: Allows partial matches and flexible queries.</li><li>Example: Creating an index for blog posts:</li></ul><pre>FT.CREATE idx:blogposts ON HASH PREFIX 1 &quot;post:&quot; SCHEMA title TEXT SORTABLE content TEXT</pre><h3>When to Choose:</h3><ul><li>Use Tags When: Need efficient filtering and grouping based on predefined categories.</li><li>Use Text Fields When: Require flexible and comprehensive searches, including partial matches and content-based queries.</li></ul><p>Understanding these differences helps in designing optimized Redis Search indexes based on specific use case requirements.</p><h3>Performing Searches:</h3><h3>1. Basic Search:</h3><p>Let’s search for products with prices less than $50:</p><pre>FT.SEARCH idx:products &quot;@price:[0 50]&quot;</pre><h3>2. Complex Queries:</h3><p>Perform complex searches, such as finding products with a specific name or within a price range:</p><pre>FT.SEARCH idx:products &quot;@name:(Redis*) @price:[50 100]&quot;</pre><p>This query searches for products with names starting with “Redis” and prices between $50 and $100.</p><h3>Adding Documents:</h3><h3>1. Indexing Documents:</h3><p>Add documents to the index:</p><pre>FT.ADD idx:products:1 1.0 FIELDS name &quot;Redis Book&quot; price 25.99<br>FT.ADD idx:products:2 1.0 FIELDS name &quot;Redis T-shirt&quot; price 15.99</pre><p>Here, we added two products to the index.</p><h3>2. Searching with Documents:</h3><p>Now, search for products again to include the newly added documents:</p><pre>FT.SEARCH idx:products &quot;*&quot;</pre><h3>Conclusion:</h3><p>Redis Search extends the capabilities of Redis, transforming it into a powerful search engine. With features like full-text search, inverted indexing, and complex query support, Redis Search is a valuable tool for applications requiring efficient and scalable search functionality.</p><p>Redis Search’s simplicity and integration with existing Redis data structures make it an excellent choice for developers looking to enhance search capabilities in their applications. Experiment with the provided examples to unlock the full potential of Redis Search in your projects.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f99c380dab17" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Authentication vs. Authorization in Microservices with Java Spring Boot]]></title>
            <link>https://medium.com/@tripathi.gaurav86/authentication-vs-authorization-in-microservices-with-java-spring-boot-a6c831d7b499?source=rss-8ace4ae97359------2</link>
            <guid isPermaLink="false">https://medium.com/p/a6c831d7b499</guid>
            <dc:creator><![CDATA[Gaurav Tripathi]]></dc:creator>
            <pubDate>Sat, 23 Sep 2023 08:24:24 GMT</pubDate>
            <atom:updated>2023-09-23T08:24:24.974Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/870/1*6j80YnI5IfPvO-DRgPsr5w.jpeg" /><figcaption>Authentication vs. Authorization</figcaption></figure><p>In the world of microservices architecture, security is paramount. Two fundamental concepts that play a crucial role in securing your microservices are authentication and authorization. While these terms might seem similar, they serve distinct purposes in ensuring the integrity and security of your application. In this tech blog, we will delve into the differences between authentication and authorization, and provide examples of how they are implemented in Java Spring Boot microservices.</p><h3>Authentication: Who Are You?</h3><p>Authentication is the process of verifying the identity of a user, service, or system component trying to access your application. It answers the question, “Who are you?” and ensures that the entity claiming to be a particular user or service is, indeed, that entity. Authentication is typically performed using various mechanisms such as username/password, tokens, or certificates.</p><h4>Example in Java Spring Boot:</h4><p>Imagine a microservice that handles user login. To authenticate users, you might implement a username and password-based authentication using Spring Security.</p><pre>@Configuration<br>@EnableWebSecurity<br>public class SecurityConfig extends WebSecurityConfigurerAdapter {<br><br>    @Autowired<br>    private CustomUserDetailsService userDetailsService;<br><br>    @Override<br>    protected void configure(AuthenticationManagerBuilder auth) throws Exception {<br>        auth.userDetailsService(userDetailsService)<br>            .passwordEncoder(passwordEncoder());<br>    }<br><br>    @Override<br>    protected void configure(HttpSecurity http) throws Exception {<br>        http.csrf().disable()<br>            .authorizeRequests()<br>            .antMatchers(&quot;/public/**&quot;).permitAll()<br>            .anyRequest().authenticated()<br>            .and()<br>            .formLogin().loginPage(&quot;/login&quot;).permitAll()<br>            .and()<br>            .logout().permitAll();<br>    }<br><br>    @Bean<br>    public PasswordEncoder passwordEncoder() {<br>        return new BCryptPasswordEncoder();<br>    }<br>}</pre><p>In this example, we configure Spring Security to handle user authentication. It verifies the user’s identity based on their username and password.</p><h3>Authorization: What Are You Allowed to Do?</h3><p>Authorization, on the other hand, deals with permissions and access control. It answers the question, “What are you allowed to do?” Once a user or service is authenticated, authorization determines the actions they are permitted to perform within the application. Authorization rules can be defined based on roles, permissions, or policies.</p><h4>Example in Java Spring Boot:</h4><p>Suppose you have a microservice that manages customer orders. You can implement authorization using Spring Security’s method-level security annotations.</p><pre>@Service<br>public class OrderService {<br><br>    @PreAuthorize(&quot;hasRole(&#39;ROLE_ADMIN&#39;)&quot;)<br>    public void createOrder(Order order) {<br>        // Logic to create an order<br>    }<br><br>    @PreAuthorize(&quot;hasRole(&#39;ROLE_USER&#39;)&quot;)<br>    public void viewOrder(Long orderId) {<br>        // Logic to view an order<br>    }<br>}</pre><p>In this example, we use the @PreAuthorize annotation to specify who is allowed to access each method. Users with the &#39;ROLE_ADMIN&#39; can create orders, while users with &#39;ROLE_USER&#39; can only view orders.</p><h3>Authentication Strategies:</h3><h4>1. JWT (JSON Web Tokens):</h4><p>JWT is a popular authentication method that uses digitally signed tokens to verify the authenticity of a user or service. It’s widely used for securing APIs in microservices.</p><h4>Example in Java Spring Boot:</h4><pre>@Configuration<br>@EnableWebSecurity<br>public class SecurityConfig extends WebSecurityConfigurerAdapter {<br><br>    @Override<br>    protected void configure(HttpSecurity http) throws Exception {<br>        http.csrf().disable()<br>            .authorizeRequests()<br>            .antMatchers(&quot;/public/**&quot;).permitAll()<br>            .anyRequest().authenticated()<br>            .and()<br>            .addFilter(new JwtAuthenticationFilter(authenticationManager()))<br>            .addFilter(new JwtAuthorizationFilter(authenticationManager()));<br>    }<br><br>    // Other configurations for JWT token generation and validation<br>}</pre><p>In this example, we configure Spring Security to use JWT for authentication and authorization. JwtAuthenticationFilter handles token-based authentication, and JwtAuthorizationFilter ensures that only authorized users can access resources.</p><h3>2. Firebase Authentication:</h3><p>Firebase Authentication is a service provided by Google Firebase that allows you to authenticate users using various identity providers like Google, Facebook, or email/password.</p><h4>Example in Java Spring Boot:</h4><pre>@Service<br>public class FirebaseAuthenticationService {<br><br>    public FirebaseToken verifyIdToken(String idToken) {<br>        FirebaseToken decodedToken = FirebaseAuth.getInstance()<br>                .verifyIdToken(idToken);<br>        return decodedToken;<br>    }<br>}</pre><p>In this example, we use the Firebase Admin SDK to verify Firebase ID tokens in a Spring Boot service.</p><h3>Authorization Strategies:</h3><h4>1. Role-Based Authorization:</h4><p>Role-based authorization assigns roles (e.g., “ADMIN,” “USER”) to users and restricts access based on these roles.</p><h4>Example in Java Spring Boot:</h4><pre>@Service<br>public class OrderService {<br><br>    @PreAuthorize(&quot;hasRole(&#39;ROLE_ADMIN&#39;)&quot;)<br>    public void createOrder(Order order) {<br>        // Logic to create an order<br>    }<br><br>    @PreAuthorize(&quot;hasRole(&#39;ROLE_USER&#39;)&quot;)<br>    public void viewOrder(Long orderId) {<br>        // Logic to view an order<br>    }<br>}</pre><p>In this example, we use Spring Security’s @PreAuthorize annotation to restrict access to methods based on user roles.</p><h3>2. Entity-Level Authorization:</h3><p>Entity-level authorization controls access to specific resources based on ownership or other criteria related to the resource itself.</p><h4>Example in Java Spring Boot:</h4><pre>@Service<br>public class DocumentService {<br><br>    @PreAuthorize(&quot;@documentPermissionService.canAccessDocument(authentication, #documentId)&quot;)<br>    public Document getDocument(Long documentId) {<br>        // Logic to retrieve a document<br>    }<br>}</pre><p>Here, we use a custom @documentPermissionService to implement entity-level authorization, which checks if the authenticated user has permission to access a specific document.</p><h3>Conclusion:</h3><p>Implementing a combination of authentication and authorization strategies, such as JWT, Firebase tokens, and role-based/entity-level authorization, enhances the security of your Java Spring Boot microservices. These strategies help you control who can access your services and what actions they can perform, ensuring that your microservices architecture remains secure and well-protected.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a6c831d7b499" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>