<?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 Nikhil Mittal on Medium]]></title>
        <description><![CDATA[Stories by Nikhil Mittal on Medium]]></description>
        <link>https://medium.com/@nikhil_mittal?source=rss-e66c1f2beae0------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*30IboxoozHv8Hz4M</url>
            <title>Stories by Nikhil Mittal on Medium</title>
            <link>https://medium.com/@nikhil_mittal?source=rss-e66c1f2beae0------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 23:11:51 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@nikhil_mittal/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[Building Policy Gate for DevSecOps using Open Policy Agent]]></title>
            <link>https://medium.com/chargebee-engineering/building-policy-gate-for-devsecops-using-open-policy-agent-999dd734744a?source=rss-e66c1f2beae0------2</link>
            <guid isPermaLink="false">https://medium.com/p/999dd734744a</guid>
            <category><![CDATA[security]]></category>
            <category><![CDATA[devsecops]]></category>
            <category><![CDATA[open-policy-agent]]></category>
            <dc:creator><![CDATA[Nikhil Mittal]]></dc:creator>
            <pubDate>Wed, 30 Nov 2022 08:50:05 GMT</pubDate>
            <atom:updated>2022-11-30T08:50:05.811Z</atom:updated>
            <content:encoded><![CDATA[<p>In our <a href="https://medium.com/chargebee-engineering/building-appsec-pipeline-for-continuous-visibility-d430beb0a78f">last blog</a>, we detailed our approach to building a continuous application security pipeline with the objective of providing centralized visibility of the overall security posture of production touching repositories using open-source tools.</p><p>With this implementation, our security workflow does not fail even if the tools detected any vulnerabilities in the scans. This was a founding stone to our shift left initiative</p><p>Next, to drive the adoption of our security workflow to individual production touching repositories in Chargebee, we decided to build a security policy engine using <a href="https://www.openpolicyagent.org/">OPA</a> to control the data produced by open-source tools to act as a gatekeeper so we can effectively control the success or failure of security workflow along with managing exceptions.</p><p>This is how the current security workflow looks like</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/723/1*Xb4yHurtw4rni4HYV1zLuA.png" /></figure><p>The policy engine evaluates data produced by the open-source tools that we use</p><ul><li>SAST -&gt; SemGrep</li><li>SCA -&gt; OWASP Dependency Checker</li><li>Secret Scanning -&gt; GitLeaks</li><li>SBOM -&gt; CycloneDx</li></ul><p>All these tools produce JSON formatted report which is combined together using <a href="https://stedolan.github.io/jq/">JQ</a> to feed them to the policy engine</p><h3>Security Policy Engine</h3><p>The security policy engine starts with <em>default.rego</em> which checks if the overall count of violations is Zero or not.</p><pre>package cb.devsecops.policy<br><br>default allow = false<br><br>allow {<br>  count(violations) == 0<br>}</pre><p>Violations are defined separately for each tool we use in the security pipeline. Let’s consider an example of SemGrep policy implementation. For SemGrep we have <em>sast.rego</em> file created in the policy engine where it initially checks for all the issues against a configured severity for instance if we decide to fail SemGrep only for <strong>ERROR</strong> categorized issues we can define this severity in the configuration file and the same does for other tools like SCA we can define to fail only on <strong>CRITICAL</strong> or <strong>HIGH</strong> severity issues.</p><p>This is what a sample SAST policy looks like:</p><pre>package cb.devsecops.policy<br><br>import future.keywords.every<br>import future.keywords.in<br><br>violations[{&quot;message&quot;: msg, &quot;code&quot;: code}] {<br>  issue = input.semgrep.results[_]<br>  issue.extra.severity in data.config.semgrep.fail_on_severities<br>  not semgrep_exempted(issue)<br><br>  msg := &quot;SAST result have issues with WARNING or ERROR&quot;<br>  code := &quot;sast_fail&quot;<br>}<br><br>semgrep_exempted(issue) {<br>  exceptions := data.config.exceptions.semgrep<br><br>  exceptions[_].attributes.fingerprint = issue.extra.fingerprint<br><br>  # Support glob so that we can use patterns like &#39;javascript.**&#39;<br>  glob.match(exceptions[_].attributes.check_id, [&quot;.&quot;], issue.check_id)<br>  glob.match(exceptions[_].attributes.path, [&quot;/&quot;], issue.path)<br>}</pre><p>Once the initial check for severity is completed it moves toward exception management. Producing false positive issues with security scans is a prevalent scenario.</p><p>To deal with this situation we have defined a way to add exceptions for each tool. So the next check is to see if the flagged issue is configured as an exception or not.</p><p>For example, if the policy engine catches a HIGH severity issue and it’s made as an exception, the security workflow won’t fail. And if the issue is failing on severity and not configured in exception our security workflow will fail. Let’s consider an example of exception management in the policy engine</p><pre>{<br>    &quot;exceptions&quot;: {<br>        &quot;semgrep&quot;: [<br>            {<br>                &quot;reason&quot;: &quot;This is a example exception criteria&quot;,<br>                &quot;attributes&quot;: {<br>                    &quot;check_id&quot;: &quot;example-check-id&quot;,<br>                    &quot;fingerprint&quot;: &quot;example-fingerprint&quot;,<br>                    &quot;path&quot;: &quot;/target/example/path/file.ts&quot;<br>                }<br>            }<br>        ],<br>        &quot;gitleaks&quot;: [<br>            {<br>                &quot;reason&quot;: &quot;This is a example exception criteria&quot;,<br>                &quot;attributes&quot;: {<br>                    &quot;StartLine&quot;: 21,<br>                    &quot;EndLine&quot;: 21,<br>                    &quot;File&quot;:&quot;/target/example/path/file.ts&quot;,<br>                    &quot;Commit&quot;:&quot;&lt;commitSHA&gt;&quot;<br>                }<br>            }<br>        ],<br>        &quot;odc&quot;: [<br><br>        ]<br>    }<br>}</pre><p>Once the policy engine is integrated with the security workflow this is how it looks in action</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Qxf1tyIDgE3K21DQbMLDFw.png" /></figure><h3>Closing note</h3><p>With this tooling, at Chargebee we intend to drive policy as code adoption and encourage security policies to be codified in the pipeline.</p><p>Possibilities of adopting Policy as Code are limitless. Any change in security policies will mean we need to change only the policy code instead of the rest of the system. It also ensures the separation of concerns between tools developers, integrators, and policymakers.</p><p>For comments or feedback, you can get in touch with me over <a href="https://twitter.com/c0d3G33k">Twitter</a> 😀</p><p>If you are interested in our work and want to solve complex problems in SaaS products, platform &amp; cloud infrastructure engineering — <a href="https://www.chargebee.com/careers/engineering-culture/">we are hiring</a>!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=999dd734744a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/chargebee-engineering/building-policy-gate-for-devsecops-using-open-policy-agent-999dd734744a">Building Policy Gate for DevSecOps using Open Policy Agent</a> was originally published in <a href="https://medium.com/chargebee-engineering">Engineering @ Chargebee</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building AppSec Pipeline for Continuous Visibility]]></title>
            <link>https://medium.com/chargebee-engineering/building-appsec-pipeline-for-continuous-visibility-d430beb0a78f?source=rss-e66c1f2beae0------2</link>
            <guid isPermaLink="false">https://medium.com/p/d430beb0a78f</guid>
            <category><![CDATA[devsecops]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[appsec]]></category>
            <dc:creator><![CDATA[Nikhil Mittal]]></dc:creator>
            <pubDate>Thu, 21 Jul 2022 12:46:44 GMT</pubDate>
            <atom:updated>2022-07-21T12:46:44.191Z</atom:updated>
            <content:encoded><![CDATA[<p>Most SaaS organizations need high-velocity engineering with multiple releases in a day where security &amp; engineering teams are disproportionately scaled and no one likes to be blocked by other teams. So the AppSec industry is shifting left. This means the conventional security testing as a pre-release activity is not effective anymore in a fast-paced continuous environment. In this blog, we will explain our approach to building an application security pipeline for continuous security scanning using free and open-source tools for <a href="https://en.wikipedia.org/wiki/Static_application_security_testing">SAST</a>, <a href="https://en.wikipedia.org/wiki/Dynamic_application_security_testing">DAST</a>, <a href="https://owasp.org/www-community/Component_Analysis">SCA</a>, Secrets Scanning, and <a href="https://owasp.org/www-project-cyclonedx/">SBOM</a> generation.</p><p>The objective of this initiative is to provide centralized visibility of the overall security posture of various production touching components within the organization. This is a stepping stone for establishing a shared security responsibility culture by providing continuous and automated visibility.</p><h3>Overall Architecture</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*G2QjTEXMADrruMkZn4XlQg.png" /></figure><h3>Self-serve Security Solutions</h3><p>All of our security solutions are deployed as independent containers on AWS ECR so they can be pulled directly from ECR to integrate into any workflows or can be used locally by developers.</p><p>We use the following open-source tools for security scanning</p><ul><li>SAST → SemGrep</li><li>SCA → OWASP Dependency Checker</li><li>Secret Scanning → Gitleaks</li><li>SBOM → CycloneDx</li></ul><p>To drive self-service and ease of usability &amp; adoption we wrote a custom wrapper on top of these tools. So our users need not worry about the underlying implementation. This gives us additional control of pushing custom rules any time and have the pipeline apply the rule on all repositories.</p><p>For example, the SAST solution asks for a few user inputs and then applies appropriate scan profiles and custom rules based on the input. This makes it easier for our users to use it without worrying about the backend implementation, like what custom rules to use, which SemGrep profiles to use, etc. It also helps us to replace the underlying tool without disturbing the existing implementation.</p><h3>GitHub Repository Architecture</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*z6D5yJ6PJOnjaX7wgnKlUQ.png" /></figure><p>To achieve continuous security scanning without depending on any team we decided to</p><ul><li>Create an AppSec repository that has a main reusable workflow that can be used to scan any repository we wanted to scan using the standard configuration defined in security-workflow.yml</li><li>For example, if we want to scan a dummyrepository then we create a YML file with the repo name which uses our reusable workflow and on a nightly basis</li><li>As it triggers the security-workflow.yml file that clones the target repository which is dummy.yml and it starts scanning and archiving the report to the S3 bucket.</li></ul><h3>Security Data Visualization</h3><p>The data ingestion process is complete once it is archived in the S3 bucket. The next phase is to visualize the data stored in the S3 bucket.</p><p>To solve the visualization in a near real-time manner, our Lambda function triggers on S3 PUT event and checks the relevant data, and sends it to the security dashboard.</p><h4>DefectDojo</h4><p>DefectDojo has inbuilt parser support for SemGrep, Gitleaks, and ODC. So all the results from these tools go to the DefectDojo dashboard via the lambda function</p><h4>DependencyTrack</h4><p>In the DependencyTrack, the results from the software bill of material (SBOM) are stored. DependencyTrack has inbuilt functionality to detect vulnerabilities in different components used in the application and hence it can be used to identify</p><ul><li>List of the components/ libraries used in the application (Inventory management)</li><li>Vulnerabilities in used components/libraries</li><li>Organizational license policy violation detection</li></ul><h3>Closing note</h3><p>As a result, our security workflows can be integrated within GitHub Actions and can be used for PR level scanning as well and that is what is driving our shift left initiative.</p><p>For comments or feedback, you can get in touch with me over <a href="https://twitter.com/c0d3G33k">Twitter</a> 😀</p><p>If you are interested in our work and want to solve complex problems in SaaS products, platform &amp; cloud infrastructure engineering — <a href="https://www.chargebee.com/careers/engineering-culture/">we are hiring</a>!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d430beb0a78f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/chargebee-engineering/building-appsec-pipeline-for-continuous-visibility-d430beb0a78f">Building AppSec Pipeline for Continuous Visibility</a> was originally published in <a href="https://medium.com/chargebee-engineering">Engineering @ Chargebee</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>