<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>Coder Legion - Recent posts tagged sast</title>
<link>https://coderlegion.com/tag/sast</link>
<description>Powered by Question2Answer</description>
<item>
<title>Catch vulnerabilities before they ship: local SonarQube setup (Part 2)</title>
<link>https://coderlegion.com/9955/catch-vulnerabilities-before-they-ship-local-sonarqube-setup-part-2</link>
<description>&lt;p&gt; &lt;/p&gt;
&lt;h3 id=&quot;introduction&quot;&gt;&lt;strong&gt;Introduction&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;Static Application Security Testing (&lt;strong&gt;SAST&lt;/strong&gt;) is a crucial practice within the Software Security Development Life Cycle (&lt;strong&gt;SSDLC&lt;/strong&gt;) that enables developers to identify security vulnerabilities early in the code development phase. While understanding the concepts of &lt;strong&gt;SAST&lt;/strong&gt; is important, implementing it effectively in real-world projects is what ensures robust and secure software delivery.&lt;/p&gt;
&lt;p&gt;In this second part of our &lt;strong&gt;SAST&lt;/strong&gt; series, we focus on integrating the  &lt;strong&gt;SonarQube Cloud&lt;/strong&gt;, a popular static analysis tool, into the IntelliJ IDEA and running it using Docker. &lt;/p&gt;
&lt;p&gt;We will explore:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;SonarQube Cloud for SAST&lt;/li&gt;
&lt;li&gt;Local scanning with SonarQube Cloud via IntelliJ IDEA&lt;/li&gt;
&lt;li&gt;Local scanning using Docker Compose with SonarQube image&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Tools:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;SonarQube Cloud&lt;/li&gt;
&lt;li&gt;Spring Boot&lt;/li&gt;
&lt;li&gt;IntelliJ IDEA&lt;/li&gt;
&lt;li&gt;Docker-Compose&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Prerequisites:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Create a Spring Boot project using IntelliJ IDEA or the Spring Boot Initializr at &lt;a rel=&quot;nofollow&quot; href=&quot;https://start.spring.io&quot;&gt;https://start.spring.io&lt;/a&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Click &lt;strong&gt;Next&lt;/strong&gt; and generate the project without dependencies.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&quot;https://dev-to-uploads.s3.amazonaws.com/uploads/articles/c07bbpqat146eju2p876.png&quot; alt=&quot;New Spring Boot project in IntelliJ EDIA&quot;&gt;&lt;/p&gt;
&lt;p&gt; &lt;br&gt;
 &lt;/p&gt;
&lt;h3 id=&quot;sonarqube-cloud-for-sast&quot;&gt;SonarQube Cloud for SAST&lt;/h3&gt;
&lt;p&gt;SonarQube Cloud offers a hassle-free way to start static code analysis without managing your own infrastructure. It provides cloud-hosted scanning capabilities that analyze code quality, security vulnerabilities, bugs, and code smells.&lt;/p&gt;
&lt;p&gt; &lt;br&gt;
 &lt;/p&gt;
&lt;h4 id=&quot;setting-up-sonarqube-cloud&quot;&gt;Setting Up SonarQube Cloud&lt;/h4&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Create an account:&lt;/strong&gt; Visit SonarQube’s official website and sign up for a free or paid cloud account.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Create a new project:&lt;/strong&gt; Once logged in, create a new project by providing your repository details.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Generate an authentication token:&lt;/strong&gt; For integrating scanning tools, generate a security token from your account settings. We must store it in a secret place, like in the GitHub Actions environment or repository secret.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Configure project settings:&lt;/strong&gt; We need to set Quality Gates, SLAs, and rules according to our security policy. For a free account, we cannot create the Quality Gates; we must use the default one.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;SonarQube Cloud then becomes the central place to view detailed security reports and code quality metrics.&lt;/p&gt;
&lt;p&gt; &lt;br&gt;
 &lt;/p&gt;
&lt;h4 id=&quot;overview-of-sonarqube-s-cloud-capabilities-for-static-code-analysis&quot;&gt;Overview of SonarQube’s cloud capabilities for static code analysis&lt;/h4&gt;
&lt;p&gt; &lt;br&gt;
 &lt;/p&gt;
