<?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 Lumin De Silva on Medium]]></title>
        <description><![CDATA[Stories by Lumin De Silva on Medium]]></description>
        <link>https://medium.com/@luminde9958?source=rss-5661f1d6061d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Stories by Lumin De Silva on Medium</title>
            <link>https://medium.com/@luminde9958?source=rss-5661f1d6061d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 11:26:22 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@luminde9958/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[Network Troubleshooting Guide for DevOps Engineers]]></title>
            <link>https://medium.com/@luminde9958/network-troubleshooting-guide-for-devops-engineers-1a8e2e6d09d5?source=rss-5661f1d6061d------2</link>
            <guid isPermaLink="false">https://medium.com/p/1a8e2e6d09d5</guid>
            <category><![CDATA[troubleshooting]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[devops-practice]]></category>
            <category><![CDATA[infrastructure]]></category>
            <category><![CDATA[networking]]></category>
            <dc:creator><![CDATA[Lumin De Silva]]></dc:creator>
            <pubDate>Fri, 17 Oct 2025 17:43:03 GMT</pubDate>
            <atom:updated>2025-10-17T17:43:03.438Z</atom:updated>
            <content:encoded><![CDATA[<p>Today, I wanted to share a recent experience I had while troubleshooting a network issue between two servers. As DevOps engineers, we often encounter various connectivity problems such as <em>“Connection Refused” “Connection Timed Out”</em> or <em>“No Route to Host”.</em></p><p>In my case, I spent a couple of hours investigating a persistent connectivity problem, which eventually turned out to be caused by a <strong>simple misconfiguration in the IP route</strong>. It was a great reminder that even minor routing issues can lead to major troubleshooting sessions.</p><p>Through this post, I’d like to share some insights and practical steps on how to systematically troubleshoot <strong>server and network-related issues</strong>, identify the root cause, and fix them efficiently.</p><p>I hope this guide helps anyone who deals with similar challenges. And if you’ve faced interesting troubleshooting scenarios or have your own techniques, feel free to share them in the comments. Let’s learn and grow together by sharing our knowledge and experiences.</p><h3>Introduction</h3><p>Server connection issues can occur at different layers of the stack. Common problems include:</p><ul><li><strong>Network-level issues:</strong> Connection timeouts, unreachable hosts, DNS resolution failures</li><li><strong>Application-level issues:</strong> “Connection refused”, “Login failed” or misconfigured services</li><li><strong>HTTP-level issues:</strong> Errors like 404 (Not Found) or 500 (Internal Server Error)</li></ul><p>These can result from a variety of factors — including <strong>hardware failures</strong>, <strong>misconfigured routes</strong>, <strong>firewall restrictions</strong>, <strong>unavailable services</strong>, or even <strong>software bugs</strong>.</p><p>In this post, I’ll focus mainly on <strong>network-layer troubleshooting</strong> — sharing practical methods, useful commands, and real-world examples that can help you systematically identify and resolve connectivity issues between servers.</p><h3>Understanding the OSI Model in Troubleshooting</h3><p>When it comes to troubleshooting network-related issues, it’s helpful to think in terms of the <strong>OSI model</strong>. While all layers play a role in connectivity, we primarily focus on <strong>Layer 3 (Network)</strong> and <strong>Layer 4 (Transport)</strong> during most server-to-server communication checks.</p><p>Here’s a quick breakdown of the key layers relevant to troubleshooting:</p><pre>Layer 7 (Application) - Service configuration, authentication<br>Layer 4 (Transport)   - Port availability, firewall rules<br>Layer 3 (Network)     - IP routing, subnet configuration<br>Layer 2 (Data Link)   - MAC address, interface status<br>Layer 1 (Physical)    - Cables, network interface</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Ynd4AQjoo8hYN8AY.png" /><figcaption>OSI Model Layers (Extracted from : <a href="https://www.cloudflare.com/learning/ddos/glossary/open-systems-interconnection-model-osi/">CloudFlare</a>)</figcaption></figure><h3>Network Level Connection errors</h3><p>When troubleshooting connectivity between servers, you’ll often come across various network-level errors. Understanding what each means can help you narrow down the issue quickly:</p><ul><li><strong>Connection Timed Out:</strong> The server didn’t respond within the expected timeframe, possibly due to a network issue, routing delay, or the destination service being down.</li><li><strong>Network/Host Unreachable:</strong> The local machine or an intermediate router couldn’t find a route to the target server.</li><li><strong>DNS Lookup Failure:</strong> The server’s IP address couldn’t be resolved, often caused by incorrect DNS settings or a failed DNS registration.</li><li><strong>No Route to Host:</strong> Similar to “Host Unreachable,” this indicates that the system doesn’t have a valid route to reach the target network.</li><li><strong>100% Packet Loss:</strong> All packets sent were lost during transmission, which is often a strong indicator of a complete network break or firewall block.</li><li><strong>Connection Refused:</strong> The service on the destination server isn’t listening on the specified port, or the firewall is blocking the request.</li><li><strong>Host is Down:</strong> The destination server is powered off or not reachable due to hardware or connectivity issues.</li></ul><h3>Systematic Troubleshooting Methodology</h3><p>Having a structured approach to troubleshooting is essential. It saves time, avoids confusion, and helps pinpoint the issue more efficiently. Below is a simple step-by-step process I personally follow. This isn’t a strict theory, but rather a practical framework that you can adapt. If you have a better approach, feel free to share it in the comments so others can learn from it too.</p><h4>Step 01: Define the Scope</h4><p>Before starting, clearly define what you’re troubleshooting. Asking the right questions helps set your direction:</p><ul><li><strong>Source:</strong> Which server is facing the issue?</li><li><strong>Destination:</strong> What are you trying to connect to?</li><li><strong>Service:</strong> Which port or protocol is involved?</li><li><strong>Timing:</strong> When did the issue start? Is it intermittent or consistent?</li></ul><p>These questions help you narrow the scope and focus on the right layer of the problem.</p><h4>Step 02: Basic Connectivity Tests</h4><p>Before diving too deep, start by testing the basic connection commands; sometimes they can reveal the issue right from the start.</p><pre># 1. Ping test (ICMP)<br>ping &lt;destination_ip&gt;<br><br># 2. DNS resolution<br>nslookup &lt;hostname&gt;<br>dig &lt;hostname&gt;<br><br># 3. Port connectivity<br>telnet &lt;ip&gt; &lt;port&gt;<br>nc -zv &lt;ip&gt; &lt;port&gt;     # preferred modern test<br><br># 4. Traceroute<br>traceroute &lt;ip&gt;        # Linux<br>tracert &lt;ip&gt;           # Windows<br>tracepath &lt;ip&gt;<br><br># 5. Curl or wget for HTTP checks<br>curl -v http://&lt;ip&gt;:&lt;port&gt;<br>wget --spider http://&lt;ip&gt;:&lt;port&gt;</pre><p>These commands help you verify if the server is reachable, DNS is resolving properly, and whether the correct ports are open.</p><h4>Step 3: Local System Checks</h4><p>If the issue isn’t external, it might be local. Check network configurations, routes, and firewalls on the source system.</p><pre># Network interfaces<br>ip addr show<br>ip link show<br>ethtool &lt;interface&gt;          # physical link status<br><br># Routing table<br>route -n<br>ip route show<br><br># Local firewall<br>iptables -L -v -n<br>firewall-cmd --list-all<br>nft list ruleset<br><br># Local port listening<br>netstat -tlnp<br>ss -tlnp<br>lsof -i :&lt;port&gt;<br><br># DNS settings<br>cat /etc/resolv.conf<br>cat /etc/hosts</pre><p>These checks confirm whether your interfaces are up, routes are correctly set, and firewalls or services are properly configured.</p><h4>Step 4: Network Path Analysis</h4><p>Once local configurations are verified, move on to analysing how packets travel through the network.</p><pre># Check actual route taken<br>ip route get &lt;destination_ip&gt;<br><br># Check for multiple gateways<br>ip route | grep default<br><br># Interface-specific routing tables<br>ip route show table all<br><br># Tracepath for hops<br>tracepath &lt;destination_ip&gt;</pre><p>This helps identify misconfigured routes, overlapping subnets, or incorrect gateway assignments, which are often the root cause of “no route to host” or “host unreachable” errors.</p><h4>Step 5: Advanced Packet Analysis</h4><p>Sometimes it’s better to try sending and analysing packets. In my troubleshooting case, I found the root cause by capturing a <strong>tcpdump</strong>. So, if the previous steps don’t give you a clear answer, it’s a good idea to try this as well.</p><pre># Capture packets on an interface<br>tcpdump -i &lt;interface&gt; host &lt;ip&gt; and port &lt;port&gt;<br><br># Capture all interfaces<br>tcpdump -i any host &lt;ip&gt;<br><br># Save capture to analyze in Wireshark<br>tcpdump -i any -w capture.pcap host &lt;ip&gt;</pre><p>Through analysing packet flows, you can confirm whether traffic is being sent, received, or dropped at any point in the path.</p><p>By following these steps, you can systematically identify where the problem lies and apply the right fix. In the next section, I’ll walk through a few common issues and how they can be resolved. Keep in mind that solutions may vary depending on the specific environment and situation in which the problem occurs.</p><h3>Common Network Scenarios &amp; Solutions</h3><h4>Scenario 1: IP Conflict Issues</h4><p><strong>Symptoms:</strong></p><ul><li>“Connection refused” errors</li><li>Local routing points to unexpected interfaces (ip route get)</li></ul><p><strong>Description:</strong><br>IP conflicts occur when multiple devices share the same IP address, leading to unpredictable routing behaviour and dropped connections. A similar issue can also occur due to incorrect subnet configurations. Carefully reviewing the interface and routing configuration often reveals the cause.</p><pre>## Diagnosis Commands:<br>ip addr show | grep &lt;target_ip&gt;      # Check if IP exists on multiple interfaces<br>ip route get &lt;target_ip&gt;             # Display routing path for target IP<br>arp -a                               # Check ARP table for duplicate MACs<br><br>## Solution:<br>ip addr del &lt;conflicting_ip&gt;         # Remove duplicate/conflicting IP<br>ip addr del &lt;conflicting_ip&gt;/&lt;mask&gt; dev &lt;interface&gt;    # Remove duplicate/conflicting IP</pre><h4>Scenario 2: Routing Problems</h4><p><strong>Symptoms:</strong></p><ul><li>“Connection timed out”</li><li>Asymmetric routing (traffic goes out one path and returns through another)</li></ul><p><strong>Description:</strong><br>Incorrect or missing routes can cause timeouts or unreachable hosts, especially when routing tables are not updated after network changes or when gateways are misconfigured.</p><pre>## Diagnosis<br>route -n                        # Display routing table<br>ip route get &lt;destination&gt;      # Check specific route<br>traceroute &lt;destination&gt;        # Trace network path<br>ping -I &lt;interface&gt; &lt;target_ip&gt; # Test connectivity via specific interface<br><br>## Solutions<br>ip route add &lt;network&gt; via &lt;gateway&gt; dev &lt;interface&gt;<br>ip route add &lt;network&gt;/&lt;mask&gt; via &lt;gateway&gt; dev &lt;interface&gt;</pre><h4>Scenario 3: Firewall Blocks</h4><p><strong>Symptoms:</strong></p><ul><li>“Connection timed out” or “Connection refused”</li><li>Ports appear closed despite services running</li></ul><p><strong>Description:</strong><br>Firewalls (local or network) can silently block incoming or outgoing traffic, preventing connectivity even when services are active.</p><pre>## Diagnosis<br>iptables -L -v -n                   # View current rules<br>firewall-cmd --list-all             # Check active zone rules (Firewalld)<br>systemctl status firewall.service   # Check Firewall status<br>systemctl status firewalld          # Check Firewalld status<br>systemctl status nftables           # Check nftables status<br><br>## Temporary test(Flush Rules)<br>iptables -F      # Flush all firewall rules temporarily<br># If it works, add specific rules<br><br>## Disabled firewall<br>systemctl stop firewall.service<br>systemctl stop firewalld<br>systemctl stop nftables<br><br>## Permanent Firewall Configuration<br># INPUT chain - Handles traffic destined for the server itself. <br>iptables -A INPUT -s &lt;source&gt; -p tcp --dport &lt;port&gt; -j ACCEPT <br><br># FORWARD chain - Handles traffic passing through the server to another host. <br>iptables -A FORWARD -s &lt;source&gt; -d &lt;destination&gt; -p tcp --dport &lt;port&gt; -j ACCEPT <br><br># OUTPUT chain - Usually allowed by default, but if restricted, ensure the server can reply <br>iptables -A OUTPUT -d &lt;destination&gt; -p tcp --sport &lt;port&gt; -j ACCEPT</pre><h4>Scenario 4: Service Not Listening</h4><p><strong>Symptoms:</strong></p><ul><li>“Connection refused”</li><li>Service port closed even though the application seems to be running</li></ul><p><strong>Description:</strong><br>This occurs when a service is not bound to the correct interface or port, or when the process has crashed.</p><pre>## Check remote service<br>ssh &lt;remote_host&gt; &quot;netstat -tlnp | grep &lt;port&gt;&quot;<br>ssh &lt;remote_host&gt; &quot;systemctl status &lt;service&gt;&quot;<br><br>## Check local binding<br>netstat -tlnp | grep &lt;port&gt;<br>ss -tlnp | grep &lt;port&gt;<br><br>## Validate service startup errors<br>journalctl -u &lt;service&gt; --no-pager | tail -20<br><br>## Solution<br># Ensure the service is configured to listen on the correct IP/interface<br># Restart the service after correction<br>systemctl restart &lt;service&gt;</pre><h4>Scenario 5: DNS Issues</h4><p><strong>Symptoms:</strong></p><ul><li>“Name or service not known”</li><li>“Temporary failure in name resolution”</li></ul><p><strong>Description:</strong><br>Improper or unreachable DNS servers can prevent hostname resolution, affecting connections across applications.</p><pre>## Diagnosis<br>nslookup &lt;hostname&gt;<br>dig &lt;hostname&gt;<br>host &lt;hostname&gt;<br><br>## Check DNS config<br>cat /etc/resolv.conf<br>cat /etc/hosts</pre><h3>Scenario 6: SELinux Blocks</h3><p><strong>Symptoms:</strong></p><ul><li>“Connection refused” even when ports and the firewall are open</li></ul><p><strong>Description:</strong><br>SELinux can enforce policies that restrict network access, blocking service operations silently unless configured properly.</p><pre>## Check SELinux status<br>sestatus<br>getenforce<br><br>## Check SELinux logs<br>grep denied /var/log/audit/audit.log<br><br>## Temporary test<br>setenforce 0  # Set SELinux to permissive mode<br># If it works, adjust SELinux policies<br><br>## Permanent fix<br>vim /etc/sysconf/selinux<br># Check the SELinux status if it&#39;s enforced or disabled, then modify the line:<br>SELINUX=disabled</pre><h3>Real-World Case Studies</h3><p>I wanted to share a few examples to give you a better understanding of the issue. These are sample cases for reference.</p><p><strong>Case Study 1: IP Conflict Resolution</strong><br><em>Problem: </em>Application couldn’t connect to the database (&lt;IP_Address&gt;:3306)<br><em>Symptoms:</em> “Connection refused” errors, local services functioned normally, but database access failed<br><em>Root Cause:</em> The Target database IP was assigned as a secondary IP on the source server<br><em>Solution:</em> Removing conflicting IP assignment<br><em>Lesson:</em> Always check ip addr show and ip route get for local IP conflicts</p><p><strong>Case Study 2: Asymmetric Routing</strong><br><em>Problem:</em> Connections worked one way but not the other<br><em>Symptoms:</em> Intermittent timeouts, some services were reachable while others were not<br><em>Root Cause:</em> Multiple default gateways are causing asymmetric routing<br><em>Solution:</em> Added specific routes and removed redundant default gateways<br><em>Lesson:</em> Avoid multiple default gateways without policy routing</p><p><strong>Case Study 3: Docker Network Isolation</strong><br><em>Problem:</em> Container couldn’t reach the external database<br><em>Symptoms:</em> Connection timed out from containers only, the host machine could connect normally, logs indicated packets were blocked at the Docker bridge<br><em>Root Cause:</em> Docker bridge network isolation<br><em>Solution: </em>Used — network host or configured Docker networking properly<br><em>Lesson:</em> Understand container networking models</p><p><strong>Case Study 4: SELinux Database Connections</strong><br><em>Problem:</em> Database connections blocked despite open ports<br><em>Symptoms:</em> Connection refused, service logs showed permission denied<br><em>Root Cause:</em> SELinux is preventing network connections<br><em>Solution:</em> Adjusted SELinux policies or set appropriate contexts<br><em>Lesson:</em> Always check SELinux when everything else seems correct</p><h3>Prevention &amp; Best Practices</h3><p>Preventing network issues is often more effective than troubleshooting them after they occur. By implementing proactive measures, maintaining proper documentation, and following change management processes, you can reduce downtime and simplify troubleshooting.</p><h4>1. Proactive Monitoring</h4><p>Regular monitoring helps detect potential network problems before they impact services:</p><ul><li><strong>Connectivity checks:</strong> Continuously test server-to-server communication using ping, TCP port checks, or dedicated monitoring tools like Nagios, Zabbix, or Prometheus.</li><li><strong>Port availability monitoring:</strong> Scan critical service ports regularly to ensure they are open and reachable.</li><li><strong>DNS health checks:</strong> Monitor DNS resolution for key services to avoid failures due to misconfigured records or DNS outages.</li><li><strong>Routing table validation:</strong> Use automated scripts to verify that critical routes and gateways are correctly configured.</li></ul><h4>2. Documentation Standards</h4><p>Accurate documentation simplifies troubleshooting and reduces errors when making changes:</p><ul><li>Maintain up-to-date IP address allocation records for all servers and network devices.</li><li>Document network topology, including VLANs, subnets, and firewall rules.</li><li>Keep service-port mappings current so you know which ports must be open for specific applications.</li><li>Record standard troubleshooting procedures, including common commands and escalation paths.</li></ul><h4>3. Change Management</h4><p>Properly managing network changes ensures stability and reduces unexpected issues:</p><ul><li><strong>Review changes:</strong> Ensure any modifications to routing, firewall rules, or service configurations are peer-reviewed before implementation.</li><li><strong>Test connectivity:</strong> Validate that services are reachable after any network or server changes.</li><li><strong>Rollback plans:</strong> Maintain clear rollback procedures to revert configurations if the change causes disruptions.</li></ul><h3>Common Pitfalls to Avoid</h3><p>Even experienced engineers can make mistakes when troubleshooting or configuring networks. It’s human nature to occasionally take the wrong approach. Being aware of common errors can help prevent them. Some of these common mistakes are listed below:</p><ul><li><strong>Assuming the network is the problem:</strong> Always verify local system configurations, firewall rules, and services before blaming the network.</li><li><strong>Ignoring both perspectives:</strong> Check connectivity from both source and destination servers — many issues are asymmetric.</li><li><strong>Overlooking DNS issues:</strong> Many “host unreachable” errors are actually caused by misconfigured DNS or stale /etc/hosts entries.</li><li><strong>Forgetting container or virtualisation layers:</strong> Containers, VMs, and cloud environments often introduce additional networking layers that must be considered.</li><li><strong>Neglecting kernel parameters and system limits:</strong> Maximum socket connections, open file limits, and network buffer sizes can impact connectivity under load.</li></ul><h3>Final Thoughts</h3><p>Troubleshooting is like detective work; the key is to <strong>start simple and go layer by layer</strong>. Even a small misconfiguration, like an incorrect IP route, can cause hours of downtime.</p><p>I hope this guide helps you build a systematic troubleshooting mindset. If you’ve faced similar issues or have your own debugging techniques, please share them in the comments. Let’s share our knowledge and learn together!</p><p>IP conflicts occur when multiple devices share the same IP address, leading to unpredictable routing behavior and dropped connections. A similar issue can also occur due to incorrect subnet configurations. Carefully reviewing the interface and routing configuration often reveals the cause.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1a8e2e6d09d5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a Robust CI/CD Security Pipeline with Open Source Tools]]></title>
            <link>https://medium.com/@luminde9958/building-a-robust-ci-cd-security-pipeline-with-open-source-tools-afe76fdcbaa8?source=rss-5661f1d6061d------2</link>
            <guid isPermaLink="false">https://medium.com/p/afe76fdcbaa8</guid>
            <dc:creator><![CDATA[Lumin De Silva]]></dc:creator>
            <pubDate>Wed, 04 Jun 2025 18:51:15 GMT</pubDate>
            <atom:updated>2025-06-04T19:05:06.254Z</atom:updated>
            <content:encoded><![CDATA[<p>In today’s fast-paced software development landscape, DevSecOps has transitioned from being optional to essential. Integrating security tools directly into your CI/CD pipelines ensures vulnerabilities are detected early and consistently throughout your development process.</p><p>As mentioned in my previous post, today I will walk you through how to implement a robust security pipeline using GitLab CI/CD. This pipeline leverages both SAST (Static Application Security Testing) and SCA (Software Composition Analysis) tools — specifically Bearer, Semgrep, Trivy, Gitleaks, KICS — with centralized reporting via DefectDojo. These tools were selected based on extensive R&amp;D and practical suitability, not sponsorship. If you’re aware of better alternatives, I welcome your input in the comments.</p><h3><strong>Key Considerations in Secure Development</strong></h3><p>Security must shift left, meaning it should be integrated at the earliest stages of development. Relying solely on post-release penetration testing or audits is no longer sufficient.</p><p>As a developer, while your focus is on delivering features and fixing bugs, ignoring security can lead to:</p><ul><li>Data breaches</li><li>Regulatory violations (e.g., GDPR, HIPAA)</li><li>Loss of customer trust</li><li>Expensive emergency fixes</li></ul><p>Key security concerns during development include:</p><ul><li>Hardcoded secrets and credentials</li><li>Mishandling sensitive or personal data</li><li>Use of vulnerable third-party dependencies</li><li>Misconfigured infrastructure-as-code (IaC)</li><li>Unchecked inputs leading to injection attacks</li><li>Outdated or insecure libraries</li></ul><p>This pipeline aims to proactively address these challenges using open source, best-in-class tools.</p><h3><strong>Where SAST and SCA Are Used in the Pipeline</strong></h3><p>Our CI/CD pipeline integrates both SAST and SCA tools at multiple stages:</p><ul><li><strong>SAST (Static Application Security Testing):</strong> Analyzes your application’s source code, configuration files, and IaC scripts for vulnerabilities before execution.</li><li><strong>SCA (Software Composition Analysis):</strong> Detects known vulnerabilities in third-party and open-source dependencies.</li></ul><p>By leveraging both:</p><ul><li><strong>SAST protects</strong> your custom application and infrastructure code.</li><li><strong>SCA protects</strong> the third-party components your code depends on.</li></ul><p>This layered defense ensures that your application is built securely , both in terms of your code and your dependencies.</p><h3>CI/CD Configuration</h3><p>While there are various CI/CD platforms, such as GitHub Actions and Jenkins, this guide uses <strong>GitLab CI/CD</strong>.</p><p>At the core of this security pipeline is a <em>.gitlab-ci.yml</em> configuration file. The pipeline runs in clearly defined stages, each executing a specific security tool. This enables fully automated security checks on every push or merge.</p><h3>Why These Specific Tools?</h3><p>All tools used in this pipeline are open source and recognized by the DevSecOps community:</p><ul><li><strong>Bearer (SAST)</strong> — Detects improper handling of sensitive data (e.g., PII, health info).</li><li><em>Why?</em> Ensures compliance and early identification of privacy risks.</li><li><em>License:</em> MIT</li><li><strong>Semgrep (SAST)</strong> — Customizable static code analysis for detecting insecure code patterns.</li><li><em>Why?</em> Fast, extensible, and effective at catching common coding mistakes.</li><li><em>License:</em> LGPL-2.1</li><li><strong>Trivy (SCA)</strong> — Scans dependencies and container images for known CVEs.</li><li><em>Why?</em> Lightweight, supports many ecosystems, ideal for CI/CD.</li><li><em>License:</em> Apache 2.0</li><li><strong>Gitleaks (SAST)</strong> — Detects hardcoded secrets in source and Git history.</li><li><em>Why?</em> Prevents credential leaks before code reaches production.</li><li><em>License:</em> MIT</li><li><strong>KICS (SAST for IaC)</strong> — Scans infrastructure code like Terraform, Kubernetes, and CloudFormation.</li><li><em>Why?</em> Detects cloud misconfigurations before deployment.</li><li><em>License:</em> BSD-3-Clause</li></ul><h3>What Makes This Pipeline Balanced?</h3><ul><li><strong>Comprehensive coverage</strong>: It scans custom code, third-party packages, secrets, and infrastructure.</li><li><strong>Low friction</strong>: CLI-based tools easily integrate into any CI/CD process.</li><li><strong>Customizable</strong>: Tools like Semgrep and Bearer support custom rules.</li><li><strong>Centralized management</strong>: DefectDojo collects all scan results for easy triage and tracking.</li></ul><blockquote>The only optional addition might be <strong>DAST (Dynamic Application Security Testing)</strong> using tools like OWASP ZAP. However, DAST is typically more relevant in staging or runtime environments.</blockquote><h3>Coverage Across Key Security Areas</h3><ul><li><strong>Static Code Analysis (SAST)</strong> — Bearer, Semgrep, KICS</li><li><strong>Secrets Detection</strong> — Gitleaks</li><li><strong>Infrastructure as Code Security</strong> — KICS</li><li><strong>Dependency Vulnerabilities (SCA)</strong> — Trivy</li><li><strong>Data Privacy Risk Analysis</strong> — Bearer</li></ul><h3><strong>Centralized Vulnerability Management</strong></h3><p>Managing findings across multiple tools can be overwhelming. To streamline this, scan results are uploaded to <strong>DefectDojo</strong>, an open-source vulnerability management platform.</p><p>This creates a single pane of glass for security teams, allowing for:</p><ul><li>Visibility across projects</li><li>Triage and remediation tracking</li><li>Reporting and metrics</li></ul><p>Other open source alternatives include:</p><ul><li><strong>Faros Community Edition</strong></li><li><strong>Vulncode-DB</strong></li><li><strong>Security Dashboard in GitLab Ultimate (if available)</strong></li></ul><h3><strong>Pipeline Architecture</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aENGuvwNXDQ-DOKLgONURg.png" /><figcaption>CI/CD Security Pipeline with SAST, SCA, and Centralized Reporting</figcaption></figure><pre>stages:<br>  - bearer_scan<br>  - semgrep_scan<br>  - trivy_scan<br>  - gitleaks_scan<br>  - kics_scan<br>  - upload-results<br><br>variables:<br>  DEFECTDOJO_URL: &quot;URL&quot;<br>  DEFECTDOJO_API_KEY: &quot;API_KEY&quot;<br>  DEFECTDOJO_PRODUCT_ID: &quot;PRODUCT_ID&quot;<br>  TRIVY_CACHE_DIR: &quot;/tmp/trivy&quot;<br>  KICS_CACHE_DIR: &quot;/tmp/kics&quot;<br><br>image: ubuntu:latest<br><br>services:<br>  - name: docker:20.10.7-dind<br>    alias: docker<br><br><br><br><br><br># ----------------------------- BEARER SCAN -----------------------------<br><br>bearer_scan:<br>  stage: bearer_scan<br>  image:<br>    name: bearer/bearer<br>    entrypoint: [&quot;&quot;]<br>  script:<br>    - bearer scan . --format json --output bearer.json --debug || true<br>  artifacts:<br>    paths:<br>      - bearer.json<br><br><br><br># ----------------------------- SEMGREP SCAN -----------------------------<br><br>semgrep_scan:<br>  stage: semgrep_scan<br>  image: returntocorp/semgrep:latest  <br>  script:<br>    - echo &quot;Running Semgrep scan...&quot;<br>    - semgrep --config=p/security --output semgrep.json --json . || true  <br>  artifacts:<br>    paths:<br>      - semgrep.json<br><br>  <br># ----------------------------- TRIVY SCAN -----------------------------<br><br>trivy_scan:<br>  stage: trivy_scan<br>  image:<br>    name: aquasec/trivy:0.28.0<br>    entrypoint: [&quot;&quot;]<br>  before_script:<br>    - apk add --no-cache curl<br>  script:<br>    - set -x<br>    - trivy fs --format json --output trivy.json . || echo &quot;Trivy failed with exit code $?&quot;<br>  artifacts:<br>    paths:<br>      - trivy.json<br># ----------------------------- GITLEAKS SCAN -----------------------------<br><br>gitleaks_scan:<br>  stage: gitleaks_scan<br>  image:<br>    name: zricethezav/gitleaks<br>    entrypoint: [&quot;&quot;]<br>  script: <br>    - gitleaks detect --source . --verbose --report-path gitleaks.json || true<br>  artifacts:<br>    paths:<br>      - gitleaks.json<br><br><br># ----------------------------- KICS SCAN -----------------------------<br><br>kics_scan:<br>  stage: kics_scan<br>  image:<br>    name: checkmarx/kics:latest<br>    entrypoint: [&quot;&quot;]<br>  script:<br>    - kics scan --no-progress -p ${PWD} -o ${PWD} --report-formats json --output-name kics || echo &quot;KICS scan failed&quot;<br>  artifacts:<br>    paths:<br>      - kics.json<br><br># ----------------------------- UPLOAD RESULTS -----------------------------<br><br>security_scan_upload:<br>  stage: upload-results<br>  image: python:3.9<br>  before_script:<br>    - python3 -m venv venv<br>    - source venv/bin/activate<br>    - pip install requests<br>  script:<br>    - source venv/bin/activate<br>    - |<br>      python3 &lt;&lt;EOF<br>      import os<br>      import requests<br><br>      DEFECTDOJO_URL = os.getenv(&quot;DEFECTDOJO_URL&quot;)<br>      DEFECTDOJO_API_KEY = os.getenv(&quot;DEFECTDOJO_API_KEY&quot;).replace(&quot;Token &quot;, &quot;&quot;).strip()<br>      DEFECTDOJO_PRODUCT_ID = os.getenv(&quot;DEFECTDOJO_PRODUCT_ID&quot;)<br><br>      if not DEFECTDOJO_URL or not DEFECTDOJO_API_KEY or not DEFECTDOJO_PRODUCT_ID:<br>          print(&quot;Missing required environment variables&quot;)<br>          exit(1)<br><br>      ENGAGEMENT_NAME = &quot;Engagement Name&quot;<br>      PRODUCT_NAME = &quot;Product/Folder Name&quot;<br>      UPLOAD_URL = f&quot;{DEFECTDOJO_URL}/api/v2/import-scan/&quot;<br>      HEADERS = {<br>          &quot;Authorization&quot;: f&quot;Token {DEFECTDOJO_API_KEY}&quot;,<br>      }<br><br>      # Check if engagement exists<br>      engagement_url = f&quot;{DEFECTDOJO_URL}/api/v2/engagements/?product={DEFECTDOJO_PRODUCT_ID}&quot;<br>      engagement_response = requests.get(engagement_url, headers=HEADERS)<br><br>      if engagement_response.ok:<br>          engagements = engagement_response.json()[&#39;results&#39;]<br>          engagement_found = any(e[&#39;name&#39;] == ENGAGEMENT_NAME for e in engagements)<br><br>          if not engagement_found:<br>              print(f&quot;Engagement &#39;{ENGAGEMENT_NAME}&#39; does not exist under product &#39;{PRODUCT_NAME}&#39;&quot;)<br>              exit(1)<br>      else:<br>          print(f&quot;Failed to fetch engagements: {engagement_response.status_code} - {engagement_response.text}&quot;)<br>          exit(1)<br><br>      # Map scan files to DefectDojo scan types<br>      scan_files = {<br>          &quot;bearer.json&quot;: &quot;Bearer CLI&quot;,<br>          &quot;semgrep.json&quot;: &quot;Semgrep JSON Report&quot;,<br>          &quot;trivy.json&quot;: &quot;Trivy Scan&quot;,<br>          &quot;gitleaks.json&quot;: &quot;Gitleaks Scan&quot;,<br>          &quot;kics.json&quot;: &quot;KICS Scan&quot;<br>      }<br><br>      for file_name, scan_type in scan_files.items():<br>          if os.path.exists(file_name):<br>              print(f&quot;Uploading {file_name} ({scan_type}) to DefectDojo...&quot;)<br><br>              with open(file_name, &quot;rb&quot;) as file:<br>                  files = {&quot;file&quot;: file}<br>                  data = {<br>                      &quot;scan_type&quot;: scan_type,<br>                      &quot;product_type&quot;: &quot;Internal&quot;,<br>                      &quot;product&quot;: DEFECTDOJO_PRODUCT_ID,<br>                      &quot;product_name&quot;: PRODUCT_NAME,<br>                      &quot;engagement_name&quot;: ENGAGEMENT_NAME,<br>                      &quot;test_title&quot;: f&quot;{scan_type} Results&quot;,<br>                      &quot;active&quot;: True,<br>                      &quot;verified&quot;: True<br>                  }<br><br>                  response = requests.post(UPLOAD_URL, headers=HEADERS, files=files, data=data)<br><br>                  if response.ok:<br>                      print(f&quot;{file_name} uploaded successfully: {response.json()}&quot;)<br>                  else:<br>                      print(f&quot;Failed to upload {file_name}: {response.status_code} - {response.text}&quot;)<br>          else:<br>              print(f&quot;{file_name} not found, skipping upload.&quot;)<br><br>      EOF</pre><p>The pipeline is composed of the following stages:</p><ol><li><strong>Bearer Scan</strong></li><li><strong>Semgrep Scan</strong></li><li><strong>Trivy Scan</strong></li><li><strong>Gitleaks Scan</strong></li><li><strong>KICS Scan</strong></li><li><strong>Upload Results to DefectDojo</strong></li></ol><p>Each tool is containerized and run using an official or trusted Docker image. The pipeline uses Docker-in-Docker (DIND) to allow tools like Trivy to scan container images. Each tool outputs its findings in JSON format, stored as artifacts for later upload.</p><p>The pipeline ensures all tools execute independently, using ‘|| true’ to prevent early termination if vulnerabilities are found. This guarantees:</p><ul><li>All tools run regardless of failures</li><li>Scan results are available for complete analysis</li></ul><p>The final stage runs a Python script to:</p><ul><li>Check for existing engagements in DefectDojo</li><li>Upload reports tagged with appropriate scan types</li></ul><p>This architecture ensures a modular, scalable, and resilient security pipeline.</p><h3><strong>Summary</strong></h3><p>This GitLab-based CI/CD security pipeline integrates a powerful suite of open source tools to protect your application, dependencies, secrets, and infrastructure. By automating security scans and centralizing results:</p><ul><li><strong>Developers get immediate feedback</strong> without leaving their workflow</li><li><strong>Security teams gain visibility and control</strong> via DefectDojo</li><li><strong>Organizations reduce risk</strong> by catching vulnerabilities early</li></ul><p>The pipeline is easily extensible and adaptable. Future enhancements could include DAST tools, policy-as-code, or integration into ticketing systems.</p><p>Security should never be an afterthought. With this pipeline, you’re making it an integrated part of the development lifecycle.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=afe76fdcbaa8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding SAST, DAST, and SCA: The Core of Modern Application Security]]></title>
            <link>https://medium.com/@luminde9958/understanding-sast-dast-and-sca-the-core-of-modern-application-security-d39245a4097f?source=rss-5661f1d6061d------2</link>
            <guid isPermaLink="false">https://medium.com/p/d39245a4097f</guid>
            <dc:creator><![CDATA[Lumin De Silva]]></dc:creator>
            <pubDate>Sun, 25 May 2025 17:16:29 GMT</pubDate>
            <atom:updated>2025-05-25T17:53:59.370Z</atom:updated>
            <content:encoded><![CDATA[<p>In the fast-paced world of DevSecOps, acronyms like SAST, DAST, and SCA are frequently tossed around. But what do they mean — and why are they essential for secure software development?</p><p>As modern applications grow in complexity and security threats evolve in sophistication, securing software throughout its development lifecycle has never been more critical. Static Application Security Testing (SAST), Dynamic Application Security Testing (DAST), and Software Composition Analysis (SCA) form the foundation of a strong application security strategy. Each technique serves a distinct purpose and plays a critical role in delivering secure, resilient applications.</p><h3><strong>What is SAST?</strong></h3><blockquote>Static Application Security Testing (SAST) is a white-box testing method that analyzes an application’s source code, bytecode, or binaries for vulnerabilities without executing the program. It helps identify security flaws early in the Software Development Lifecycle (SDLC), often during the coding phase, allowing developers to address issues before they propagate to later stages.</blockquote><h3>How SAST Works</h3><p>SAST analyzes code while it is inactive, making it suitable for early integration into development pipelines. Since it doesn’t require a working application, developers can receive real-time feedback and fix issues during active development. These tools are capable of scanning millions of lines of code, identifying critical vulnerabilities such as:</p><ul><li>SQL Injection</li><li>Cross-Site Scripting (XSS)</li><li>Buffer overflows</li><li>Insecure deserialization</li></ul><h3>Key Steps to Implementing SAST</h3><ol><li><strong>Tool Selection </strong>— Choose a tool that supports the programming languages in use.</li><li><strong>Infrastructure</strong> — Configure servers, license management, and access control.</li><li><strong>Tool Customization</strong> — Fine-tune rulesets to reduce false positives.</li><li><strong>Application Onboarding</strong> — Prioritize and onboard critical applications for scanning.</li><li><strong>Scan &amp; Triage</strong> — Analyze scan results, filter out false positives, and assign valid issues for remediation.</li><li><strong>Training &amp; Governance</strong> — Educate development teams and enforce policies for secure coding practices.</li></ol><h3>Why SAST Matters</h3><p>The ability to scan code before deployment gives organizations an edge over attackers. SAST improves overall code quality and security by detecting vulnerabilities early. Moreover, it enables full codebase coverage — something impractical with manual reviews alone — ensuring consistent, automated security validation.</p><h3>What is DAST?</h3><blockquote>Dynamic Application Security Testing (DAST) is a black-box testing method that analyzes applications in their running state. Unlike SAST, DAST does not access the internal workings of the application — it interacts with the application externally, simulating attacks to identify exploitable vulnerabilities.</blockquote><h3>How DAST Works</h3><p>DAST tools test applications just as an attacker would: from the outside in. These tools simulate real-world attack scenarios, such as SQL injection or XSS, while monitoring the application’s behavior and responses. Because DAST requires a running application, it’s typically performed later in the SDLC, often during staging or production testing.</p><h3>Key Steps in Running DAST</h3><ol><li><strong>Define Scope:</strong> Identify which applications, APIs, and endpoints to test.</li><li><strong>Crawl and Discover</strong>: Map application structure and entry points.</li><li><strong>Simulate Attacks:</strong> Use prebuilt and custom test payloads to probe for vulnerabilities.</li><li><strong>Analyze Behavior:</strong> Evaluate how the application handles unexpected or malicious inputs.</li><li><strong>Generate Reports:</strong> Document vulnerabilities, their severity, and recommended remediations.</li><li><strong>CI/CD Integration:</strong> Automate DAST scans as part of release pipelines.</li><li><strong>Authentication Setup:</strong> Ensure secure areas of the application are also tested.</li><li><strong>Baseline Scanning:</strong> Establish a security benchmark for ongoing monitoring.</li><li><strong>Compliance Reporting:</strong> Produce audit-ready reports for standards like PCI-DSS, HIPAA, or ISO 27001.</li></ol><h3>Why DAST Matters</h3><p>As applications increasingly operate in distributed, cloud-native environments, their attack surfaces grow. DAST provides critical insight into how applications behave under attack in real time — an essential component of identifying vulnerabilities missed during development.</p><p>It helps mitigate risks arising from:</p><ul><li>Legacy code with dwindling institutional knowledge</li><li>Third-party dependencies</li><li>Microservices and serverless architecture</li><li>Rapid DevOps-driven deployment cycles</li></ul><p>DAST enables teams to remediate exploitable vulnerabilities before attackers can leverage them in production environments.</p><h3>SAST vs DAST</h3><pre>| Feature                                        | SAST (Static Application Security Testing)                       | DAST (Dynamic Application Security Testing)                      |<br>|------------------------------------------------|------------------------------------------------------------------|------------------------------------------------------------------|<br>| Type of Testing                                | White-box security testing                                       | Black-box security testing                                       |<br>| Tester&#39;s Knowledge                             | Has access to framework, design, and implementation              | No knowledge of underlying technologies                          |<br>| Application Requirement                        | Requires source code                                             | Requires a running application                                   |<br>| When Vulnerabilities Are Found                 | Earlier in the SDLC                                              | Toward the end of the SDLC                                       |<br>| Cost to Fix Vulnerabilities                    | Less expensive, can be fixed early                               | More expensive, may need emergency fix                           |<br>| Run-time Issue Detection                       | Cannot discover run-time or environment-related issues           | Can discover run-time and environment-related issues             |<br>| Supported Software Types                       | Supports web apps, services, thick clients                       | Typically only web apps and services                             |<br>| Ideal Use                                      | Catches issues early, developer-focused                          | Finds issues in real-world usage, hacker-focused                 |<br>| Summary                                        | Complements DAST for comprehensive testing                       | Complements SAST for comprehensive testing                       |</pre><p>The above table is derived from the original BlackDuck infographic (also included below for reference) to make the comparison between SAST and DAST easier to read.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/850/1*04Zbp70uHJmKS6DpLrynHQ.jpeg" /><figcaption><strong>Extracted from </strong><a href="https://www.blackduck.com/glossary/what-is-sast.html"><strong>BlackDuck</strong></a><strong> website</strong></figcaption></figure><h3><strong>What about IAST?</strong></h3><blockquote>IAST (Interactive Application Security Testing) combines aspects of both SAST and DAST by analyzing code while the application runs. It’s powerful but more complex to set up, and typically used in more advanced environments.</blockquote><p><em>I’ll cover this in a future post!</em></p><h3><strong>What is SCA?</strong></h3><blockquote>Software Composition Analysis (SCA) identifies open source components within a codebase, helping organizations evaluate their security, license compliance, and quality. SCA is a vital process, given the widespread use of third-party libraries in modern development.</blockquote><h3>How SCA Works</h3><p>SCA tools examine package managers, manifest files, source code, binaries, container images, and more to generate a Software Bill of Materials (SBOM). This SBOM is compared against vulnerability databases such as the National Vulnerability Database (NVD) to identify known issues. Many SCA tools also detect license risks (e.g., GPL, MIT, Apache) and evaluate code hygiene.</p><h3>Integrating SCA into Development</h3><ol><li><strong>Developer Awareness:</strong> Use IDE plugins to notify developers of risks as they add dependencies.</li><li><strong>Pre-commit Checks:</strong> Block vulnerable or non-compliant packages before code merges.</li><li><strong>CI/CD Enforcement: </strong>Prevent deployment of builds that fail SCA criteria.</li><li><strong>Vulnerability Prioritization:</strong> Rank risks based on CVSS score, usage, and exposure.</li><li><strong>License Management:</strong> Group licenses by organizational policy (e.g., allowed, conditional, or banned).</li><li><strong>Security Team Visibility:</strong> Provide dashboards and reports for audit and oversight.</li></ol><h3>Why SCA Matters</h3><p>Manual tracking of open source is infeasible given its scale and complexity. SCA enables fast, automated analysis of third-party code, allowing development to move at the speed of DevOps while maintaining visibility into risk. It also ensures legal and security compliance, preventing costly licensing or breach issues down the line.</p><h3>How SAST, DAST, and SCA Work Together</h3><p>These three methodologies are not standalone — they are complementary and most effective when used together:</p><ul><li><strong>SAST:</strong> Secures your code during development</li><li><strong>SCA:</strong> Secures the third-party components you integrate</li><li><strong>DAST: </strong>Secures the running application in real-world scenarios</li></ul><pre>┌────────────────────┐<br>│     SAST           │  ← : Secure the code you write<br>├────────────────────┤<br>│     SCA            │  ← : Secure the code you depend on<br>├────────────────────┤<br>│     DAST           │  ← : Secure the app <br>└────────────────────┘</pre><p><strong><em>A Simple Analogy:</em></strong></p><blockquote>Building an application is like constructing a house:</blockquote><blockquote>- SAST checks your blueprints for design flaws.</blockquote><blockquote>- SCA inspects the building materials (e.g., wood, bricks) for quality and defects.</blockquote><blockquote>- DAST walks through the finished house, checking for weak doors, windows, or hidden leaks.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gxXNOqR2mhCr66pDtAAdlw.png" /></figure><p>Together, SAST, DAST, and SCA provide full-spectrum coverage across the software development lifecycle. They help teams build with confidence, ship securely, and respond quickly to evolving threats.</p><h3>What’s Next?</h3><p>In the next post, I’ll walk you through building a practical CI/CD security pipeline that integrates SAST and SCA using tools like Bearer, Semgrep, Trivy, Gitleaks, and KICS — all tied together with centralized results management.</p><h3>References &amp; Further Reading</h3><p><a href="https://www.blackduck.com/glossary/what-is-sast.html">Static Application Security Testing</a></p><p><a href="https://www.techtarget.com/searchsoftwarequality/definition/static-application-security-testing-SAST">What is static application security testing (SAST)?</a></p><p><a href="https://www.blackduck.com/glossary/what-is-dast.html#:~:text=Definition,visibility%20into%20the%20source%20program.">Dynamic Application Security Testing (DAST)</a></p><p><a href="https://www.paloaltonetworks.com/cyberpedia/what-is-sca">What is SCA?</a></p><p><a href="https://www.blackduck.com/glossary/what-is-software-composition-analysis.html">What is software composition analysis (SCA)?</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d39245a4097f" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>