<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: CodeSec by Contrast Security</title>
    <description>The latest articles on DEV Community by CodeSec by Contrast Security (@codesec).</description>
    <link>https://dev.to/codesec</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Forganization%2Fprofile_image%2F5751%2F819cbc55-5b24-47d3-883f-50e4d8f6a54d.png</url>
      <title>DEV Community: CodeSec by Contrast Security</title>
      <link>https://dev.to/codesec</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/codesec"/>
    <language>en</language>
    <item>
      <title>Detect vulnerable libraries within your GitHub environments for free</title>
      <dc:creator>Orlandov14</dc:creator>
      <pubDate>Fri, 21 Oct 2022 03:08:27 +0000</pubDate>
      <link>https://dev.to/codesec/detect-vulnerable-libraries-within-your-github-environments-for-free-2mg0</link>
      <guid>https://dev.to/codesec/detect-vulnerable-libraries-within-your-github-environments-for-free-2mg0</guid>
      <description>&lt;p&gt;Combine the power of GitHub Actions for automated Continuous Integration/Continuous Deployment (CI/CD) pipelines with Contrast Security’s powerful free developer tool, CodeSec, to identify vulnerable dependencies in your Java, .NET, NodeJS, Ruby, Python, Go or PHP projects.&lt;/p&gt;

&lt;p&gt;The first step is to install CodeSec locally. CodeSec is at the free tier of Contrast Security’s product suite. It is very easy to install with either Homebrew, npm or straight from binary. You can find CodeSec at Contrast’s &lt;a href="https://www.contrastsecurity.com/developer/codesec/?hsLang=en-us"&gt;Developer Central online portal.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once CodeSec is installed on your machine, you will need to run the command &lt;em&gt;&lt;strong&gt;contrast config&lt;/strong&gt;&lt;/em&gt;. This will give you the CodeSec account keys that you can use in your project’s GitHub Actions configuration file.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--3Up_SVQr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ixiigozs1q2qwvorlssg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--3Up_SVQr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ixiigozs1q2qwvorlssg.png" alt="CodeSec config keys" width="880" height="344"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;CodeSec config keys&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Second, you need to set those keys as secrets in your GitHub repository’s settings. This is available in your GitHub project repository on the Settings tab, Security section, Secrets option, Actions sub-option. Add secrets with the names CONTRAST_API_KEY, CONTRAST_ORGANIZATION_ID and CONTRAST_AUTH_HEADER along with their corresponding values from the &lt;strong&gt;&lt;em&gt;contrast config&lt;/em&gt;&lt;/strong&gt; command.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--yWghOlQY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nk8oq2bxcw4bhzqifl2s.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--yWghOlQY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nk8oq2bxcw4bhzqifl2s.png" alt="CodeSec + GitHub" width="880" height="726"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Add GitHub repository secrets&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;With those config keys set as repository secrets, you are now ready to use the &lt;a href="https://github.com/marketplace/actions/contrast-security-sca"&gt;Contrast SCA GitHub Action&lt;/a&gt;. &lt;strong&gt;Contrast SCA&lt;/strong&gt; is an enterprise-level cybersecurity tool that identifies vulnerabilities in the third-party components that your project uses.&lt;/p&gt;

&lt;p&gt;The &lt;a href="https://github.com/marketplace/actions/contrast-security-sca"&gt;Contrast SCA GitHub Action page&lt;/a&gt; gives examples of GitHub Action configuration files for use with several different languages. In this article we will walk through an example of using the NodeJS config file.&lt;/p&gt;