&lt;p&gt;SonarCloud is a fully managed SaaS platform for continuous static code analysis, designed to detect code quality issues, security vulnerabilities, and maintainability risks across modern software projects. It provides code coverage plugin integration that is used by 30+ different programming languages, including Java, Python, C#, JavaScript, TypeScript, and Go.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Capabilities&lt;/strong&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Cloud-hosted and fully managed:&lt;/strong&gt; SonarCloud removes the need for installation, hosting, or maintenance. This allows teams to focus solely on development and CI/CD pipelines. Use the cloud version if your company does not work under compliance regulations.&lt;/p&gt;
&lt;p&gt;SonarSource manages:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;uptime&lt;/li&gt;
&lt;li&gt;scaling&lt;/li&gt;
&lt;li&gt;rule updates&lt;/li&gt;
&lt;li&gt;language analyzers&lt;/li&gt;
&lt;li&gt;security patches&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Deep Static Code Analysis:&lt;/strong&gt; SonarCloud performs comprehensive static analysis across many dimensions:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Bug Detection. Identifies code paths that can lead to crashes, incorrect logic, or unintended behavior.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Security vulnerability detection. Finds CWE-based, OWASP-aligned issues such as:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;SQL Injection&lt;/li&gt;
&lt;li&gt;Path traversal&lt;/li&gt;
&lt;li&gt;Input validation issues&lt;/li&gt;
&lt;li&gt;Hardcoded secrets&lt;/li&gt;
&lt;li&gt;Command injection&lt;/li&gt;
&lt;li&gt;Code Smells. Flags maintainability issues, duplicated code, bad design, and anti-patterns.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Cognitive Complexity. Measures how difficult code is to understand and maintain.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Multi-language support. Supports 30+ languages, including Java, Python, JavaScript, TypeScript, Go, C#, Kotlin, PHP, Terraform, YAML, and more.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Seamless CI/CD integration&lt;/strong&gt;: SonarCloud integrates natively with:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p&gt;CI providers:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;GitHub Actions&lt;/li&gt;
&lt;li&gt;Azure Pipelines&lt;/li&gt;
&lt;li&gt;Bitbucket Pipelines&lt;/li&gt;
&lt;li&gt;GitLab CI&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Build tools: SonarQube provides integrations with build tools. For example, in our case, the Gradle Sonar plugin is used to run Sonar Scanner in the CI/CD pipeline.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Pull request and branch analysis:&lt;/strong&gt; SonarCloud performs inline analysis during PR reviews, preventing issues from reaching the main branch. The free plan does not support this.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Quality Gates:&lt;/strong&gt; A Quality Gate defines the rules that code must satisfy before being merged. If a PR &lt;span class=&quot;text-red-400 font-bold&quot;&gt;fails&lt;/span&gt; the Quality Gate, the CI pipeline can block the merge. Adding custom Quality Gates is not supported by the free plan.&lt;/p&gt;
&lt;p&gt; Default checks include:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;No new critical or blocker issues.&lt;/li&gt;
&lt;li&gt;Code coverage must meet a minimum threshold.&lt;/li&gt;
&lt;li&gt;No new bugs or security vulnerabilities.&lt;/li&gt;
&lt;li&gt;No new code duplications.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Test coverage and code metrics:&lt;/strong&gt; SonarCloud provides overall coverage and new code coverage, for example, for a specific PR or branch.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Organization and project dashboards:&lt;/strong&gt; SonarCloud provides rich dashboards for:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Centralized issue tracking.&lt;/li&gt;
&lt;li&gt;Historical trend charts for issues, code coverage, and duplications.&lt;/li&gt;
&lt;li&gt;Hotspot security review.&lt;/li&gt;
&lt;li&gt;Code coverage progress.&lt;/li&gt;
&lt;li&gt;History of activities for each branch or PR.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Notifications and integrations:&lt;/strong&gt; Supports notifications via:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;GitHub checks.&lt;/li&gt;
&lt;li&gt;GitLab merge requests.&lt;/li&gt;
&lt;li&gt;Slack.&lt;/li&gt;
&lt;li&gt;Email.&lt;/li&gt;
&lt;li&gt;Webhooks.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Open APIs and extensions:&lt;/strong&gt; SonarQube provides APIs to build custom dashboards and export metrics.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt; &lt;br&gt;
 &lt;/p&gt;
&lt;h3 id=&quot;local-scanning-with-sonarqube-cloud-via-intellij-idea&quot;&gt;Local scanning with SonarQube Cloud via IntelliJ IDEA&lt;/h3&gt;
&lt;p&gt;Running local scans during development helps catch issues early before code is committed.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;h4 id=&quot;installing-and-configuring-the-sonarqube-plugin-in-intellij-idea&quot;&gt;Installing and configuring the SonarQube plugin in IntelliJ IDEA&lt;/h4&gt;
&lt;ol&gt;
&lt;li&gt;Open IntelliJ IDEA.&lt;/li&gt;
&lt;li&gt;Navigate to &lt;strong&gt;File &amp;gt; Settings &amp;gt; Plugins&lt;/strong&gt; and search for the &quot;SonarQube&quot; plugin.&lt;/li&gt;
&lt;li&gt;Install and restart the &lt;strong&gt;IDE&lt;/strong&gt;. It must appear in the &lt;strong&gt;“Installed”&lt;/strong&gt; section.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img src=&quot;https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s4jajteiwt0oi4e45myq.png&quot; alt=&quot;SonarQube plugin isntallation in IntelliJ&quot;&gt;&lt;/p&gt;
&lt;p&gt;  &lt;br&gt;
  &lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Generate the authentication Sonar token.&lt;br&gt;
Go to the SonarCloud website, then My Account &amp;gt; Security &amp;gt; Generate Token, or click on this link &lt;a rel=&quot;nofollow&quot; href=&quot;https://sonarcloud.io/account/security&quot;&gt;https://sonarcloud.io/account/security&lt;/a&gt;, and you will be redirected to the token generation page. Enter the name of the token, typically where you want to use it, and click the “Generate Token” button.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img src=&quot;https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vn7kh7osyq8ym6piv0bi.png&quot; alt=&quot;SonarQube cloud security tab&quot;&gt;&lt;/p&gt;
&lt;p&gt;  &lt;br&gt;
  &lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Configure the plugin by adding your SonarQube Cloud server URL and authentication token.&lt;br&gt;