&lt;p&gt;Create a new Git branch in your project with &lt;em&gt;&lt;strong&gt;git checkout -b your-branch-name.&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s---Yn1dUWF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bjcbm0t6ntg3gjsw6vcd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---Yn1dUWF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bjcbm0t6ntg3gjsw6vcd.png" alt="CodeSec SCA + GitHub" width="880" height="123"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Create a new Git branch&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Next, create a new GitHub Actions build file at &lt;em&gt;&lt;strong&gt;./.github/workflows/build.yml&lt;/strong&gt;&lt;/em&gt;, if your project does not have one yet. If it does, you may want to just edit your existing file.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--1DQDWMB2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bu0yq0p0n2mosiax3sq8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--1DQDWMB2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bu0yq0p0n2mosiax3sq8.png" alt="CodeSec SCA + GitHub" width="510" height="462"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;New GitHub Actions build configuration file&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Then, in the &lt;strong&gt;build.yml&lt;/strong&gt; file, add the job to run the Contrast SCA action. Use the Node template from the &lt;a href="https://github.com/marketplace/actions/contrast-security-sca"&gt;Contrast SCA GitHub Action page&lt;/a&gt;. Be sure that it uses the CodeSec config secrets that you made at the beginning of the article! Note: One difference from the template is that we won’t specify the &lt;strong&gt;apiUrl&lt;/strong&gt; setting and will let Contrast SCA default to the free Community Edition of the Contrast tool suite server. You will also need to customize the path to your project’s config files and make sure that you target branch “main”, which is the default name of the repository’s primary branch on GitHub.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--XlhucKSw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/72o0hgs7qdiclci74snj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--XlhucKSw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/72o0hgs7qdiclci74snj.png" alt="CodeSec SCA + GitHub" width="880" height="796"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Example build.yml for a NodeJS project&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Back on the command line, add the new file to your local Git repository, commit the changes and then push it up to your remote GitHub repository.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--d5DzcOr_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j81a3uc23j9s8c946rse.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--d5DzcOr_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j81a3uc23j9s8c946rse.png" alt="CodeSec SCA + GitHub" width="880" height="1158"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Git add, commit and push your new build file&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The output of &lt;strong&gt;git push&lt;/strong&gt; gives you a URL to use to create the pull request for your changes. In this example, it was &lt;a href="https://github.com/JacobMagesHaskinsContrast/resource-mon/pull/new/add-sca-check"&gt;https://github.com/JacobMagesHaskinsContrast/resource-mon/pull/new/add-sca-check&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--XR8l4e6k--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/joldobtz9wp34cnbo842.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--XR8l4e6k--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/joldobtz9wp34cnbo842.png" alt="CodeSec SCA + GitHub" width="880" height="620"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Pull request on the GitHub repository&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;After merging the changes, you can look at the Actions tab and see that “SCA Node” is now an available workflow that runs in your repository.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--oY_7rWsI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5g4gwj4tfqc2f6xzl1h1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--oY_7rWsI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5g4gwj4tfqc2f6xzl1h1.png" alt="CodeSec SCA + GitHub" width="880" height="383"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;SCA Node workflow in the repository actions&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;If your project has a vulnerability, like the deliberate example vulnerability in this project, you can click on the workflow’s run to see its details. In the details, you can find the specific vulnerabilities in libraries that your project uses, along with advice on fixing them.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--WwIJLTXP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/21ufmra49bk1b6v6zx4d.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--WwIJLTXP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/21ufmra49bk1b6v6zx4d.png" alt="CodeSec SCA + GitHub" width="880" height="582"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Contrast SCA GitHub Action results&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Conclusion&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;GitHub Actions are a powerful tool. Much could be written on all the various options available for using them to power your project’s CI/CD pipelines. The Contrast SCA GitHub Action, when paired with CodeSec, is a strong new tool for securing your project from cybersecurity threats.&lt;/p&gt;

&lt;p&gt;Test out Contrast SCA’s newest &lt;strong&gt;GitHub Action&lt;/strong&gt; feature for yourself with &lt;a href="https://www.contrastsecurity.com/developer?hsLang=en-us"&gt;CodeSec!&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;To learn more about Contrast's new GitHub Action:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://youtu.be/A5B-_zbxkY8"&gt;Click here&lt;/a&gt;&lt;/strong&gt; for our video tutorial.&lt;br&gt;
&lt;strong&gt;&lt;a href="https://github.com/marketplace/actions/contrast-security-sca"&gt;Click here&lt;/a&gt;&lt;/strong&gt; to check us out on GitHub Marketplace.&lt;/p&gt;

</description>
      <category>github</category>
      <category>javascript</category>
      <category>java</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Find JavaScript cyber-vulnerabilities for free</title>
      <dc:creator>Orlandov14</dc:creator>
      <pubDate>Tue, 11 Oct 2022 03:36:54 +0000</pubDate>
      <link>https://dev.to/codesec/find-javascript-cyber-vulnerabilities-for-free-35ao</link>
      <guid>https://dev.to/codesec/find-javascript-cyber-vulnerabilities-for-free-35ao</guid>
      <description>&lt;p&gt;According to a &lt;a href="https://survey.stackoverflow.co/2022/#most-popular-technologies-language-prof"&gt;2022 Stack Overflow survey&lt;/a&gt; of more than 50K professional developers, JavaScript is the top programming language of choice. Finding cybersecurity risks in JavaScript code is critical for developers working with modern web technologies. CodeSec by Contrast can help developers find and fix risks in their code, like cross-site scripting (XSS) or broken access control vulnerabilities.&lt;/p&gt;

&lt;p&gt;CodeSec is Contrast Security's free developer security motion that is very easy to install with either Homebrew, npm or straight from binary. You can find &lt;a href="https://www.contrastsecurity.com/developer/codesec/?hsLang=en-us"&gt;CodeSec at Contrast’s Developer Central online portal&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Once CodeSec is installed on your machine and you have authenticated with either your GitHub or Google account, you can start scanning your JavaScript project for vulnerabilities with the command &lt;strong&gt;&lt;em&gt;contrast scan&lt;/em&gt;&lt;/strong&gt;. Scan will look up to three folders deep in your project for either a single *.js file to scan or a *.zip file of JavaScript files to scan. At first glance, this might seem strange, but ZIP format is just a more compact way to upload the code files that need to be examined.&lt;/p&gt;

&lt;p&gt;In this article, we will assume that you have a modern JavaScript project with multiple code files, such as the “browser-test-bench” project in the below screenshots.&lt;/p&gt;