Click on the SonarQube plugin icon, then select the gear icon, as shown in the screenshot.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img src=&quot;https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lu9tiko4omcb2h2znuq6.png&quot; alt=&quot;IntelliJ SonarQube plugin icon&quot;&gt;&lt;/p&gt;
&lt;p&gt; &lt;br&gt;
 &lt;/p&gt;
&lt;p&gt;Enter the Project key of your SonarQube project and click “Configure the connection”.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uasp34yysvftud0nzobz.png&quot; alt=&quot;IntelliJ SonarQube plugin configuration 1&quot;&gt;&lt;/p&gt;
&lt;p&gt; &lt;br&gt;
 &lt;/p&gt;
&lt;p&gt;You will see the Connection section, click the plus to add a new connection.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://dev-to-uploads.s3.amazonaws.com/uploads/articles/oie6px14di0ukwgt0iky.png&quot; alt=&quot;IntelliJ SonarQube plugin configuration 2&quot;&gt;&lt;/p&gt;
&lt;p&gt; &lt;br&gt;
 &lt;/p&gt;
&lt;p&gt;Enter the name of the connection and click “Next”.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mo5pf3m6y7lm5tlbpfb8.png&quot; alt=&quot;IntelliJ SonarQube plugin configuration 3&quot;&gt;&lt;/p&gt;
&lt;p&gt; &lt;br&gt;
 &lt;/p&gt;
&lt;p&gt;Paste the generated token, or you can even create the token from this IDE window. Click “Next”, and the IDE will attempt to connect to &lt;strong&gt;Sonar Cloud&lt;/strong&gt;. You will see that authentication is &lt;span class=&quot;text-green-400 font-bold&quot;&gt;successful&lt;/span&gt; if the connection is established.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bkoqzfpdoy1c6i3n3acb.png&quot; alt=&quot;IntelliJ SonarQube plugin configuration 4&quot;&gt;&lt;/p&gt;
&lt;p&gt; &lt;br&gt;
 &lt;/p&gt;
&lt;h4 id=&quot;running-local-scans&quot;&gt;Running local scans&lt;/h4&gt;
&lt;p&gt; &lt;br&gt;
 &lt;/p&gt;
&lt;p&gt;After configuration, you can run &lt;strong&gt;SonarQube&lt;/strong&gt; scans directly from the IDE. The plugin highlights issues inline and provides quick access to detailed analysis reports. Click &lt;strong&gt;“Analyze All Project Files”&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fx5gj8qn3g223sastwqm.png&quot; alt=&quot;IntelliJ SonarQube plugin analyze project 1&quot;&gt;&lt;/p&gt;
&lt;p&gt; &lt;br&gt;
 &lt;/p&gt;
&lt;p&gt;You can see the results. In this case, it found the token in the gradle-local.properties file, which is ignored by the &lt;strong&gt;.gitignore file&lt;/strong&gt;, and it is only for local purposes. However, you will still see it unless you exclude it from scanning. This plugin also allows you to do it.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ho72wkt45lsdk84kfxb5.png&quot; alt=&quot;IntelliJ SonarQube plugin analyze project 2&quot;&gt;&lt;/p&gt;
&lt;p&gt; &lt;br&gt;
 &lt;/p&gt;
&lt;p&gt;Below you can see the result of this specific finding. Additionally, the plugin provides information on why this issue occurs and how to resolve it.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1wijbjxq9o13918ts2vv.png&quot; alt=&quot;IntelliJ SonarQube plugin analyze project 3&quot;&gt;&lt;/p&gt;
&lt;p&gt; &lt;br&gt;
 &lt;/p&gt;
&lt;p&gt;Benefits of local scanning:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Immediate feedback on security and quality issues.&lt;/li&gt;
&lt;li&gt;Reduces the likelihood of pushing vulnerable code.&lt;/li&gt;
&lt;li&gt;Saves time by fixing problems early in the development workflow.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt; &lt;/p&gt;
&lt;h3 id=&quot;local-scanning-using-docker-compose-with-sonarqube-image&quot;&gt;Local scanning using Docker Compose with SonarQube image&lt;/h3&gt;
&lt;p&gt;If you prefer running SonarQube locally, Docker provides an easy setup that eliminates the need for complex installation.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;h4 id=&quot;setting-up-sonarqube-locally-via-docker-compose&quot;&gt;Setting up SonarQube locally via Docker Compose&lt;/h4&gt;
&lt;p&gt;Create a &lt;strong&gt;“docker-compose.yml”&lt;/strong&gt; file with the following content:&lt;/p&gt;
&lt;p&gt; &lt;br&gt;
 &lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-dockerfile&quot;&gt;    version: &quot;3.9&quot;
    
    
    services:
     sonarqube:
       image: sonarqube:latest
       ports:
         - &quot;9000:9000&quot;
       environment:
         SONAR_ES_BOOTSTRAP_CHECKS_DISABLE: &quot;true&quot;
       volumes:
         - sonarqube_data:/opt/sonarqube/data
         - sonarqube_extensions:/opt/sonarqube/extensions
    
    
    volumes:
     sonarqube_data:
     sonarqube_extensions:

&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt; &lt;br&gt;
 &lt;/p&gt;