&lt;p&gt;First, let’s zip the project’s JavaScript files. The zip command-line utility tool provides arguments for recursively searching through your project’s folders to find JavaScript files while also excluding certain folders, such as &lt;em&gt;&lt;strong&gt;node_modules&lt;/strong&gt;&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Run Command&lt;/strong&gt; (from within your project folder):&lt;br&gt;
&lt;em&gt;&lt;strong&gt;zip -R to-be-scanned “*.js” -x “node_modules”&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;There are, of course, plenty of variations of this command that you could do to make the ZIP file: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You could name it something other than “to-be-scanned.zip,” such as the day’s date or a company-specific format. &lt;/li&gt;
&lt;li&gt;Your project may not have a &lt;strong&gt;node_modules&lt;/strong&gt; folder full of third-party libraries but may have a &lt;strong&gt;lib&lt;/strong&gt; folder instead. &lt;/li&gt;
&lt;li&gt;Additionally, you may not want to do a recursive search through the project’s folders for JavaScript files. Instead, you might want to specify zipping only certain files instead. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Whatever your needs, the ZIP command’s man page (accessible in your terminal with the command &lt;strong&gt;&lt;em&gt;man zip&lt;/em&gt;&lt;/strong&gt;), and searching Stack Overflow are both great resources for learning about the ZIP tool’s options.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--v4niyvSb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ucu3nlqasy92o82dlwnx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--v4niyvSb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ucu3nlqasy92o82dlwnx.png" alt="Image description" width="586" height="324"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;_Creating to-be-scanned.zip of project JavaScript files&lt;br&gt;
_&lt;br&gt;
Once the ZIP file of the project’s JavaScript files is created, you are ready to run the command to scan for vulnerabilities.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Run Command&lt;/strong&gt; (from within your project folder): &lt;em&gt;&lt;strong&gt;contrast scan&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Contrast Security’s Scan product is a Static Analysis Security Testing (SAST) cybersecurity tool. This means that Scan examines static code files, as opposed to Contrast’s more dynamic analysis tools like &lt;a href="https://www.contrastsecurity.com/contrast-assess?hsLang=en-us"&gt;Assess&lt;/a&gt; (an Interactive Application Security Testing [IAST] tool) and &lt;a href="https://www.contrastsecurity.com/contrast-protect?hsLang=en-us"&gt;Protect&lt;/a&gt; (a Runtime Application Protection tool).&lt;/p&gt;

&lt;p&gt;When the scan command starts, it looks for the ZIP file that we made earlier. Next, CodeSec uploads the ZIP file in order to analyze its JavaScript code files for vulnerabilities.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--pbHTmo4Z--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3ehwr5x6hzitshkwr21w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--pbHTmo4Z--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3ehwr5x6hzitshkwr21w.png" alt="Image description" width="584" height="323"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;_In-progress cybersecurity analysis for JavaScript files &lt;br&gt;
_&lt;br&gt;
Once the Scan analysis is complete, CodeSec lists the vulnerabilities found. The vulnerabilities are sorted with the most critical-to-fix ones at the top and then descending in severity. Each vulnerability is described, has the file and line number of its occurrence listed, and provides resources for learning more about that cybersecurity risk. All of the information in the Scan analysis results can help you find and fix cybersecurity vulnerabilities before they become production-level incidents that your project’s support team needs to triage.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--lKAVz1HZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/erkctufqgl1umzutv9d4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--lKAVz1HZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/erkctufqgl1umzutv9d4.png" alt="Image description" width="850" height="1068"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;CodeSec’s Scan analysis results&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pro tip #1:&lt;/strong&gt; Many modern front-end JavaScript projects minify their code for deployment in production. Minified JavaScript is not human-readable and, often, all on a single line, which means that the file and line number listing for a vulnerability in the analysis results won’t be very useful for you. Instead, try running &lt;strong&gt;&lt;em&gt;contrast scan&lt;/em&gt;&lt;/strong&gt; against your preminified code.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pro tip #2:&lt;/strong&gt; Because CodeSec is a command-line tool, you can incorporate Scan into your automated software processes, like we showed in our earlier article on using &lt;a href="https://www.contrastsecurity.com/security-influencers/how-to-scan-for-cybersecurity-risks-on-every-commit-with-codesec-git-hooks?hsLang=en-us"&gt;CodeSec with Git hooks&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;CodeSec’s free vulnerability scanning support can help you find cybersecurity risks in your JavaScript project. CodeSec is a free way for developers to provide high-value software for this popular web technology choice.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.contrastsecurity.com/developer?hsLang=en-us"&gt;Get started today for free.&lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>react</category>
      <category>angular</category>
      <category>webdev</category>
    </item>
    <item>
      <title>How to create SBOMs for free</title>
      <dc:creator>Orlandov14</dc:creator>
      <pubDate>Mon, 03 Oct 2022 17:07:38 +0000</pubDate>
      <link>https://dev.to/codesec/how-to-create-sboms-for-free-with-codesec-by-contrast-232</link>
      <guid>https://dev.to/codesec/how-to-create-sboms-for-free-with-codesec-by-contrast-232</guid>
      <description>&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/AH-TLkaIeoY"&gt;
&lt;/iframe&gt;
&lt;br&gt;
A recent &lt;a href="https://www.whitehouse.gov/briefing-room/presidential-actions/2021/05/12/executive-order-on-improving-the-nations-cybersecurity/"&gt;Executive Order&lt;/a&gt; from the Biden Whitehouse instructs various government agencies to take action to improve our nation’s cybersecurity.  One of those actions is to provide guidance and standards on Software Bills of Materials (SBOMs).  In this article, we will explore what SBOMs are and how to easily create them with Contrast Security’s free developer toolset — CodeSec.&lt;/p&gt;

&lt;p&gt;An SBOM is a standardized format for recording all the constituent parts of a software product.  It lists all the open-source libraries used, other third-party proprietary libraries and some metadata about the custom code in the product. The hope is that software purchasers, such as the Federal Government, will be able to use SBOMs in a searchable way for early detection and resolution of vulnerabilities hidden within the various parts of the products they use.&lt;/p&gt;

&lt;p&gt;Compiling and authoring an SBOM by hand can be a maintenance nightmare. No one in their right mind would want to have the chore of combing through all the libraries used in a project and recording their information in a very rigorous JavaScript Object Notation (JSON) format. Imagine making a mistake only a few hours into such a project as your mind starts to daydream about something more interesting.&lt;/p&gt;

&lt;p&gt;Luckily, CodeSec by Contrast provides a very simple command for creating SBOMs. After &lt;a href="https://bit.ly/3C6tvbB"&gt;installing CodeSec&lt;/a&gt;, navigate to the top level of your project in your terminal and run the following command:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Run Command:&lt;/strong&gt; &lt;em&gt;contrast audit --save&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--L0daL0Bo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3qhsvshaq2vx5j3rsbtm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--L0daL0Bo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3qhsvshaq2vx5j3rsbtm.png" alt="Image description" width="830" height="606"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;*&lt;em&gt;SBOM file saved at the end of the contrast audit output&lt;br&gt;
*&lt;/em&gt;&lt;/em&gt;&lt;br&gt;
Near the end of the output of the audit command, CodeSec lists the name of the saved SBOM file. Viewing that file reveals it is a very extensive JSON record of the example project and the many libraries it uses. Some other highlights to note are that it lists the SBOM format used, the software vendor and the project name.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Ex52RpnB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/i154y6kida4bi7gg49wq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Ex52RpnB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/i154y6kida4bi7gg49wq.png" alt="Image description" width="880" height="1033"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once this file is created, it can be provided to customers or other security professionals related to your organization as needed.&lt;/p&gt;

&lt;p&gt;Because CodeSec is a command-line tool, it is also possible to build software automation around creating SBOMs.  For example, it is possible to add the following line to your project’s &lt;a href="https://www.contrastsecurity.com/security-influencers/how-to-scan-for-cybersecurity-risks-on-every-commit-with-codesec-git-hooks?hsLang=en-us"&gt;pre-commit Git Hook&lt;/a&gt; to create the SBOM and then add it to the commit,  automatically and free for every commit:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;git add ‘$(contrast audit --save | grep -e “(SBOM)” | cut -d “ ” -f 10)’&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;This command, if placed in pre-commit hook, would run CodeSec’s audit, tell it to create an SBOM, use grep to find the line in the audit output where the SBOM file name is at, then cut that line into pieces at every whitespace and grab the tenth piece — which is the full SBOM file name. After that, it would run Git’s “add” command to add the SBOM file to the commit in progress.&lt;/p&gt;

&lt;p&gt;An SBOM provides greater transparency into the components that a software product uses, and that knowledge can help decrease cybersecurity risks for the purchasers of that product. CodeSec provides a super simple mechanism for automatically creating SBOMs that then enables even more opportunities for automating the SBOM creation process. &lt;a href="https://bit.ly/3C6tvbB"&gt;Get started today!&lt;/a&gt;&lt;/p&gt;

</description>
      <category>opensource</category>
      <category>javascript</category>
      <category>security</category>
      <category>java</category>
    </item>
    <item>
      <title>How to scan for cybersecurity risks on every commit with CodeSec and Git Hooks for free</title>
      <dc:creator>Orlandov14</dc:creator>
      <pubDate>Thu, 18 Aug 2022 22:05:27 +0000</pubDate>
      <link>https://dev.to/codesec/how-to-scan-for-cybersecurity-risks-on-every-commit-with-codesec-and-git-hooks-for-free-15ek</link>
      <guid>https://dev.to/codesec/how-to-scan-for-cybersecurity-risks-on-every-commit-with-codesec-and-git-hooks-for-free-15ek</guid>
      <description>&lt;p&gt;Good programmers are lazy.&lt;/p&gt;

&lt;p&gt;It’s a common euphemism in the software development world: a humorous, counterintuitive statement that describes a real phenomenon. Good programmers look for simple, efficient solutions to hard problems. Often, that means making our machines do the work for us in new ways. Today, we will be exploring how to make your computer automatically check code for cybersecurity risks on every commit to a Git repository so that us devs will not need to remember to do that on our own.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Git Hooks
&lt;/h2&gt;