&lt;p&gt;Here is the &lt;strong&gt;gradle-local.properties&lt;/strong&gt; file.&lt;/p&gt;
&lt;p&gt;Place it in the root of the project and add it to the &lt;strong&gt;.gitignore&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt; &lt;br&gt;
 &lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-properties&quot;&gt;    systemProp.sonar.qualitygate.wait=true
    
    
    sonar.projectKey=sonarqube_actions_demo_key
    sonar.organization=local-organization
    sonar.projectName=sonarqube_actions_demo
    sonar.token=sqp_b7dc6e025b58eb7455b11c6c468cda2b79eb6450b
    sonar.host.url=http://localhost:9000
    sonar.coverage.jacoco.xmlReportPaths=build/reports/jacoco/test/jacocoTestReport.xml
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt; &lt;br&gt;
 &lt;/p&gt;
&lt;p&gt;Gradle configuration. The SonarQube plugin is required.&lt;/p&gt;
&lt;p&gt; &lt;br&gt;
 &lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-gradle&quot;&gt;    plugins {
       id 'java'
       id &quot;org.sonarqube&quot; version &quot;7.0.0.6105&quot;
       id 'jacoco'
       id 'org.springframework.boot' version '3.0.0'
       id 'io.spring.dependency-management' version '1.1.7'
    }
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt; &lt;br&gt;
 &lt;/p&gt;
&lt;p&gt;SonarQube properties&lt;/p&gt;
&lt;p&gt; &lt;br&gt;
 &lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-gradle&quot;&gt;    def localProps = new Properties()
    def localFile = file(&quot;gradle-local.properties&quot;)
    if (localFile.exists()) {
    localProps.load(localFile.newDataInputStream())
    }
    
    
    sonar {
    properties {
       property &quot;sonar.projectKey&quot;, System.getenv(&quot;SONAR_PROJECT_KEY&quot;) ?: localProps[&quot;sonar.projectKey&quot;]
       property &quot;sonar.organization&quot;, System.getenv(&quot;SONAR_ORGANIZATION_KEY&quot;) ?: localProps[&quot;sonar.organization&quot;]
       property &quot;sonar.projectName&quot;, System.getenv(&quot;SONAR_PROJECT_NAME&quot;) ?: localProps[&quot;sonar.projectName&quot;]
       property &quot;sonar.token&quot;, System.getenv(&quot;SONAR_TOKEN&quot;) ?: localProps[&quot;sonar.token&quot;]
       property &quot;sonar.host.url&quot;, System.getenv(&quot;SONAR_HOST_URL&quot;) ?: localProps[&quot;sonar.host.url&quot;]
    }
    }

&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt; &lt;br&gt;
 &lt;/p&gt;
&lt;p&gt;Run the following command to start the container: &lt;strong&gt;docker-compose up -d&lt;/strong&gt;, or you can run it from your &lt;strong&gt;IntelliJ IDEA&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lxz9qcxyxzt6kkystdox.png&quot; alt=&quot;IntelliJ Docker-compose icon run&quot;&gt;&lt;/p&gt;
&lt;p&gt; &lt;br&gt;
 &lt;/p&gt;
&lt;p&gt;You can see the container is up and running&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vuoov0l31qkq5ysvxcyc.png&quot; alt=&quot;IntelliJ Docker container running&quot;&gt;&lt;/p&gt;
&lt;p&gt; &lt;br&gt;
 &lt;/p&gt;
&lt;p&gt;Access SonarQube dashboard at &lt;a rel=&quot;nofollow&quot; href=&quot;http://localhost:9000&quot;&gt;http://localhost:9000&lt;/a&gt;. Login is &lt;strong&gt;admin&lt;/strong&gt;, but you will need to change the password from admin to a new one.&lt;/p&gt;
&lt;p&gt;Click Create project from the top right corner.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://dev-to-uploads.s3.amazonaws.com/uploads/articles/c11kt3pekl595qfyjzh8.png&quot; alt=&quot;Local SonarQube create project menu&quot;&gt;&lt;/p&gt;
&lt;p&gt; &lt;br&gt;
 &lt;/p&gt;
&lt;p&gt;Enter the same name and project key as in your &lt;strong&gt;gradle-local.properties&lt;/strong&gt; file. Then select to use the previous version.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d7k5hg6efsm6q0z3j293.png&quot; alt=&quot;Local SonarQube create project step 1&quot;&gt;&lt;/p&gt;
&lt;p&gt; &lt;br&gt;
 &lt;/p&gt;
&lt;p&gt;Choose &lt;strong&gt;Locally&lt;/strong&gt; as the &lt;strong&gt;Analysis Method&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h8db1yzo1hi7kbzhlszf.png&quot; alt=&quot;Local SonarQube create project step 2&quot;&gt;&lt;/p&gt;
&lt;p&gt; &lt;br&gt;
 &lt;/p&gt;
&lt;p&gt;Type the name of the token and click Generate, then Continue, and set it in the &lt;strong&gt;gradle-local.properties&lt;/strong&gt; file to the &lt;strong&gt;“sonar.token”&lt;/strong&gt; property like &lt;code&gt;`&lt;/code&gt;properties sonar.token=sqp_b7dc6e025b58eb7455b11c6c468cda2b79eb6450b&lt;code&gt;`&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nmhadcx1lhsruvf7aude.png&quot; alt=&quot;Local SonarQube create project token generation step 3&quot;&gt;&lt;/p&gt;
&lt;p&gt; &lt;br&gt;
 &lt;/p&gt;
&lt;p&gt;If you want to generate manually, you can do it as shown in the screenshot below.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://dev-to-uploads.s3.amazonaws.com/uploads/articles/khfd3jc67ygkut1bukgq.png&quot; alt=&quot;Local SonarQube manual token generation&quot;&gt;&lt;/p&gt;
&lt;p&gt; &lt;br&gt;
 &lt;/p&gt;
&lt;h4 id=&quot;run-the-sonar-scan-from-the-command-line-or-from-intellij-idea&quot;&gt;Run the Sonar scan from the command line or from &lt;strong&gt;IntelliJ IDEA&lt;/strong&gt;&lt;/h4&gt;
&lt;p&gt;Use this command  &lt;strong&gt;./gradlew sonar --info&lt;/strong&gt; or run from your &lt;strong&gt;IntelliJ IDEA&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5wp1nc739zdw3hk02gx7.png&quot; alt=&quot;Gradle sonar local scanning command result&quot;&gt;&lt;/p&gt;
&lt;p&gt; &lt;br&gt;
 &lt;/p&gt;
&lt;p&gt;You can view the result by going to the Projects tab. The metrics and coverage are for the main branch only and show overall coverage and metrics. For more details about the new code analysis, click on the project.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://dev-to-uploads.s3.amazonaws.com/uploads/articles/iyzj2r3aqdditsq5td15.png&quot; alt=&quot;Local SonarQube result on UI&quot;&gt;&lt;/p&gt;
&lt;p&gt; &lt;br&gt;
 &lt;/p&gt;
&lt;h4 id=&quot;comparing-local-docker-setup-with-cloud-scanning&quot;&gt;Comparing Local Docker Setup with Cloud Scanning&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;Cloud: No maintenance, scalable, accessible anywhere.&lt;/li&gt;
&lt;li&gt;Local Docker: Full control, ideal if you have no internet connection for an extended period but need to review scan results, useful for sensitive projects.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt; &lt;br&gt;
 &lt;/p&gt;
&lt;h3 id=&quot;conclusion&quot;&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;This article demonstrates how to maximize the benefits of SonarCloud by scanning locally with IntelliJ IDEA or Docker. This helps prevent insecure code from being pushed even to a feature branch and allows developers to work more productively.&lt;/p&gt;
&lt;p&gt; &lt;br&gt;
 &lt;/p&gt;
&lt;h3 id=&quot;closing&quot;&gt;&lt;strong&gt;Closing&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;This article covered  SonarQube Cloud configuration and IntelliJ IDEA integration, as well as running SonarQube locally with Docker. In &lt;strong&gt;“Automating code security in CI/CD: SonarCloud SAST guide (Part 3)”&lt;/strong&gt;, we will explore practical integration examples, configuration patterns, and &lt;strong&gt;CI/CD&lt;/strong&gt; pipelines.&lt;/p&gt;
&lt;p&gt; &lt;br&gt;
 &lt;/p&gt;