&lt;p&gt;Git is a modern and popular code repository. Through its &lt;a href="https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks#_git_hooks"&gt;Git Hooks&lt;/a&gt; feature, you can extend its built-in capabilities with custom scripts that are run when certain repository events occur, such as commits.&lt;/p&gt;

&lt;p&gt;Examples of common custom scripts that a developer might want to run when a commit action occurs are running tests, code formatting or even commit message reformatting to include the ticket number. The beauty of this pre-commit hook is that the developer doesn’t have to remember (and potentially forget) to run these commands on their code prior to each time they commit a change.&lt;/p&gt;

&lt;p&gt;If a project is set up to use a Git repository, it will have a “.git” folder at the top level of the project’s directory structure. Within that folder is a “hooks” folder, which contains sample scripts for the different repository events, such as “pre-commit.sample.” It may also contain script files for any hooks that you’ve previously created.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--gMBnsw4x--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qjvbytm1ub5bnqt35c6z.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--gMBnsw4x--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qjvbytm1ub5bnqt35c6z.png" alt="CodeSec + Git" width="880" height="393"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;We’re interested in making a pre-commit hook to scan our code for cybersecurity vulnerabilities every time we commit changes. To create a new git hook script file, simply copy the “pre-commit.sample” file, rename it to remove the “.sample” file extension, open the file in a text editor and delete the sample script contents.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pro tip:&lt;/strong&gt; Alternatively, we could make a new file named “pre-commit,” but on Unix-like machines, we’ll need to give it permission to be executed. An easy way to do that is by running the following command:&lt;br&gt;
&lt;strong&gt;&lt;em&gt;chmod +x .git/hooks/pre-commit&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  2. CodeSec pre-commit shell script
&lt;/h2&gt;

&lt;p&gt;Git runs the pre-commit script before actually creating the commit for our code changes. As such, the requirements for our script to find cybersecurity vulnerabilities are:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1.&lt;/strong&gt; Run both &lt;strong&gt;&lt;em&gt;contrast scan&lt;/em&gt;&lt;/strong&gt; and &lt;em&gt;&lt;strong&gt;contrast audit&lt;/strong&gt;&lt;/em&gt; commands to scan for vulnerabilities in the project code and in any third-party libraries;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2.&lt;/strong&gt; Examine the output of each of those commands to see if any critical or high-risk vulnerabilities are found; and&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3.&lt;/strong&gt; Stop the commit process if risks are found, but continue with the commit if none are found.&lt;/p&gt;

&lt;p&gt;To accomplish the &lt;strong&gt;first requirement&lt;/strong&gt;, we need to have CodeSec by Contrast installed on our local development machine. Installation instructions are available on Contrast Security’s &lt;a href="https://bit.ly/3wfuLae"&gt;Developer Central hub&lt;/a&gt;. We also illustrated, step-by-step, how easy it is to install CodeSec in a previous article about &lt;a href="https://www.contrastsecurity.com/security-influencers/codesec-by-contrast-free-sca-log4j-scanning"&gt;finding Log4j vulnerabilities.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once CodeSec is installed, we can pipe the output of the CodeSec commands to the Grep tool to search for the keywords “CRITICAL” and “HIGH,” which will be present if CodeSec lists out any critical or high-risk vulnerabilities. Finally, if Grep finds a vulnerability in the output, we can exit the commit process early without actually committing any of your code changes.&lt;/p&gt;

&lt;p&gt;This is an example output for &lt;strong&gt;&lt;em&gt;contrast audit&lt;/em&gt;&lt;/strong&gt; when a high-risk vulnerability is found.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--i_hTKPIk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8mhm5jcomudbrzya2924.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--i_hTKPIk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8mhm5jcomudbrzya2924.png" alt="CodeSec + Git 2" width="880" height="581"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;We can see in the screenshot that CodeSec found a high-risk vulnerability, indicated by the “HIGH” keyword.&lt;/p&gt;

&lt;p&gt;Below is  the full code of the pre-commit script where Grep searches the CodeSec output for the “CRITICAL” and “HIGH” keywords and exits the commit process early if found:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#!/bin/sh

#Existing pre-commit scripts could go here....

if contrast scan | grep -e CRITICAL -e HIGH; then
  echo "\n💩 One or more vulnerabilities found in code. Please run 'contrast scan' for more details."
  exit 1
fi

if contrast audit | grep -e CRITICAL -e HIGH; then
  echo "\n💩 One or more vulnerabilities found in libraries. Please run 'contrast audit' for more details."
  exit 1
fi
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The script functions just as described above.  It’s a shell script with two “if” blocks. The conditional expressions of each “if” calls the CodeSec commands, pipes the output to Grep so that it can search for critical or high-risk vulnerability listings, and exits early from the commit process if any are found. To use this script, just add it to the pre-commit file in the .git/hooks directory that we made in the first part of this article.&lt;/p&gt;

&lt;p&gt;This is what it looks like in action for a Git commit:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--4ECwC2Sr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jjx6x3w0iopxghn5pq27.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--4ECwC2Sr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jjx6x3w0iopxghn5pq27.png" alt="CodeSec + Git 3" width="880" height="269"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;The key feature in this example is that CodeSec can find cybersecurity vulnerabilities in our code, and Grep can search the output of CodeSec. Together, these two tools are a springboard for software process automation. In our example, it prevents risky code from being committed to the project repository every time a developer tries to commit code. This is like having an in-house cybersecurity expert code review every change without forgetting to check something or making a mistake, and doing it every day, for free. This is what it means to be a lazy programmer who works smart instead of hard: A good programmer makes the machine do the work instead.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://bit.ly/3wfuLae"&gt;Start securing your code today for free with CodeSec&lt;br&gt;
&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>git</category>
      <category>programming</category>
      <category>cli</category>
      <category>codesec</category>
    </item>
    <item>
      <title>How to detect Log4j vulnerabilities in Java projects for free with CodeSec</title>
      <dc:creator>Orlandov14</dc:creator>
      <pubDate>Mon, 08 Aug 2022 04:44:00 +0000</pubDate>
      <link>https://dev.to/codesec/how-to-detect-log4j-vulnerabilities-in-java-projects-for-free-with-codesec-3mjm</link>
      <guid>https://dev.to/codesec/how-to-detect-log4j-vulnerabilities-in-java-projects-for-free-with-codesec-3mjm</guid>
      <description>&lt;p&gt;Log4j is a popular Java logging tool with a critical cybersecurity vulnerability that gained global attention in December 2021.  The U.S. Dept. of Homeland Security’s Cyber Safety Review Board stated in a &lt;a href="https://www.cisa.gov/sites/default/files/publications/CSRB-Report-on-Log4-July-11-2022_508.pdf"&gt;recent report&lt;/a&gt; that it is one of the most serious vulnerabilities seen in years. Because of the popularity of the Log4j tool with Java developers, the problem is an “endemic vulnerability” for the software industry, according to the board. Luckily, we can identify this security vulnerability in Java projects at no cost with the fastest and most accurate free scanner in the market, &lt;a href="https://www.contrastsecurity.com/developer/codesec?utm_source=CodeSec+Log4j&amp;amp;utm_medium=Blog+Post&amp;amp;utm_campaign=CodeSec_Log4j_Blog&amp;amp;utm_id=CodeSec+-+Log4j"&gt;CodeSec by Contrast!&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Get started with CodeSec
&lt;/h2&gt;

&lt;p&gt;For this walkthrough, we will use both CodeSec and a demo of the Log4j exploit. The first step is to get CodeSec onto your machine.  Contrast Security has great instructions on our &lt;a href="https://www.contrastsecurity.com/developer/codesec?utm_source=CodeSec+Log4j&amp;amp;utm_medium=Blog+Post&amp;amp;utm_campaign=CodeSec_Log4j_Blog&amp;amp;utm_id=CodeSec+-+Log4j"&gt;Developer Central hub&lt;/a&gt; for getting started with CodeSec, but we will review the process here as well.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;a. Install CodeSec&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;As of August 2022 Contrast Security offers three options for installing CodeSec: Homebrew for MacOS, NPM for any operating system running newer NodeJS versions and binaries through Artifactory.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;For this example we will be using NPM:&lt;/strong&gt;&lt;br&gt;
Run Command: &lt;em&gt;&lt;strong&gt;npm install -g @contrast/contrast&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--n4-k6_Qm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2ng6odav6blr1jjqqj7g.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--n4-k6_Qm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2ng6odav6blr1jjqqj7g.png" alt="CodeSec NPM Install" width="880" height="433"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pro tip:&lt;/strong&gt; Running the command &lt;em&gt;&lt;strong&gt;contrast help&lt;/strong&gt;&lt;/em&gt; will show you the usage guide if the install has gone successfully.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--W1dQNADx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gi3e6x2sk3sjul1k4d6m.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--W1dQNADx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gi3e6x2sk3sjul1k4d6m.png" alt="CodeSec Help Action" width="880" height="956"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;b. Authenticate&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Authentication is needed to access Contrast Security’s enterprise-class cybersecurity services through CodeSec. You can use your existing Github or Google account to authenticate.&lt;/p&gt;