&lt;h3 id=&quot;links&quot;&gt;&lt;strong&gt;Links&lt;/strong&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;SonarQube Cloud - &lt;a rel=&quot;nofollow&quot; href=&quot;https://sonarcloud.io&quot;&gt;https://sonarcloud.io&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;SonarQube documentation - &lt;a rel=&quot;nofollow&quot; href=&quot;https://docs.sonarsource.com&quot;&gt;https://docs.sonarsource.com&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</description>
<category>Tutorials</category>
<guid isPermaLink="true">https://coderlegion.com/9955/catch-vulnerabilities-before-they-ship-local-sonarqube-setup-part-2</guid>
<pubDate>Sun, 18 Jan 2026 14:36:05 +0000</pubDate>
</item>
<item>
<title>The Secret Behind SAST: The Security Blind Spot Developers Can’t Ignore (Part 1)</title>
<link>https://coderlegion.com/9856/the-secret-behind-sast-the-security-blind-spot-developers-cant-ignore-part-1</link>
<description>&lt;h3 id=&quot;itroduction&quot;&gt;Itroduction&lt;/h3&gt;
&lt;p&gt;The first part of this article provides a robust theoretical foundation for understanding SAST and its importance in ensuring secure development. Additionally, the subsequent articles (Part 2, and Part 3) will delve into practical examples and effective implementation strategies.&lt;/p&gt;
&lt;p&gt;In the field of modern software engineering, it is not only required to provide features on time but also to ensure their security. As companies refine their Secure Software Development Life Cycle (SSDLC) strategies, one essential aspect that stands out is Static Application Security Testing (SAST).&lt;/p&gt;
&lt;h3 id=&quot;what-is-sast-&quot;&gt;What is SAST?&lt;/h3&gt;
&lt;p&gt;SAST, or Static Application Security Testing, refers to a type of security testing that identifies and addresses potential vulnerabilities in software code. SAST involves examining source code, bytecode, or binaries without running the actual application by scanning the codebase for known vulnerability patterns. &lt;/p&gt;
&lt;p&gt;Source code refers to the human-readable code written by developers.&lt;/p&gt;
&lt;p&gt;Bytecode refers to the compiled form of source code that a virtual machine or runtime can execute, which can be analyzed by SAST tools to detect errors, vulnerabilities, or performance issues before deployment. For example, in Java .class files – the compiled Java classes generated from .java source files.&lt;/p&gt;
&lt;p&gt;Binaries refer to compiled artifacts; in Java, these are typically .jar files, which are Java archives containing .class files and sometimes additional resources such as properties or XML files.&lt;/p&gt;
&lt;p&gt;This tool can detect security weaknesses early on, which covers bugs, code smells, and the latest at this moment, 2021 OWASP TOP 10 categories, such as:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://owasp.org/Top10/A01_2021-Broken_Access_Control/&quot;&gt;A01:2021-Broken Access Control&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://owasp.org/Top10/A02_2021-Cryptographic_Failures/&quot;&gt;A02:2021-Cryptographic Failures&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://owasp.org/Top10/A03_2021-Injection/&quot;&gt;A03:2021-Injection&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://owasp.org/Top10/A04_2021-Insecure_Design/&quot;&gt;A04:2021-Insecure Design&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://owasp.org/Top10/A05_2021-Security_Misconfiguration/&quot;&gt;A05:2021-Security Misconfiguration&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://owasp.org/Top10/A06_2021-Vulnerable_and_Outdated_Components/&quot;&gt;A06:2021-Vulnerable and Outdated Components&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://owasp.org/Top10/A07_2021-Identification_and_Authentication_Failures/&quot;&gt;A07:2021-Identification and Authentication Failures&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://owasp.org/Top10/A08_2021-Software_and_Data_Integrity_Failures/&quot;&gt;A08:2021-Software and Data Integrity Failures&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://owasp.org/Top10/A09_2021-Security_Logging_and_Monitoring_Failures/&quot;&gt;A09:2021-Security Logging and Monitoring Failures&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://owasp.org/Top10/A10_2021-Server-Side_Request_Forgery_%28SSRF%29/&quot;&gt;A10:2021-Server-Side Request Forgery&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;SAST tools analyze program components, including code structure, data flows, and control flows, to identify potential security vulnerabilities before the software is developed or deployed.&lt;/p&gt;
&lt;p&gt;Control flow refers to the order in which individual statements, instructions, or functions in a program are executed.&lt;/p&gt;
&lt;p&gt;Data flow refers to the movement of data through a program, specifically how values are assigned, modified, and passed between variables, functions, or modules. It defines how data travels and transforms during execution. One example is detecting tainted data. Tainted data refers to identifying untrusted or potentially dangerous input in a program that could flow into sensitive operations (called “sinks”) without proper validation or sanitization.&lt;/p&gt;
&lt;p&gt;Control flow determines the sequence of execution in a program, while data flow tracks how data values propagate and transform through that execution.&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;&lt;th&gt;Aspect   &lt;/th&gt;&lt;th&gt;Control Flow &lt;/th&gt;&lt;th&gt;Data flow&lt;/th&gt;&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;What it describes        &lt;/td&gt;&lt;td&gt;Execution order or decision paths      &lt;/td&gt;&lt;td&gt;How data moves and changes&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Examples      &lt;/td&gt;&lt;td&gt;Loops, conditionals, function calls   &lt;/td&gt;&lt;td&gt;Variable assignments, method parameters, and return values&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Use in SAST      &lt;/td&gt;&lt;td&gt;Detect unreachable code, infinite loops, and so on    &lt;/td&gt;&lt;td&gt;Detect tainted data, SQL injection, and logging sensitive info&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;Some of the tools classified as SAST are:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Semgrep, PMD, SpotBugs, and FindSecBugs - popular open-source tools for code analysis and bug detection.&lt;/li&gt;
&lt;li&gt;Fortify, Checkmarx, and Veracode -  reliable enterprise solutions.&lt;/li&gt;
&lt;li&gt;Snyk, SonarQube Cloud, and GitHub CodeQL - cloud-based or SaaS tools.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;the-importance-of-sast-in-secure-development-cannot-be-overstated-&quot;&gt;The importance of SAST in secure development cannot be overstated.&lt;/h3&gt;
&lt;p&gt;Implementing SAST within SSDLC enables the efficient implementation of large-scale security measures by:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Detecting problems early on&lt;/li&gt;
&lt;li&gt;Halting the advancement of vulnerable code through the pipeline, SAST minimizes both time and expense associated with remediation.&lt;/li&gt;
&lt;li&gt;Incorporating security earlier in the development process&lt;/li&gt;
&lt;li&gt;Feedback is provided to developers during the commit or pull request process while the context is still fresh, allowing for any necessary fixes to be made more easily.&lt;/li&gt;
&lt;li&gt;Promoting the education of developers.&lt;/li&gt;
&lt;li&gt;SAST findings facilitate the organic acquisition of secure coding patterns by developers, promoting the integration of security as a daily practice.&lt;/li&gt;
&lt;li&gt;Minimizing risk in the manufacturing process&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;By addressing vulnerabilities early on in the SDLC or live systems, there is a lower occurrence of security incidents. Several compliance frameworks, such as ISO 27001, SOC2, and PCI DSS, require the inclusion of static security testing in secure development governance.&lt;/p&gt;
&lt;h3 id=&quot;how-to-integrate-sast-into-ci-cd-&quot;&gt;How to integrate SAST into CI/CD?&lt;/h3&gt;
&lt;p&gt;The integration of SAST into the development lifecycle is essential for its optimal effectiveness.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Developer local environment (can be optional, but recommended)&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Run lightweight SAST tools locally (Semgrep, CodeQL CLI, Snyk CLI, SonarQube local server using Docker) or run IDE plugins such as SonarQube Cloud that can connect easily from the IDE to the SonarQube Cloud server before pushing code.&lt;/li&gt;
&lt;li&gt;Helps reduce noise in the CI pipeline or incidentally pushes sensitive data to the GIT repository.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Pull request (PR) and merge request (MR) stage&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Protect the main branches from merging directly until all pipeline jobs are &lt;strong&gt;SUCCESSFUL&lt;/strong&gt;. If Git Flow is used, protected branches typically are: &lt;strong&gt;dev&lt;/strong&gt;, &lt;strong&gt;qa&lt;/strong&gt;, or &lt;strong&gt;staging&lt;/strong&gt;, &lt;strong&gt;pre-prod&lt;/strong&gt;, and &lt;strong&gt;prod&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Trigger a SAST scan on &lt;strong&gt;each PR/MR&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Block merging if findings exceed severity thresholds, for example, by configuring Quality Gate in SonarQube or other severity-related policies. You can configure the CI/CD pipeline to &lt;strong&gt;FAIL&lt;/strong&gt; if, for example, &lt;strong&gt;1 Critical&lt;/strong&gt; and/or &lt;strong&gt;3 High&lt;/strong&gt; vulnerabilities are detected.&lt;/li&gt;
&lt;li&gt;Use the SAST tool’s suggestions on how to resolve the issue.&lt;/li&gt;
&lt;li&gt;Investigate the findings to identify potential &lt;strong&gt;false positives&lt;/strong&gt;. SAST scanners provide useful information about each vulnerability, making it easier to understand them.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;CI pipeline&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Add SAST as an early stage. Depends on the project; it can be after the build and test stage or before it, if only the source code is used to scan the project, but the recommended approach is to use it after, because you can configure it to scan for binaries or bytecode.&lt;/li&gt;
&lt;li&gt;Fail builds based on:&lt;/li&gt;
&lt;li&gt;severity level (Low, Medium, High, Critical)&lt;/li&gt;
&lt;li&gt;the count of severity levels (for example, 20 Medium, 5 High, 2 Critical)&lt;/li&gt;
&lt;li&gt;security policy rules&lt;/li&gt;
&lt;li&gt;code smells&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Scheduled full scans&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Run nightly or weekly deep scans on the entire codebase. For example, Snyk scans the project by default once a week and sends the report to the user’s email (this is a SaaS tool, and it depends on whether the company is allowed to send the codebase to other services for scanning for vulnerabilities). &lt;/li&gt;
&lt;li&gt;Capture findings not detected in incremental scans.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Governance&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Export results into an issue tracker (such as Jira) or a SIEM (Security Information and Event Management) system. Some of the SAST tools allow the creation of an issue ticket in Jira.&lt;/li&gt;
&lt;li&gt;Track remediation SLAs (Service Level Agreement)  by severity:&lt;/li&gt;
&lt;li&gt;Critical issues fixed within &lt;strong&gt;24 hours&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;High-severity fix within &lt;strong&gt;3 days&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Medium &lt;strong&gt;7–14 days&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Low &lt;strong&gt;30+ days&lt;/strong&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Maintain centralized dashboards (SonarQube, Snyk, DefectDojo).&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The key principle: &lt;strong&gt;SAST must become a non-negotiable quality gate&lt;/strong&gt;, just like unit tests, linters, or build verifiers.&lt;/p&gt;
&lt;h3 id=&quot;why-do-some-companies-run-sast-within-cvs-instead-of-saas-tools-&quot;&gt;Why do some companies run SAST within CVS instead of SaaS tools?&lt;/h3&gt;
&lt;p&gt;While modern SaaS security platforms are powerful, many enterprises still &lt;strong&gt;run SAST inside their version-control system (CVS)&lt;/strong&gt; or self-hosted environments. &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Data protection and compliance&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Source code is often the company’s most sensitive intellectual property.&lt;br&gt;
Some industries, such as finance, defense, and telecom, cannot upload code to external SaaS due to:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Data residency restrictions&lt;/li&gt;
&lt;li&gt;Regulatory constraints&lt;/li&gt;
&lt;li&gt;Confidentiality concerns&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Full control and custom rules&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Self-hosted SAST (SonarQube Enterprise, Checkmarx On-Premise) offers:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Custom rule tuning for domain-specific patterns&lt;/li&gt;
&lt;li&gt;Control over scanner performance and scheduling&lt;/li&gt;
&lt;li&gt;On-prem log retention and audit trails&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;No external vendor dependency&lt;/strong&gt;&lt;br&gt;
Large organizations want predictable SLAs and reliability without relying on external service uptime or rate limits. Companies often use cloud VMs (Virtual Machines) with autoscaling that make the server available even if one goes down, especially when all infrastructure is deployed on a specific cloud provider like AWS, Azure, and GCP. Still, it is more difficult to configure and maintain your own server compared to SaaS alternatives.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Cost optimization at scale&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;SaaS SAST tools are charged per seat or LOC (lines of code).&lt;br&gt;
For large organizations with millions of LOC, on-premise licensing might be more efficient.&lt;br&gt;
This doesn't make SaaS solutions inferior; they are excellent for small to mid-sized companies or teams that prefer zero maintenance overhead, but big enterprises often choose to keep scanning where the codebase is located or self-hosted.&lt;/p&gt;
&lt;h3 id=&quot;how-does-sast-strengthen-your-application-before-deployment-&quot;&gt;How does SAST strengthen your application before deployment?&lt;/h3&gt;
&lt;p&gt;SAST adds many layers of security reinforcement before one line is deployed:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Eliminates vulnerabilities at the earliest point. Fixing issues in development prevents vulnerabilities from ever entering later stages.&lt;/li&gt;
&lt;li&gt;Reduces attack surface. Every resolved injection flaw, every sanitized input, and every removed secret reduces the exploitable surface in production.&lt;/li&gt;
&lt;li&gt;Improved code quality. Most of the SAST rules lead to improved code clarity, design patterns, and maintainability.&lt;/li&gt;
&lt;li&gt;Drives security culture. SAST is an enabler of secure software development practices. Teams start thinking in terms of:&lt;/li&gt;
&lt;li&gt;safe patterns&lt;/li&gt;
&lt;li&gt;least-privilege design&lt;/li&gt;
&lt;li&gt;secure defaults&lt;/li&gt;
&lt;li&gt;flow validation&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;SAST best practices&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;To maximize the value of SAST in SSDLC:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Start with a minimal and focused rule set. Avoid overwhelming developers. Enable rules progressively.&lt;/li&gt;
&lt;li&gt;Integrate into PR pipelines.&lt;/li&gt;
&lt;li&gt;Make SAST feedback part of the daily development routine.&lt;/li&gt;
&lt;li&gt;Use severity thresholds. These configurations can differ from company to company.&lt;/li&gt;
&lt;li&gt;Avoid false positives. Not all findings are equal; that is why you need to tune rules to reduce false positives. Even if the finding’s severity level is High and it may appear to be a serious issue, it depends on how the feature or script was implemented.&lt;/li&gt;
&lt;li&gt;Establish SLAs for remediation.&lt;br&gt;
For example:&lt;/li&gt;
&lt;li&gt;Critical: fix within 1-2 days.&lt;/li&gt;
&lt;li&gt;High: fix within 5-7 days.&lt;/li&gt;
&lt;li&gt;Medium: fix within 30 days.&lt;/li&gt;
&lt;li&gt;Combine with other AST tools. SAST is one part of the security puzzle. Always complement it with:&lt;/li&gt;
&lt;li&gt;ISCA (dependency scanning), if the tool does not support it, or you can use the free trial version of the tool.&lt;/li&gt;
&lt;li&gt;WAF (Web Application Firewall) adds a defence layer in front of your application by filtering and monitoring HTTP/HTTPS traffic.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt; WAF does not replace SAST or DAST. It can block known attack patterns, mitigate exploitation attempts before fixes are deployed, provide real-time protection in production, and prevent DDoS attacks.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;DAST (Dynamic Application Security Testing). Scan the &lt;strong&gt;DEV&lt;/strong&gt; or &lt;strong&gt;QA&lt;/strong&gt; environment, because &lt;strong&gt;DAST&lt;/strong&gt; is used when the application is up and running. &lt;br&gt;
Effective DAST can be performed in two phases:&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Automated scanning&lt;/strong&gt; — baseline detection of common runtime vulnerabilities.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Manual exploratory testing&lt;/strong&gt; — for issues that automated tools often miss (logic flaws, authorization bypasses, etc.). Not all vulnerabilities can be discovered by SAST alone, which is why DAST is an important complement.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Ensure DevSecOps collaboration.&lt;br&gt;
Security engineers, platform teams, and developers must collaborate on:&lt;/li&gt;
&lt;li&gt;rule tuning&lt;/li&gt;
&lt;li&gt;prioritization&lt;/li&gt;
&lt;li&gt;education&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;conclusion-1&quot;&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;SAST remains one of the cornerstones of a mature &lt;strong&gt;SSDLC&lt;/strong&gt;. It provides early, actionable insights into code security, reduces risk, empowers developers, and fortifies applications before deployment.&lt;br&gt;
Implemented with care, &lt;strong&gt;SAST&lt;/strong&gt; becomes more than just a detection tool; it becomes a catalyst for a long-term secure engineering culture.&lt;/p&gt;
&lt;h3 id=&quot;closing-1&quot;&gt;Closing&lt;/h3&gt;
&lt;p&gt;This article covered the theoretical foundation of &lt;strong&gt;SAST&lt;/strong&gt; and its strategic role within secure development. In ”&lt;strong&gt;Catch vulnerabilities before they ship: local SonarQube setup (Part 2)&lt;/strong&gt;”, we will explore SonarQube Cloud configuration and IntelliJ IDEA integration, as well as running SonarQube locally with Docker.&lt;br&gt;
If you're building secure systems at scale, &lt;strong&gt;SAST&lt;/strong&gt; is where prevention truly begins.&lt;/p&gt;
</description>
<category>Tutorials</category>
<guid isPermaLink="true">https://coderlegion.com/9856/the-secret-behind-sast-the-security-blind-spot-developers-cant-ignore-part-1</guid>
<pubDate>Fri, 16 Jan 2026 16:13:02 +0000</pubDate>
</item>
</channel>
</rss>