&lt;p&gt;To authenticate, run the command &lt;strong&gt;&lt;em&gt;contrast auth&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--xQAhC74M--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/edyfekbs4385h98hv6y7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--xQAhC74M--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/edyfekbs4385h98hv6y7.png" alt="Contrast Auth Command" width="880" height="335"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A tab will then open in your browser, asking you to finalize your authentication by connecting with your existing Google or GitHub account.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Qds5Aun0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g9seb5njx0nyyuxgyut1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Qds5Aun0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g9seb5njx0nyyuxgyut1.png" alt="CodeSec Auth" width="880" height="359"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;*&lt;em&gt;Note: *&lt;/em&gt; When completing the authentication steps for the first time, your command line may disconnect and output a message stating that the authentication session has timed-out. But do not worry! By re-running the command contrast auth, a new browser window will open, and this time when the initial path chosen to authenticate (GitHub or Google) is clicked, the window will immediately redirect to the Success page, and your terminal will output an “Authentication successful” line.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--VQBnkV91--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b748dizpafo0w73nql2j.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--VQBnkV91--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b748dizpafo0w73nql2j.png" alt="CodeSec Auth Action" width="880" height="508"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--a0dsZuDn--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4hmjp3c881r17brponwr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--a0dsZuDn--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4hmjp3c881r17brponwr.png" alt="CodeSec Auth Success" width="880" height="490"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now that CodeSec is set up to use locally, the next step is to get a demo of the Log4j vulnerability.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Log4j vulnerability
&lt;/h2&gt;

&lt;p&gt;The &lt;a href="https://nvd.nist.gov/vuln/detail/CVE-2021-44228"&gt;NIST National Vulnerability Database’s page&lt;/a&gt; on the Log4j vulnerability has a wealth of resources about this security concern, including links to demo projects with example code implementing the vulnerability.&lt;/p&gt;

&lt;p&gt;One linked project is the “Apache Log4j2 2.14.1 Remote Code Execution” project from Packet Storm (&lt;a href="https://packetstormsecurity.com/files/165225/Apache-Log4j2-2.14.1-Remote-Code-Execution.html"&gt;available here&lt;/a&gt;). It is a very minimalist proof of concept project that includes vulnerable versions (in this case, 2.14.1) of the Log4j libraries as Maven dependencies in the project’s pom.xml file.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ADu0acMG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/i6kmjn8hsyfz0da9q6j5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ADu0acMG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/i6kmjn8hsyfz0da9q6j5.png" alt="CodeSec Protect Against Log4J" width="880" height="423"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once you have the project downloaded and unzipped locally, you can check it for vulnerable third-party dependencies.  In our case, we are concerned with using vulnerable versions of Log4j.&lt;/p&gt;

&lt;p&gt;Utilize CodeSec by Contrast to secure those vulnerable libraries by running the command: &lt;em&gt;&lt;strong&gt;contrast audit&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--OasEMdk3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zigo897qo7jr25nv2sce.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--OasEMdk3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zigo897qo7jr25nv2sce.png" alt="CodeSec Protect Against Log4J" width="583" height="388"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;As described, this simple command from CodeSec found the vulnerable versions of Log4j defined in our project. Additionally, it lists the specific vulnerability codes (which we could look up in the NIST NVD database for more details), and it gives advice on how to make the project more secure by upgrading the versions of Log4j used.&lt;/p&gt;

&lt;p&gt;Contrast Security also has an entire &lt;a href="https://www.contrastsecurity.com/log4j2?hsLang=en-us"&gt;online portal dedicated to the Log4j problem.&lt;/a&gt; There you can find more resources, whitepapers and information about all the other tools Contrast Security offers for handling and remediating your Log4j risks.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;CodeSec gives developers an expert tool that handles the chores of searching Java projects for vulnerabilities while staying up to date on the latest developments in cybersecurity research.  It is a highly valuable and free utility that can improve a team’s software development practices.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://www.contrastsecurity.com/developer/codesec?utm_source=CodeSec+Log4j&amp;amp;utm_medium=Blog+Post&amp;amp;utm_campaign=CodeSec_Log4j_Blog&amp;amp;utm_id=CodeSec+-+Log4j"&gt;Start securing your code today for free with CodeSec&lt;br&gt;
&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>java</category>
      <category>devops</category>
      <category>security</category>
    </item>
    <item>
      <title>Secure Open Source Code in minutes for free with CodeSec</title>
      <dc:creator>Orlandov14</dc:creator>
      <pubDate>Wed, 03 Aug 2022 20:53:00 +0000</pubDate>
      <link>https://dev.to/codesec/secure-open-source-code-create-sboms-for-free-in-minutes-with-codesec-4og9</link>
      <guid>https://dev.to/codesec/secure-open-source-code-create-sboms-for-free-in-minutes-with-codesec-4og9</guid>
      <description>&lt;p&gt;Contrast Security is expanding its free developer tool, CodeSec, to include Open Source Security (OSS) and Software Bill of Material (SBOM) creation with its new SCA capability. Empowering developers to Identify vulnerable libraries in OSS and receive actionable remediation guidance, allowing them to ship code faster. The new feature will also enable users to manage software supply chain risk by allowing them to create SBOMs with ease.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is CodeSec?&lt;/strong&gt;&lt;br&gt;
Contrast’s new free developer tool brings the fastest and most accurate scanner on the market right to developers for free. By packaging the same scanning engine used in our Contrast Security platform into a simple command-line interface (CLI), CodeSec empowers developers to scan, secure, and ship their code in minutes. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Getting Started with CodeSec - SCA in just 3 steps&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1.&lt;/strong&gt; Open a command-prompt or terminal, then install with NPM, Homebrew or by downloading binaries from Artifactory:&lt;/p&gt;

&lt;p&gt;For this example will be using NPM. For other install options &lt;a href="https://www.contrastsecurity.com/developer/codesec/"&gt;click here&lt;/a&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install -g @contrast/contrast
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;2.&lt;/strong&gt; Authenticate using your existing GitHub or Google account.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;contrast auth
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;3.&lt;/strong&gt; Time to Scan your Open Source!&lt;/p&gt;

&lt;p&gt;Navigate to your chosen directory.&lt;br&gt;
Then run a SCA scan on your Java, Javascript, Python, Ruby, GO, PHP, .NET code with the following command.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;contrast audit
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--qIReiYUx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/08k4o3ybbhn02355uqko.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--qIReiYUx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/08k4o3ybbhn02355uqko.png" alt="CodeSec SCA Output" width="880" height="524"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In minutes CodeSec by Contrast will report all vulnerabilities found with actionable remediation guidance.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Happy Scanning!&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>java</category>
      <category>javascript</category>
      <category>opensource</category>
      <category>python</category>
    </item>
    <item>
      <title>Test out CodeSec for yourself with our evaluator guide!</title>
      <dc:creator>Orlandov14</dc:creator>
      <pubDate>Thu, 16 Jun 2022 14:54:51 +0000</pubDate>
      <link>https://dev.to/codesec/test-out-codesec-for-yourself-with-our-evaluator-guide-2ghc</link>
      <guid>https://dev.to/codesec/test-out-codesec-for-yourself-with-our-evaluator-guide-2ghc</guid>
      <description>&lt;p&gt;&lt;strong&gt;CodeSec by Contrast&lt;/strong&gt; brings the fastest and most accurate scanner in the market right to your development workflow &lt;strong&gt;for free&lt;/strong&gt;! &lt;/p&gt;

&lt;p&gt;Make code and serverless security simple and efficient with quick scan times, market-leading accuracy, actionable results and seamless integration. Up and running in less than 5 minutes.&lt;/p&gt;

&lt;p&gt;We here at Contrast, have created this guide to not only show developers what CodeSec can offer, but also give them the tools to test it and see for themselves just how fast, accurate and seamless CodeSec can be! &lt;/p&gt;

&lt;p&gt;See For Yourself: &lt;a href="https://www.contrastsecurity.com/security-influencers/codesec-by-contrast-security-evaluator-guide"&gt;https://www.contrastsecurity.com/security-influencers/codesec-by-contrast-security-evaluator-guide&lt;/a&gt;&lt;/p&gt;

</description>
      <category>programming</category>
      <category>java</category>
      <category>cloud</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>New Free Developer Security Tool of 2022!</title>
      <dc:creator>Orlandov14</dc:creator>
      <pubDate>Tue, 14 Jun 2022 19:01:15 +0000</pubDate>
      <link>https://dev.to/codesec/new-free-developer-security-tool-48a0</link>
      <guid>https://dev.to/codesec/new-free-developer-security-tool-48a0</guid>
      <description>&lt;p&gt;&lt;strong&gt;Meet CodeSec by Contrast&lt;/strong&gt;&lt;br&gt;
Secure Code with the fastest and most accurate scanner in the market. Get Immediate &amp;amp; actionable result. Up and running in less than 5 minutes for free!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;CodeSec makes developer security efficient and accurate by delivering the following capabilities right to the developer’s laptop, through a simple command line interface (CLI):&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;CodeSec – SCA:&lt;/strong&gt; Secure vulnerable libraries in your open-source software (OSS) with lighting speed, accuracy, and actionable remediation guidance to ship code faster and create a standardized Software Bill of Materials (SBOM) to manage supply chain risk with ease. Additionally, you can secure your Github pipeline with Contrast GitHub Actions for free. &lt;a href="https://github.com/marketplace/actions/contrast-security-sca"&gt;Click Here&lt;/a&gt; to learn more. &lt;strong&gt;Supports:&lt;/strong&gt; Java, JavaScript, Python, Ruby, GO, PHP, and .NET&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;CodeSec – Scan:&lt;/strong&gt; Optimize code security for applications with fast, industry-leading (SAST) scans and actionable remediation guidance, in a simple command line interface. Additionally, you can secure your Github pipeline with Contrast GitHub Actions for free. &lt;a href="https://github.com/marketplace/actions/contrast-scan-analyze"&gt;Click Here&lt;/a&gt;  to learn more. &lt;strong&gt;Supports:&lt;/strong&gt; Java, JavaScript, Angular, React, JQuery, and .NET&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;CodeSec – Serverless:&lt;/strong&gt; Take advantage of a new ground-breaking application security tool for serverless environments in AWS Lambda functions that detects cloud-native vulnerabilities quickly and accurately while providing actionable remediation guidance. &lt;strong&gt;Supports:&lt;/strong&gt; Java, and Python&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://www.contrastsecurity.com/developer/codesec/"&gt;Start Now For Free&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>java</category>
      <category>python</category>
      <category>beginners</category>
      <category>javascript</category>
    </item>
  </channel>
</rss>
