<?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>Forem: Andreas Sommarström</title>
    <description>The latest articles on Forem by Andreas Sommarström (@sumstrm).</description>
    <link>https://forem.com/sumstrm</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%2Fuser%2Fprofile_image%2F416513%2F9c4bfc54-d8ff-4de8-b0e5-db2b4a71ec2a.png</url>
      <title>Forem: Andreas Sommarström</title>
      <link>https://forem.com/sumstrm</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/sumstrm"/>
    <language>en</language>
    <item>
      <title>How to use a secure private NuGet source in Visual Studio or JetBrains Rider</title>
      <dc:creator>Andreas Sommarström</dc:creator>
      <pubDate>Wed, 16 Feb 2022 19:24:16 +0000</pubDate>
      <link>https://forem.com/sumstrm/how-to-use-a-secure-private-nuget-source-in-visual-studio-or-jetbrains-rider-34hm</link>
      <guid>https://forem.com/sumstrm/how-to-use-a-secure-private-nuget-source-in-visual-studio-or-jetbrains-rider-34hm</guid>
      <description>&lt;p&gt;&lt;em&gt;A how to guide on using a secure and private NuGet package source for your .NET dependencies in Visual Studio and JetBrains Rider.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;.NET, the Microsoft supported open source framework, is celebrating 20 years! And wow, has there been a lot of changes in .NET and software development in general in those 20 years.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Where before every piece of code and functionality needed to be produced in-house, there are now millions of available packages in central repositories for users to consume — with obvious efficiency advantages.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;NuGet&lt;/strong&gt;, the package manager for .NET, allow developers to easily share and consume reusable packages dependencies for their &lt;code&gt;C#&lt;/code&gt;, &lt;code&gt;F#&lt;/code&gt; and &lt;code&gt;Visual Basic .NET&lt;/code&gt; applications. With &lt;em&gt;nuget.org&lt;/em&gt; providing easy access to over 4 millions versions, both from Microsoft and open source developers.&lt;/p&gt;

&lt;p&gt;But using more and more open source components also puts advanced requirements on keeping control over the code used. With security attacks targeting the open source software supply chain increased by 650% in 2021 alone it is more important than ever for organizations to protect the software they build — and every developer environment, CI/CD system and server.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Need a private NuGet feed for both internal .NET packages and public dependencies? &lt;a href="https://bytesafe.dev" rel="noopener noreferrer"&gt;Bytesafe&lt;/a&gt; feeds are cloud hosted, and compatible with Visual Studio, JetBrains Rider and the NuGet CLI. You can get started instantly and build your projects securely with the tools of your choice.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Four reasons to use a private NuGet feed
&lt;/h2&gt;

&lt;p&gt;A private NuGet source is a necessity for sharing internal packages and code in many organizations. But a private source also allows for control and help keep unwanted dependencies out.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqu60ryjg42lmohl8k9eh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqu60ryjg42lmohl8k9eh.png" alt="security vulnerability in nuget package"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Secure source for open source dependencies&lt;/strong&gt;: Don’t allow free entry for untrusted code from public sources. Include approved dependencies, according to your rules.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Share internal packages&lt;/strong&gt;: Authorized and personal access to your organization’s private packages.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cache/proxy public packages&lt;/strong&gt;: Don’t depend directly on public repositories like nuget.org. Make sure your organization’s packages are always available when you need them.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Enforce security policies&lt;/strong&gt;: Scan for vulnerabilities and automatically block access to unwanted and untrusted dependencies.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Getting started with a private NuGet feed
&lt;/h2&gt;

&lt;p&gt;Using a private NuGet feed instead of the default package source is easy. With some simple config you can have your IDE’s like Visual Studio and JetBrains Rider fetch dependencies from a private feed in place of nuget.org.&lt;/p&gt;

&lt;p&gt;On top of IDE support the nuget package management tool has full support for private feeds, both as a target when deploying packages or as a package source for dependencies.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;These steps assume users have access to a Bytesafe workspace. If not — &lt;strong&gt;&lt;a href="https://login.bytesafe.dev/signup" rel="noopener noreferrer"&gt;Sign up for Bytesafe&lt;/a&gt;&lt;/strong&gt; today for free.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Create a NuGet feed
&lt;/h3&gt;

&lt;p&gt;To get started you need to create a NuGet registry (the Bytesafe equivalent of a feed or repository) and configure access to it in your client of choice.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpxfzro6mkkrx5ht31kte.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpxfzro6mkkrx5ht31kte.png" alt="Create a NuGet registry / feed / repository in Bytesafe"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After you have created your NuGet registry, you need to add a package source to your configuration.&lt;/p&gt;

&lt;p&gt;Create an access token in Bytesafe and add it together with the registry URL to your list of approved package sources. The access token ensures only intended users have access to packages stored in Bytesafe.&lt;/p&gt;

&lt;p&gt;Visual Studio &amp;amp; JetBrains Rider users can do this directly in the NuGet package tool in their IDE (see sections on IDE integrations for more details). CLI users can alternatively add the package source using nuget.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

&lt;span class="c"&gt;# Add the URL, username and access token (password) to your nuget sources&lt;/span&gt;
&lt;span class="nv"&gt;$ &lt;/span&gt;nuget sources add &lt;span class="nt"&gt;-Name&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;REGISTRY&lt;span class="o"&gt;}&lt;/span&gt; &lt;span class="nt"&gt;-Source&lt;/span&gt; https://&lt;span class="o"&gt;{&lt;/span&gt;WORKSPACE&lt;span class="o"&gt;}&lt;/span&gt;.bytesafe.dev/nuget/&lt;span class="o"&gt;{&lt;/span&gt;REGISTRY&lt;span class="o"&gt;}&lt;/span&gt;/index.json &lt;span class="nt"&gt;-Username&lt;/span&gt; bytesafe &lt;span class="nt"&gt;-Password&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;TOKEN&lt;span class="o"&gt;}&lt;/span&gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Bytesafe provides contextual and copy-paste ready instructions on how to access your private NuGet feed.&lt;/p&gt;

&lt;p&gt;The package source information will be added to the &lt;code&gt;NuGet.Config&lt;/code&gt; file (used by both nuget and IDE’s). For more information on sources and the NuGet config file, see NuGet in the Bytesafe documentation.&lt;/p&gt;

&lt;h3&gt;
  
  
  Publish a NuGet package
&lt;/h3&gt;

&lt;p&gt;NuGet packages can be added to your private NuGet feed using &lt;code&gt;nuget push&lt;/code&gt; or by uploading the package files manually.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

&lt;span class="c"&gt;# To publish packages using nuget set an apikey for the source&lt;/span&gt;
&lt;span class="nv"&gt;$ &lt;/span&gt;nuget setapikey &lt;span class="o"&gt;{&lt;/span&gt;TOKEN&lt;span class="o"&gt;}&lt;/span&gt; &lt;span class="nt"&gt;-Source&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;REGISTRY&lt;span class="o"&gt;}&lt;/span&gt;
…


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;With your source configured you can publish packages to your private feed for other internal developers or CI/CD to access.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

&lt;span class="c"&gt;# Create a nuget package according to project files&lt;/span&gt;
&lt;span class="nv"&gt;$ &lt;/span&gt;nuget pack
…
&lt;span class="c"&gt;# Publish package to registry using nuget. Replace {REGISTRY} with source name&lt;/span&gt;
&lt;span class="nv"&gt;$ &lt;/span&gt;nuget push &lt;span class="o"&gt;{&lt;/span&gt;PACKAGE&lt;span class="o"&gt;}&lt;/span&gt; &lt;span class="nt"&gt;-Source&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;REGISTRY&lt;span class="o"&gt;}&lt;/span&gt;
…


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h3&gt;
  
  
  Restoring NuGet project dependencies
&lt;/h3&gt;

&lt;p&gt;With the public NuGet Gallery (nuget.org) configured as an upstream, Bytesafe will proxy public dependencies and pull any required (and allowed) version into your private NuGet feed.&lt;/p&gt;

&lt;p&gt;To make sure security features are not bypassed it’s recommended to disable &lt;em&gt;nuget.org&lt;/em&gt; as a package source in the NuGet.Config (the package manager fetches packages from all enabled sources).&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

&lt;span class="c"&gt;# Disable nuget.org as a package source&lt;/span&gt;
&lt;span class="nv"&gt;$ &lt;/span&gt;nuget sources disable &lt;span class="nt"&gt;-Name&lt;/span&gt; nuget.org
…


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;There are multiple ways to specify project dependencies. I prefer package references (&lt;code&gt;&amp;lt;PackageReference&amp;gt;&lt;/code&gt;) in the project file (&lt;code&gt;.csproj&lt;/code&gt;).&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight xml"&gt;&lt;code&gt;

&lt;span class="cp"&gt;&amp;lt;! — Example package reference in .csproj file --&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;ItemGroup&amp;gt;&lt;/span&gt;
   &lt;span class="cp"&gt;&amp;lt;! — … --&amp;gt;&lt;/span&gt;
   &lt;span class="nt"&gt;&amp;lt;PackageReference&lt;/span&gt; &lt;span class="na"&gt;Include=&lt;/span&gt;&lt;span class="s"&gt;”Newtonsoft.Json”&lt;/span&gt; &lt;span class="na"&gt;Version=&lt;/span&gt;&lt;span class="s"&gt;”13.0.1"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
   &lt;span class="cp"&gt;&amp;lt;! — … --&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/ItemGroup&amp;gt;&lt;/span&gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;With project dependencies added to the project, run the &lt;code&gt;nuget restore&lt;/code&gt; command to restore project dependencies.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

&lt;span class="c"&gt;# Restore package dependencies from Bytesafe&lt;/span&gt;
&lt;span class="nv"&gt;$ &lt;/span&gt;nuget restore &lt;span class="nt"&gt;-Source&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;REGISTRY&lt;span class="o"&gt;}&lt;/span&gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;blockquote&gt;
&lt;p&gt;Most IDE’s restore project dependencies by default on project startup or when detecting changes.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Using Visual Studio with your private NuGet feed
&lt;/h2&gt;

&lt;p&gt;Visual Studio is an integral part of the .NET ecosystem and the default IDE for many .NET developers.&lt;/p&gt;

&lt;p&gt;Private NuGet registries can easily be integrated as a package source in Visual Studio. Pre-existing NuGet.Config files will be identified by Visual Studio and used to configure package sources for NuGet Package Manager.&lt;/p&gt;

&lt;h3&gt;
  
  
  Adding a source manually inside Visual Studio
&lt;/h3&gt;

&lt;p&gt;Add the Name, URL and credentials for the registry as the source in the Visual Studio configuration. Access Package Sources in the options (&lt;strong&gt;Windows: NuGet Package Manager &amp;gt; Package Sources / Mac: NuGet &amp;gt; Sources&lt;/strong&gt;).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2xvmbtur3ugmped330cg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2xvmbtur3ugmped330cg.png" alt="Adding private package source in Visual Studio"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;With the source added, packages are automatically able to be restored and updated in Visual Studio using your Bytesafe NuGet registry.&lt;/p&gt;

&lt;p&gt;Any packages available in the private feed will also be available to browse and search in Visual Studio.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Visual Studio Code and some distribution of Visual Studio manage private sources using the nuget cli.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Using JetBrains Rider with your private NuGet feed
&lt;/h2&gt;

&lt;p&gt;JetBrains Rider is the main alternative to Visual Studio for many teams. Like with Visual Studio, private NuGet feeds are easily integrated as a package source for JetBrains Rider.&lt;/p&gt;

&lt;p&gt;It’s recommended for users to add Bytesafe as a new package source directly in JetBrains Rider to avoid conflicts. Some distributions lack support for encrypted passwords from NuGet.Config.&lt;/p&gt;

&lt;h3&gt;
  
  
  Adding a source manually inside JetBrains Rider
&lt;/h3&gt;

&lt;p&gt;Add the Name, URL and credentials for the new feed in the NuGet Sources configuration.&lt;/p&gt;

&lt;p&gt;Access the NuGet Tool window from the bottom toolbar or by right-clicking any project dependency and select Manage NuGet Packages.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqbyaotem0ky2u0hhnm1j.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqbyaotem0ky2u0hhnm1j.png" alt="Adding a private NuGet feed in JetBrains Rider"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;With the new source added, packages are able to be browsed, restored and updated in Rider using your private NuGet server.&lt;/p&gt;

&lt;h2&gt;
  
  
  Want to know more about Bytesafe private NuGet feeds?
&lt;/h2&gt;

&lt;p&gt;Visit &lt;a href="https://bytesafe.dev/nuget/" rel="noopener noreferrer"&gt;Bytesafe for NuGet /.NET&lt;/a&gt; to learn more. &lt;/p&gt;

&lt;p&gt;Want to know more about secure supply chains — read more about our &lt;a href="https://bytesafe.dev/dependency-firewall/" rel="noopener noreferrer"&gt;firewall for dependencies&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Want to try &lt;a href="https://login.bytesafe.dev/signup" rel="noopener noreferrer"&gt;Bytesafe&lt;/a&gt;? Sign up and get started today for free.&lt;/p&gt;

</description>
      <category>dotnet</category>
      <category>security</category>
      <category>tutorial</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Time for secure dependencies? Private Maven repository for Java, Kotlin, Scala</title>
      <dc:creator>Andreas Sommarström</dc:creator>
      <pubDate>Wed, 05 Jan 2022 17:59:12 +0000</pubDate>
      <link>https://forem.com/sumstrm/time-for-secure-dependencies-private-maven-repository-for-java-kotlin-scala-5afl</link>
      <guid>https://forem.com/sumstrm/time-for-secure-dependencies-private-maven-repository-for-java-kotlin-scala-5afl</guid>
      <description>&lt;p&gt;Maven is a build tool to manage &lt;strong&gt;Java&lt;/strong&gt;, &lt;strong&gt;Kotlin&lt;/strong&gt;, &lt;strong&gt;Scala&lt;/strong&gt; or similar JVM based languages projects - including all its dependencies, both open source and private. A great way to make sure your organization uses trusted and approved dependencies is to use a private Maven repository - and it's no more complicated than using the default repository. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The two main reasons to use private Maven repositories for your JVM packages:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;em&gt;Secure source for open source dependencies&lt;/em&gt;. With 1300+ public repositories and over 24 million Java artifacts, organizations need to control the code they are using - and not allow free entry of untrusted components.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;em&gt;Distribute internal components&lt;/em&gt;. With a wide range of applications that depend on each other, organizations require private repositories to share code between services while keeping artifacts private and secure.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Protect your software supply chain and make sure every developer and CI/CD system uses trusted dependencies from a single secure source. With hundreds of automated CI/CD pipelines and decentralized developers this is not an easy task - but definitely achievable with the right tools.&lt;/p&gt;

&lt;p&gt;With the recent disclosures of critical vulnerabilities in the widely used open source framework &lt;code&gt;log4j&lt;/code&gt;, this is more relevant than ever.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdgcobl00o9r5eex2t0th.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdgcobl00o9r5eex2t0th.png" alt="Apache log4j vulernabilities"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The exploits in &lt;a href="https://www.cisa.gov/uscert/apache-log4j-vulnerability-guidance" rel="noopener noreferrer"&gt;log4j&lt;/a&gt; have once again stressed the need to keep track of open source dependencies - &lt;em&gt;else risk being exploited by vulnerabilities that could give full server control&lt;/em&gt;. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;This post describes how you easily set up a secure and private Maven repository - so you can stay in control of the dependencies you are using.&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;&lt;em&gt;Require a private Maven repository of your own? &lt;a href="https://bytesafe.dev/maven/" rel="noopener noreferrer"&gt;Bytesafe&lt;/a&gt; repositories are compatible with both&lt;/em&gt; &lt;strong&gt;&lt;em&gt;Maven&lt;/em&gt;&lt;/strong&gt; &lt;em&gt;and&lt;/em&gt; &lt;strong&gt;&lt;em&gt;Gradle&lt;/em&gt;&lt;/strong&gt; &lt;em&gt;- hosted so you can get started instantly without having to think of infrastructure.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Getting started with a secure Maven repository
&lt;/h2&gt;

&lt;p&gt;With minimal configuration your build clients can fetch trusted dependencies from your private repository instead of relying on (the default) Maven Central.&lt;/p&gt;

&lt;p&gt;The popular build tools Maven &amp;amp; Gradle fully support private repositories, both as the target when deploying packages or as the source when fetching dependencies. &lt;/p&gt;

&lt;h3&gt;
  
  
  Create a Maven repository
&lt;/h3&gt;

&lt;p&gt;To get started you need to create a Maven repository and configure access to it for your client of choice.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fopmbun2yfhnf23ul1i5i.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fopmbun2yfhnf23ul1i5i.png" alt="create a Maven registry in Bytesafe"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After you have created your Maven repository, you need to add an access token to your project. The access token ensures only intended users have access to packages stored in the private registry.&lt;/p&gt;

&lt;p&gt;Create an access token and add it to your list of repositories in your configuration file for Maven (&lt;code&gt;settings.xml&lt;/code&gt;). &lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight xml"&gt;&lt;code&gt;

&lt;span class="c"&gt;&amp;lt;!-- Add the access token and id configuration to settings.xml --&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;servers&amp;gt;&lt;/span&gt; 
    &lt;span class="nt"&gt;&amp;lt;server&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;id&amp;gt;&lt;/span&gt;{MAVEN-REGISTRY}&lt;span class="nt"&gt;&amp;lt;/id&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;username&amp;gt;&lt;/span&gt;{USER}&lt;span class="nt"&gt;&amp;lt;/username&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;password&amp;gt;&lt;/span&gt;{ACCESS-TOKEN}&lt;span class="nt"&gt;&amp;lt;/password&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;configuration&amp;gt;&lt;/span&gt;
            &lt;span class="nt"&gt;&amp;lt;httpConfiguration&amp;gt;&lt;/span&gt;
                &lt;span class="nt"&gt;&amp;lt;all&amp;gt;&lt;/span&gt;
                    &lt;span class="nt"&gt;&amp;lt;usePreemptive&amp;gt;&lt;/span&gt;true&lt;span class="nt"&gt;&amp;lt;/usePreemptive&amp;gt;&lt;/span&gt;
                &lt;span class="nt"&gt;&amp;lt;/all&amp;gt;&lt;/span&gt;
            &lt;span class="nt"&gt;&amp;lt;/httpConfiguration&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;/configuration&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/server&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/servers&amp;gt;&lt;/span&gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;The &lt;code&gt;id&lt;/code&gt; in &lt;code&gt;settings.xml&lt;/code&gt; needs to match other configuration provided for uploading packages and installing dependencies.&lt;/p&gt;

&lt;h3&gt;
  
  
  Upload a Maven package
&lt;/h3&gt;

&lt;p&gt;Maven artifacts can be added to the private repository using &lt;code&gt;mvn deploy&lt;/code&gt; (or by uploading files manually).&lt;/p&gt;

&lt;p&gt;To deploy using the &lt;code&gt;mvn&lt;/code&gt; client users need to add the necessary configuration to the project &lt;code&gt;pom.xml&lt;/code&gt; file.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight xml"&gt;&lt;code&gt;

&lt;span class="c"&gt;&amp;lt;!-- Add the repository and snapshotRepository configuration to pom.xml --&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;distributionManagement&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;repository&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;id&amp;gt;&lt;/span&gt;{MAVEN-REGISTRY}&lt;span class="nt"&gt;&amp;lt;/id&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;url&amp;gt;&lt;/span&gt;https://{WORKSPACE}.bytesafe.dev/maven/{REGISTRY}/&lt;span class="nt"&gt;&amp;lt;/url&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/repository&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;snapshotRepository&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;id&amp;gt;&lt;/span&gt;{MAVEN-REGISTRY}&lt;span class="err"&gt;&amp;lt;&lt;/span&gt;/id
        &lt;span class="nt"&gt;&amp;lt;url&amp;gt;&lt;/span&gt;https://{WORKSPACE}.bytesafe.dev/maven/{REGISTRY}/&lt;span class="nt"&gt;&amp;lt;/url&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/snapshotRepository&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/distributionManagement&amp;gt;&lt;/span&gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Users can choose to deploy snapshots and release versions to either the same or different registries.&lt;/p&gt;

&lt;p&gt;With your Maven project configured you can deploy artifacts to your private registry either manually or as part of your CI/CD chain.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

&lt;span class="c"&gt;# Deploy artifacts to Bytesafe using Maven&lt;/span&gt;
&lt;span class="nv"&gt;$ &lt;/span&gt;mvn clean deploy


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;As soon as the process has completed, the artifact will be available and accessible.&lt;/p&gt;

&lt;h3&gt;
  
  
  Resolving Maven project dependencies
&lt;/h3&gt;

&lt;p&gt;A major part of building a Maven project is resolving any dependencies specified for the project. Any &lt;code&gt;&amp;lt;dependency&amp;gt;&lt;/code&gt; specified in the &lt;code&gt;pom.xml&lt;/code&gt; file, will be fetched when building the project.&lt;/p&gt;

&lt;p&gt;When using private repositories from &lt;a href="https://bytesafe.dev" rel="noopener noreferrer"&gt;Bytesafe&lt;/a&gt;, public dependencies will be proxied, pulling any required (and allowed) version into your private Maven repository. Using public repositories like Maven Central as an &lt;a href="https://docs.bytesafe.dev/upstreams/configuring-upstreams/" rel="noopener noreferrer"&gt;upstream&lt;/a&gt; makes sure you can access your organization's required open source dependencies - while maintaining security and control.&lt;/p&gt;

&lt;p&gt;To make sure security features are not bypassed for individual projects, it's recommended to use a mirror configuration to set the private Maven repository as the general package source.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight xml"&gt;&lt;code&gt;

&lt;span class="c"&gt;&amp;lt;!-- Mirror configuration in settings.xml --&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;mirrors&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;mirror&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;id&amp;gt;&lt;/span&gt;{MAVEN-REGISTRY}&lt;span class="nt"&gt;&amp;lt;/id&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;mirrorOf&amp;gt;&lt;/span&gt;*&lt;span class="nt"&gt;&amp;lt;/mirrorOf&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;url&amp;gt;&lt;/span&gt;https://{WORKSPACE}.bytesafe.dev/maven/{REGISTRY}/&lt;span class="nt"&gt;&amp;lt;/url&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/mirror&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/mirrors&amp;gt;&lt;/span&gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;With project dependencies specified in the &lt;code&gt;pom.xml&lt;/code&gt; file, you can install dependencies using regular Maven commands like &lt;code&gt;mvn install&lt;/code&gt; or &lt;code&gt;mvn verify&lt;/code&gt;.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

&lt;span class="c"&gt;# Install Maven dependencies from Bytesafe&lt;/span&gt;
&lt;span class="nv"&gt;$ &lt;/span&gt;mvn clean &lt;span class="nb"&gt;install&lt;/span&gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h4&gt;
  
  
  Installing SNAPSHOT versions
&lt;/h4&gt;

&lt;p&gt;To install snapshot versions (&lt;code&gt;X.-SNAPSHOT&lt;/code&gt;) with Maven, users are required to explicitly specify the use of a snapshot repository. This is because there is no default snapshot repository associated with Maven.&lt;/p&gt;

&lt;p&gt;This can be set either per project in the &lt;code&gt;pom.xml&lt;/code&gt; file or project agnostic as part of a user's profile. See the &lt;a href="https://docs.bytesafe.dev/package-managers/maven/#installing-snapshot-versions" rel="noopener noreferrer"&gt;Bytesafe documentation&lt;/a&gt; or the official &lt;a href="https://maven.apache.org/guides/getting-started/index.html" rel="noopener noreferrer"&gt;Maven docs&lt;/a&gt; for more details. &lt;/p&gt;
&lt;h2&gt;
  
  
  Using Gradle with your Maven repository
&lt;/h2&gt;

&lt;p&gt;Gradle is a popular alternative build automation tool for JVM-based projects that works with Maven compatible repositories.&lt;/p&gt;

&lt;p&gt;To resolve project dependencies from the private Maven repository, the repository needs to be declared in the &lt;code&gt;build.gradle&lt;/code&gt; file.&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight kotlin"&gt;&lt;code&gt;


&lt;span class="c1"&gt;// repository configuration in build.gradle&lt;/span&gt;

&lt;span class="nf"&gt;repositories&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
   &lt;span class="nf"&gt;maven&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="err"&gt;'&lt;/span&gt;&lt;span class="n"&gt;bytesafe&lt;/span&gt;&lt;span class="err"&gt;'&lt;/span&gt;
      &lt;span class="n"&gt;url&lt;/span&gt; &lt;span class="err"&gt;'&lt;/span&gt;&lt;span class="n"&gt;https&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="c1"&gt;//{WORKSPACE}.bytesafe.dev/maven/{REGISTRY}/'&lt;/span&gt;
      &lt;span class="nf"&gt;credentials&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
         &lt;span class="n"&gt;username&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="err"&gt;'&lt;/span&gt;&lt;span class="n"&gt;bytesafe&lt;/span&gt;&lt;span class="err"&gt;'&lt;/span&gt;
         &lt;span class="n"&gt;password&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="err"&gt;'&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nc"&gt;ACCESS-TOKEN&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="err"&gt;'&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;
   &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// specify project dependencies&lt;/span&gt;

&lt;span class="nf"&gt;dependencies&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
   &lt;span class="n"&gt;implementation&lt;/span&gt; &lt;span class="err"&gt;'&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nc"&gt;GROUP_ID&lt;/span&gt;&lt;span class="p"&gt;}:{&lt;/span&gt;&lt;span class="nc"&gt;ARTIFACT_ID&lt;/span&gt;&lt;span class="p"&gt;}:{&lt;/span&gt;&lt;span class="nc"&gt;VERSION&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="err"&gt;'&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;



&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Users should consider storing credentials in &lt;code&gt;~/.gradle/gradle.properties&lt;/code&gt; file in-place of &lt;code&gt;build.gradle&lt;/code&gt; to avoid unintended distribution of credentials.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;To publish a package using Gradle, enable the &lt;code&gt;maven-publish&lt;/code&gt; plugin and specify the target publishing repository in the &lt;code&gt;build.gradle&lt;/code&gt; file.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight kotlin"&gt;&lt;code&gt;

&lt;span class="c1"&gt;// enable the maven-publish plugin&lt;/span&gt;
&lt;span class="nf"&gt;plugins&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
   &lt;span class="n"&gt;id&lt;/span&gt; &lt;span class="err"&gt;'&lt;/span&gt;&lt;span class="n"&gt;maven-publish&lt;/span&gt;&lt;span class="err"&gt;'&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nf"&gt;publishing&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
   &lt;span class="nf"&gt;publications&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nf"&gt;maven&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;MavenPublication&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
   &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nf"&gt;repositories&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
   &lt;span class="nf"&gt;maven&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="err"&gt;'&lt;/span&gt;&lt;span class="n"&gt;bytesafe&lt;/span&gt;&lt;span class="err"&gt;'&lt;/span&gt;
      &lt;span class="n"&gt;url&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="err"&gt;'&lt;/span&gt;&lt;span class="n"&gt;https&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="c1"&gt;//{WORKSPACE}.bytesafe.dev/maven/{REGISTRY}/'&lt;/span&gt;
      &lt;span class="nf"&gt;credentials&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;username&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="err"&gt;'&lt;/span&gt;&lt;span class="n"&gt;bytesafe&lt;/span&gt;&lt;span class="err"&gt;'&lt;/span&gt;
        &lt;span class="n"&gt;password&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="err"&gt;'&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nc"&gt;ACCESS-TOKEN&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="err"&gt;'&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;
   &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;With these quick additions to your Gradle project, you should be able to both build and deploy your own project using a private Maven repository as well as install any required dependencies.&lt;/p&gt;

&lt;h2&gt;
  
  
  Want to know more about Bytesafe's Firewall for dependencies?
&lt;/h2&gt;

&lt;p&gt;Secure your supply chain with private registries compatible with package managers like npm, maven and nuget. Refer to the Bytesafe documentation on &lt;a href="https://docs.bytesafe.dev/package-managers/" rel="noopener noreferrer"&gt;package managers&lt;/a&gt; for more in-depth information and guides. &lt;/p&gt;

&lt;p&gt;Enforce your security policies and &lt;a href="https://bytesafe.dev/posts/using-quarantine-dependency-firewall/" rel="noopener noreferrer"&gt;automatically quarantine&lt;/a&gt; unwanted dependencies. Avoid &lt;a href="https://bytesafe.dev/posts/safety-delay-protect-from-compromised-versions/" rel="noopener noreferrer"&gt;compromised new versions&lt;/a&gt; with a set delay before newly published versions are allowed in your organization.&lt;/p&gt;

&lt;p&gt;Want to try it for yourself? &lt;a href="https://login.bytesafe.dev/signup" rel="noopener noreferrer"&gt;Sign up&lt;/a&gt; for Bytesafe and get started today - no strings attached.&lt;/p&gt;

</description>
      <category>java</category>
      <category>kotlin</category>
      <category>maven</category>
      <category>gradle</category>
    </item>
    <item>
      <title>Update dependencies safely - with a delay on newly published versions</title>
      <dc:creator>Andreas Sommarström</dc:creator>
      <pubDate>Thu, 16 Dec 2021 15:40:36 +0000</pubDate>
      <link>https://forem.com/sumstrm/update-dependencies-safely-with-a-delay-on-newly-published-versions-17k9</link>
      <guid>https://forem.com/sumstrm/update-dependencies-safely-with-a-delay-on-newly-published-versions-17k9</guid>
      <description>&lt;p&gt;It’s common to regularly pull the latest versions of packages from public upstreams - without review or regard for version maturity. And in most cases as a consequence of a build rather than from real intention to actually make updates to the dependency composition. &lt;/p&gt;

&lt;p&gt;This is most apparent in ecosystems like npm, where the  dependency tree with ranges of compatible versions turn each &lt;code&gt;npm install&lt;/code&gt; into a unique fetch of what is the "latest and greatest" at that time.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;But with popular packages often being targets for attacks there is every reason to be cautious. Perhaps a little friction is desirable for the sake of security?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To prevent malicious attacks like &lt;a href="https://dev.to/sumstrm/steering-clear-of-the-dependency-trap-hb"&gt;ua-parser-js, coa &amp;amp; rc&lt;/a&gt; &lt;em&gt;(Edit: and intentional sabotage like colors.js/faker.js)&lt;/em&gt; from happening in your organization, what if newly released dependencies weren’t allowed to be used immediately? With new packages only permitted for your developers or CI/CD after a set safety period.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Good news!&lt;/strong&gt; Easily achievable with the Dependency Firewall in &lt;a href="https://bytesafe.dev" rel="noopener noreferrer"&gt;Bytesafe private registries&lt;/a&gt;. Here's how.&lt;/p&gt;

&lt;h2&gt;
  
  
  Don't allow packages until a set safety delay has passed
&lt;/h2&gt;

&lt;p&gt;The &lt;a href="https://docs.bytesafe.dev/policies/delay-upstream/" rel="noopener noreferrer"&gt;Delay Upstream&lt;/a&gt; policy allows for a custom delay before new versions are allowed in your private registries.&lt;/p&gt;

&lt;p&gt;Until the set delay (in days) has passed, new versions are made unavailable to your organization. With other recent and allowed versions automatically selected for you - to not break your builds.&lt;/p&gt;

&lt;p&gt;By giving millions of open source users in ecosystems like npm and maven a chance to evaluate new releases, you could prevent critical vulnerabilities and malicious packages. With the right balance you could save your organization from being compromised.&lt;/p&gt;

&lt;h3&gt;
  
  
  Example of how it works
&lt;/h3&gt;

&lt;p&gt;A new version of a dependency, &lt;code&gt;1.3.0&lt;/code&gt;, is released to a public registry like npmjs or maven central. For as long as &lt;code&gt;current time &amp;lt; publish time + safety delay&lt;/code&gt; the new version does not qualify and will be prevented from being used by your organization. &lt;/p&gt;

&lt;p&gt;Actions by developers or automated systems to fetch the project's dependencies will instead receive the most recent allowed version &lt;code&gt;1.2.3&lt;/code&gt; from Bytesafe.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F948jt3wopozyfzypwk38.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F948jt3wopozyfzypwk38.png" alt="new version prevented as it has not reached sufficient maturity"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When &lt;code&gt;current time &amp;gt;= publish time + safety delay&lt;/code&gt; the new version &lt;code&gt;1.3.0&lt;/code&gt; will be allowed in your organization and any subsequent fetches will receive the new version.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Foukcx3f68glcqeistx6h.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Foukcx3f68glcqeistx6h.png" alt="version available after safety delay has passed"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Customize the safety delay to match your needs
&lt;/h2&gt;

&lt;p&gt;What the desired "maturity since release" is, differs between organizations. To accommodate, the delay in Bytesafe is completely customizable per registry in your workspace up to a maximum of 90 days.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgfor11cdvo4v7zwf2vfg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgfor11cdvo4v7zwf2vfg.png" alt="Custom delay time of upstream versions"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Your organization can find the right balance between delay (security) and access to new functionality.&lt;br&gt;
Adjust it to your needs per ecosystem and enforce a delay of 3 weeks for &lt;a href="https://bytesafe.dev/npm/" rel="noopener noreferrer"&gt;npm&lt;/a&gt; while using 2 months for &lt;a href="https://bytesafe.dev/maven/" rel="noopener noreferrer"&gt;maven&lt;/a&gt; - if it's right for you.&lt;/p&gt;

&lt;h3&gt;
  
  
  Patch versions intentionally
&lt;/h3&gt;

&lt;p&gt;If the need arises to add a specific new security patch or functionality, consider using a separate patch registry to manually (and intentionally) add the required versions. Complete control, while keeping automated environments safe and secure!&lt;/p&gt;

&lt;h2&gt;
  
  
  Looking to secure your supply chain?
&lt;/h2&gt;

&lt;p&gt;With the &lt;a href="https://docs.bytesafe.dev/policies/delay-upstream/" rel="noopener noreferrer"&gt;Delay Upstream&lt;/a&gt; policy we want to offer the option to balance flexibility with security, especially for automated environments and decentralized developer organizations.&lt;/p&gt;

&lt;p&gt;In addition, organizations should make it a habit to review and make conscious decisions on the dependencies they are using for a &lt;a href="https://bytesafe.dev/posts/preventing-supply-chain-attacks/" rel="noopener noreferrer"&gt;secure supply chain&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Want to try delay upstreams for yourself? Sign up for &lt;a href="https://bytesafe.dev" rel="noopener noreferrer"&gt;Bytesafe&lt;/a&gt; and start for free today. &lt;/p&gt;

&lt;p&gt;Thanks for reading!&lt;/p&gt;

</description>
      <category>security</category>
      <category>java</category>
      <category>webdev</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Steering clear of the dependency trap</title>
      <dc:creator>Andreas Sommarström</dc:creator>
      <pubDate>Mon, 01 Nov 2021 07:58:28 +0000</pubDate>
      <link>https://forem.com/sumstrm/steering-clear-of-the-dependency-trap-hb</link>
      <guid>https://forem.com/sumstrm/steering-clear-of-the-dependency-trap-hb</guid>
      <description>&lt;p&gt;With the dust settling after the &lt;em&gt;UA-parser-js&lt;/em&gt;, &lt;em&gt;coa&lt;/em&gt; and &lt;em&gt;rc&lt;/em&gt; incidents, it's the perfect opportunity to take some time and see what we can learn from it. With some small changes to how you view and work with dependencies, you can take back control - instead of letting the dependencies control and overwhelm you.&lt;/p&gt;

&lt;p&gt;The UA-parser security issue highlights &lt;em&gt;two major things&lt;/em&gt; for the npm ecosystem:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;The dependency tree comes with security risks.&lt;/strong&gt; Your direct dependencies might not be malicious, but your dependencies of direct dependencies may be targeted. These transitive dependencies often range in hundreds and are large weak points. &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Organizations need to expand the scope of security&lt;/strong&gt; and protect more than the CI/CD. Developer environments are often more numerous and more difficult to control, making it a more probable target to be compromised by malicious packages.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In these ransomware times, it's more important than ever to protect your whole organization - controlling what packages are allowed in your environments.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;&lt;em&gt;The UA-parser-js incident in short&lt;/em&gt;&lt;/strong&gt; &lt;em&gt;JavaScript library ua-parser-js sparked vigorous security activity, as the package was hijacked and three malicious versions were published to the public npm registry. Once again highlighting the need for more security focus in the JavaScript (and other) ecosystems.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;The library, used to detect browser and user data, has close to 8M weekly downloads by developers around the world and is used as a dependency by 1200+ other packages in the public npm registry.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;See the &lt;a href="https://github.com/advisories/GHSA-pjwm-rvh2-c87w/"&gt;security advisory&lt;/a&gt; for more details.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Update:&lt;/em&gt;&lt;/strong&gt; &lt;strong&gt;&lt;em&gt;Malicious versions of packages coa and rc&lt;/em&gt;&lt;/strong&gt; &lt;em&gt;published on 2021-11-04. Same malware and pattern of attack (and indicating same hijacker), targeting popular support libraries. Malicious versions of both packages later unpublished by npm.&lt;/em&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Dependency tree and levels of dependencies
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Joe, the junior developer, helps his team with application testing over the course of the weekend. His environment is clean, so he diligently installs the required dependencies for the application using &lt;code&gt;npm install&lt;/code&gt;.&lt;/em&gt; &lt;/p&gt;

&lt;p&gt;&lt;em&gt;The app only has a few direct dependencies, but with all the transitive dependencies he ends up adding over 700 dependencies. Unfortunately for Joe and his company, it’s already too late as he unknowingly installed a trojan into his environment…&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Installing npm dependencies with package managers is easy&lt;/strong&gt; - and we shouldn't kid ourselves and think that everyone is knowledgeable and informed on potential issues. It's easy for things to start going wrong with the amount of dependencies and with packages allowed to execute arbitrary scripts as part of the install process.&lt;/p&gt;

&lt;p&gt;And malicious packages are a big threat for your development environment where potential user data, passwords and sensitive information is stored and therefore can be stolen by hackers.&lt;/p&gt;

&lt;h3&gt;
  
  
  Getting compromised without even knowing it
&lt;/h3&gt;

&lt;p&gt;Let's use the &lt;strong&gt;ua-parser-js&lt;/strong&gt; attack as an example. During the incident any user installing a package with a dependency resolution like &lt;code&gt;ua-parser-js: ^0.7.xx&lt;/code&gt; would have gotten a malicious version (0.7.29). The dependency resolution tells us to fetch the latest 0.7 patch version - unless remediated by factors like locked dependency versions. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;So who was affected?&lt;/strong&gt; Projects depending directly on &lt;code&gt;ua-parser-js&lt;/code&gt; were obviously at risk. But in the typical case the compromised dependency was added as a transitive dependency (dependency of a dependency).&lt;br&gt;
Leading to users working with popular libraries and frameworks like &lt;code&gt;react&lt;/code&gt; and &lt;code&gt;angular&lt;/code&gt; reporting inclusion of the compromised library.&lt;/p&gt;

&lt;p&gt;With transitive dependencies, the number of packages your projects depend on increases dramatically. To the point where it quickly becomes impossible to fully grasp what and how many dependencies your team uses.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Example of dependency tree with ua-parser-js included as a transitive dependency. &lt;/span&gt;
&lt;span class="c"&gt;# 'npm ls' is used to identify the path for a specific dependency&lt;/span&gt;

&lt;span class="nv"&gt;$ &lt;/span&gt;npm &lt;span class="nb"&gt;ls &lt;/span&gt;ua-parser-js
    yourproject@1.0.0
      react@15.7.0
       └─┬ fbjs@0.8.18
         └── ua-parser-js@0.7.30

&lt;span class="c"&gt;# Excerpt from fbjs@0.8.18 where ua-parser-js is included as a dependency&lt;/span&gt;
    &lt;span class="s2"&gt;"dependencies"&lt;/span&gt;: &lt;span class="o"&gt;{&lt;/span&gt;
        ...
        &lt;span class="s2"&gt;"ua-parser-js"&lt;/span&gt;: &lt;span class="s2"&gt;"^0.7.18"&lt;/span&gt;
        &lt;span class="o"&gt;}&lt;/span&gt;,

&lt;span class="c"&gt;# ua-parser-js: ^0.7.18 would resolve to the latest 0.7.x version. Installing a compromised version with malware during the time of the incident.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the aftermath after ua-parser-js the biggest issue wasn't figuring out if your applications used ua-parser, instead it was trying to figure out if you were exposed - in any environment, in any way, across hundreds of developers. A task a lot of companies worked vigorously with, as they lacked proper control over packages that enter their environment.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to avoid the trap? Control instead of being controlled
&lt;/h2&gt;

&lt;p&gt;Avoiding similar issues in the future should be a priority - and any investment into proper protection would save time and money in the long run.&lt;/p&gt;

&lt;p&gt;So, the million dollar question - &lt;strong&gt;How do we avoid this in the future?&lt;/strong&gt;&lt;br&gt;
We can mitigate most of the issues by inserting control over dependencies and the patch management process.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Avoid unintended dependency version changes&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Use a single source of truth for dependencies&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  Locking dependency versions
&lt;/h3&gt;

&lt;p&gt;You might be thinking, discussions about using lock-files again? Shouldn't everyone be aware of and use them by now? And I agree, everyone should use them - but they are not. &lt;/p&gt;

&lt;p&gt;Dependency versions should be updated with intention and not as a side effect. Having consecutive &lt;code&gt;npm install&lt;/code&gt; yield slightly different and non-deterministic results is not desired in neither CI/CD nor dev environments.&lt;/p&gt;

&lt;p&gt;Organizations should put in place a process that updates, commits and reviews project lock-files and makes sure every subsequent installation (and user) uses the files.&lt;/p&gt;

&lt;p&gt;Using dependency ranges, instead of pinning exact dependency versions, grants flexibility for the ecosystem - but comes with inherent security risks. Using lock-files (&lt;code&gt;package-lock&lt;/code&gt; &amp;amp; &lt;code&gt;yarn.lock&lt;/code&gt;) together with &lt;code&gt;npm ci&lt;/code&gt; for complete and deterministic installations introduces the &lt;strong&gt;necessary friction&lt;/strong&gt; that make updating dependency versions a controlled process. &lt;/p&gt;
&lt;h3&gt;
  
  
  Single source - The dependency firewall
&lt;/h3&gt;

&lt;p&gt;Depending directly on public registries and countless GitHub repositories, instead of using a single package source, quickly makes control over the flow of dependencies an impossible task.&lt;/p&gt;

&lt;p&gt;With multiple different sources, how are you going to make sure dependencies comply with your business policies, that they are safe and contain approved licenses? &lt;/p&gt;

&lt;p&gt;The solution: a single hub like &lt;a href="https://bytesafe.dev"&gt;Bytesafe&lt;/a&gt; to enforce rules and monitor the flow of dependencies - for every developer, tester and build system.&lt;/p&gt;

&lt;p&gt;To make sure everyone is using the same registry source and the intended versions, projects should include a &lt;code&gt;.npmrc&lt;/code&gt; config file and &lt;code&gt;package-lock.json&lt;/code&gt; or &lt;code&gt;yarn.lock&lt;/code&gt; files that define what registry to use.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Example .npmrc config setting the default registry to be used by npm clients
registry=https://workspace.bytesafe.dev/r/example-registry/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Keep unwanted dependencies out of your organization. Setup a firewall for your dependencies with &lt;a href="https://bytesafe.dev"&gt;Bytesafe&lt;/a&gt;!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Thanks for reading!&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>node</category>
      <category>security</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Open source is a valuable development resource. Give it your attention</title>
      <dc:creator>Andreas Sommarström</dc:creator>
      <pubDate>Mon, 06 Sep 2021 13:34:49 +0000</pubDate>
      <link>https://forem.com/sumstrm/open-source-is-a-valuable-development-resource-give-it-your-attention-4haf</link>
      <guid>https://forem.com/sumstrm/open-source-is-a-valuable-development-resource-give-it-your-attention-4haf</guid>
      <description>&lt;p&gt;&lt;em&gt;Open source software (OSS) gives access to a never-ending amount of external development resources. Developing any application, it is simply more efficient to reuse building blocks from others than having to write everything yourself - a necessity for most organisations.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Businesses should see the open source they depend on as a valuable resource - that requires management.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Using OSS to build applications allows access to additional developer resources and expertise that wouldn’t otherwise be available. The downside - you have no direct influence over the persons behind the component or their actions. And there is no reason to blindly trust them.&lt;/p&gt;

&lt;p&gt;For internal development resources the norm is to spend time and money hiring the best candidates and continuously invest in their skills and performance. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Businesses need to echo some of that effort spent finding the right in-house talent into safe use of open source - instead of taking it for granted.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Open source in short
&lt;/h2&gt;

&lt;p&gt;If you’re not working with software development or open source in your day-to-day work, then perhaps the analogy in the title is not self-explanatory. Not to worry, let’s walk through it.&lt;/p&gt;

&lt;p&gt;Today there is no need to start from scratch every time you are to deliver a feature. There are millions of already finished components ready to be used - and they are only a few letters on the keyboard away from being nested in your application and inside your environments.&lt;/p&gt;

&lt;p&gt;What makes something open source is that the source code for all these components is freely available to everyone and anyone, to view, duplicate, work on etc. That means that as long as you adhere to licenses of components, you can use them in your applications to serve your needs.&lt;/p&gt;

&lt;p&gt;And open source software has proven to be an explosive engine for business growth. And it’s everywhere. For ecosystems like JavaScript / npm the figures speak for themselves:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;99% of projects use open source components to some extent.&lt;/li&gt;
&lt;li&gt;An astonishing 70% of all code used to run applications are open source.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3qn4buqn0xc5fpvpsj7o.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3qn4buqn0xc5fpvpsj7o.png" alt="70% of all code used to run applications are open source"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  So massive upside - what’s the downside?
&lt;/h3&gt;

&lt;p&gt;When your application utilize external dependencies you’ll depend on developers who you can exert no direct control over. Without control, how do you know whether the open source components in your codebase are being maintained and adhere to your security guidelines?&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Core components of your business are probably relying on components that your dev team has never reviewed or seen the insides of.&lt;/em&gt; &lt;br&gt;
Let that sink in. Eye opening, isn’t it?&lt;/p&gt;

&lt;p&gt;And to be clear, open source is a positive thing. We wholeheartedly support it and use it every day in our own apps. But like most things in life it needs some safeguards to make sure everyone is playing by the rules.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Using a particular open source component extensively?&lt;/strong&gt; Consider supporting it! Sponsor, buy the developers some coffee or spend some development time on improving it.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Manage the open source you use - by inserting control into your supply chain
&lt;/h2&gt;

&lt;p&gt;Not everyone can be an expert - and fortunately you don’t have to be. Committing to safe use of open source can be as simple as supporting the right process and tools for your organisation. Tooling that:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Keeps track of the open source software used&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Identifies for security threats - and keeps potential issues out&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Highlights issues early- for easier and more cost-effective remediation&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://bytesafe.dev/" rel="noopener noreferrer"&gt;Bytesafe&lt;/a&gt; allows you to combine your team’s need for package management of JavaScript open source packages with security. Using Bytesafe, developers can access public open source dependencies or private proprietary components for your applications, securely. Mitigating risks for your business.&lt;/p&gt;

&lt;p&gt;Bytesafe identifies all the components your team is using and keeps track of them for you. Your supply chain is kept secure as part of the firewall where &lt;a href="https://bytesafe.dev/posts/using-quarantine-dependency-firewall/" rel="noopener noreferrer"&gt;threats are automatically quarantined&lt;/a&gt;. And all &lt;a href="https://bytesafe.dev/posts/using-issue-tracking/" rel="noopener noreferrer"&gt;issues are highlighted for you&lt;/a&gt; - accessible to all team members.&lt;/p&gt;

&lt;p&gt;Thanks for reading!&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>security</category>
      <category>node</category>
      <category>devops</category>
    </item>
    <item>
      <title>Automatic protection from dependency confusion</title>
      <dc:creator>Andreas Sommarström</dc:creator>
      <pubDate>Wed, 19 May 2021 19:10:23 +0000</pubDate>
      <link>https://forem.com/sumstrm/automatically-protect-your-supply-chain-from-dependency-confusion-2n35</link>
      <guid>https://forem.com/sumstrm/automatically-protect-your-supply-chain-from-dependency-confusion-2n35</guid>
      <description>&lt;p&gt;&lt;strong&gt;Dependency confusion&lt;/strong&gt; occurs when a system or user is tricked into fetching a package version from a public registry, instead of the intended &lt;strong&gt;trusted&lt;/strong&gt; package with the same namespace from your private registry.&lt;/p&gt;

&lt;p&gt;Like other supply chain attacks it’s all about injecting non-intended packages into a vulnerable supply chain, where malicious code can be executed on installation. A critical security threat for your supply chain if left uncontrolled. And a problem that potentially gets even worse in automated environments like CI/CD pipelines, if left unnoticed. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://dev.to/sumstrm/control-your-npm-packages-avoid-dependency-confusion-1cjh"&gt;My previous post&lt;/a&gt; on the topic was focused on how to use security focused package management to improve control of the software supply chain.  &lt;/p&gt;

&lt;p&gt;This post focuses instead on a solution that automatically protects your supply chain against dependency confusion. A scalable solution that is safe by default and prevents internal packages from being replaced by packages from external sources, without requiring  complex configurations.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to automatically protect against dependency confusion
&lt;/h2&gt;

&lt;p&gt;Enforcing this protection from dependency confusion is based on using &lt;a href="https://bytesafe.dev/"&gt;Bytesafe&lt;/a&gt; registries for the private and public npm packages you depend on. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--vAM4Afdp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/iaquz717z5mj9ikexj87.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--vAM4Afdp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/iaquz717z5mj9ikexj87.png" alt="Alt Text" width="800" height="431"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Bytesafe offers fully managed and private npm registries that allow users to better control their supply chain and secure the private and public packages they depend on.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;With Bytesafe any package version marked as internal, either automatically or manually, will be protected from dependency confusion. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The solution in short:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;em&gt;Package versions published, pushed or uploaded to an internal registry will automatically be flagged as internal&lt;/em&gt; &lt;/li&gt;
&lt;li&gt;&lt;em&gt;Fetching new versions of internal packages from upstream sources, will only consider upstreams with internal versions of the same package&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It’s as simple as that. Package versions added directly by users are automatically marked as &lt;strong&gt;internal&lt;/strong&gt;, making sure internal packages are not exposed by mistake. And the best part, all the complex logic behind resolving dependencies safely is handled by Bytesafe, instead of being pushed on to our users.&lt;/p&gt;

&lt;p&gt;Packages &lt;em&gt;without the internal flag&lt;/em&gt; will function as they always have, with full access to public upstreams.&lt;/p&gt;

&lt;p&gt;Users can continue to use registries for both public and private packages, enjoying the benefits of a single source of truth for all package dependencies. While simultaneously being fully protected from dependency confusion.&lt;/p&gt;

&lt;h4&gt;
  
  
  Example: Publish internal packages to a private registry
&lt;/h4&gt;

&lt;p&gt;Publishing internal packages to a private registry allows them to be shared and available for other team members and systems.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;npm &lt;span class="nt"&gt;--registry&lt;/span&gt; &lt;span class="s1"&gt;'https://workspace.bytesafe.dev/r/your-internal-registry/'&lt;/span&gt; publish

...

+ your-internal-package@4.5.6
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With the target registry flagged as &lt;em&gt;internal&lt;/em&gt; the version will automatically be flagged &lt;em&gt;internal&lt;/em&gt; as well. Preventing it from being substituted by package versions from untrusted external sources.   &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--eGIPDBrs--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fhh0uevgznxqg3dnwblu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--eGIPDBrs--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fhh0uevgznxqg3dnwblu.png" alt="example-internal-package-in-bytesafe" width="723" height="185"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Protection during dependency resolution (npm install)
&lt;/h2&gt;

&lt;p&gt;The core protection of internal packages is evident when resolving dependencies from upstream. This is typically the case when using &lt;code&gt;npm install&lt;/code&gt; to install dependencies for a project and &lt;code&gt;npm&lt;/code&gt; attempts to fetch all available versions.&lt;/p&gt;

&lt;p&gt;Any attempt to fetch new versions of internal packages will only use upstreams that contain other internal versions of the packages. All other sources will be ignored for the purpose of this action.&lt;/p&gt;

&lt;p&gt;Users can securely install any internal version from their registries, without ever having to worry about the possibility of the package being replaced with a malicious package from any external registry. A protection that scales to all users and systems.&lt;/p&gt;

&lt;h4&gt;
  
  
  Example: Using a Bytesafe private registry together with registry.npmjs.org as an upstream for public packages
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--8SaW3J5q--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kzhdfmsoj26g9wwpvftk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--8SaW3J5q--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kzhdfmsoj26g9wwpvftk.png" alt="internal-registry-example" width="601" height="471"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Package published to the private registry will be flagged internal&lt;/li&gt;
&lt;li&gt;Install of internal package by other users / systems will never fetch versions from registry.npmjs.org as it does not contain internal versions&lt;/li&gt;
&lt;li&gt;Installing any public package will work as normal, with registry.npmjs.org as a valid upstream&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Getting started - How to protect your supply chain
&lt;/h2&gt;

&lt;p&gt;Any new Bytesafe workspaces and registries come with protection from dependency confusion by default - No additional actions required.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Create your own &lt;a href="https://login.bytesafe.dev/signup"&gt;Bytesafe Workspace&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Publish your internal packages to the private registry. They will automatically be marked internal.&lt;/li&gt;
&lt;li&gt;Install/add your other public dependencies. All dependencies are continuously monitored for security issues.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;With both public and private dependencies now in one single source of truth, you can distribute this secure source to all team members and systems. A solution that scales across your whole organization.&lt;/p&gt;

&lt;h2&gt;
  
  
  Upstream issues - additional layer of defence against supply chain attacks
&lt;/h2&gt;

&lt;p&gt;Bytesafe also detects &lt;a href="https://docs.bytesafe.dev/issues/"&gt;upstream configuration issues&lt;/a&gt; that could indicate a supply chain attack.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--jhMtXH0E--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xcqo5wd9dmzfkc1esmm8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--jhMtXH0E--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xcqo5wd9dmzfkc1esmm8.png" alt="upstream issues in bytesafe" width="800" height="349"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Upstream issues are opened when a package version is found in multiple external upstreams, with non-matching contents. Issues trigger notifications, warning you of a potential dependency confusion attack.&lt;/p&gt;

&lt;p&gt;Thanks for reading!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://twitter.com/bytesafedev"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ionvFjit--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j3uehdo8j7i2g40bk382.png" alt="Follow Bytesafe on Twitter" width="200" height="90"&gt;&lt;/a&gt; &lt;a href="https://www.producthunt.com/posts/bytesafe?utm_source=badge-featured&amp;amp;utm_medium=badge&amp;amp;utm_souce=badge-bytesafe"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--hcLPyapG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://api.producthunt.com/widgets/embed-image/v1/featured.svg%3Fpost_id%3D300547%26theme%3Dlight" alt="Bytesafe - A better way to control your software supply chain | Product Hunt" width="250" height="54"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>npm</category>
      <category>security</category>
      <category>javascript</category>
      <category>node</category>
    </item>
    <item>
      <title>Different typosquatting attacks to know of - for a secure supply chain</title>
      <dc:creator>Andreas Sommarström</dc:creator>
      <pubDate>Sat, 20 Mar 2021 15:08:54 +0000</pubDate>
      <link>https://forem.com/sumstrm/different-typosquatting-attacks-to-know-of-for-a-secure-supply-chain-4j70</link>
      <guid>https://forem.com/sumstrm/different-typosquatting-attacks-to-know-of-for-a-secure-supply-chain-4j70</guid>
      <description>&lt;p&gt;Secure management of dependencies is not always a priority when compared to development speed. At the same time adding new open source software from public registries like npmjs is easier than ever.&lt;/p&gt;

&lt;p&gt;As a consequence it's often easier for hackers to inject malicious code as part of the software supply chain instead of trying to exploit existing vulnerabilities.&lt;/p&gt;

&lt;p&gt;This is known as a supply chain attack, an attack vector that has been further highlighted with the emergence of the &lt;a href="https://bytesafe.dev/posts/avoiding-dependency-confusion/"&gt;dependency confusion&lt;/a&gt; concept&lt;br&gt;
together with recent articles like &lt;a href="https://michenriksen.com/blog/finding-evil-go-packages/"&gt;typosquatting in the Go ecosystem&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The topics of typosquatting and dependency confusing are particularly interesting as they highlight two things that are central to package management.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Package names matter&lt;/strong&gt;. Alot. All that is required to install new packages is a valid name. If you misspell or remember a name incorrectly you will worst case install another package. Possibly a malicious one.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;How much trust (or risk) we put in our supply chain&lt;/strong&gt;. We trust that packages are always available from the public registries, trust that packages are not malicious, and trust that packages has not been compromised or taken over from its original creator. Unfortunately this trust can be exploited...&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To reduce some security risks, this post will look into methods that can be used to imitate legitimate package names. By being aware you stand a better chance of keeping your &lt;a href="https://bytesafe.dev/supply-chain-security/"&gt;software supply chain secure&lt;/a&gt;!&lt;/p&gt;
&lt;h2&gt;
  
  
  What is typosquatting?
&lt;/h2&gt;

&lt;p&gt;Typosquatting (in the context of package management) is the term for creating and publishing malicious packages with names imitating legitimate ones. &lt;/p&gt;

&lt;p&gt;Through typos or mistakes, such packages are included in your supply chain. And package scripts can run during installs by default!&lt;/p&gt;

&lt;p&gt;With package managers like &lt;code&gt;npm&lt;/code&gt;, we can easily add new dependencies to our projects through the name alone.&lt;br&gt;
Want to add that dependency you used from months ago by memory? Not really a problem, until you accidentally include a package other than you intended.&lt;/p&gt;

&lt;p&gt;Hackers are relying on the fact that as long as their packages pass a shallow inspection the variations in package names doesn't raise any red flags.&lt;/p&gt;

&lt;p&gt;One of the many examples include the now removed package &lt;a href="https://www.npmjs.com/package/electorn"&gt;electorn&lt;/a&gt; that was transposed from the legitimate package &lt;strong&gt;electron&lt;/strong&gt; by switching the order of O and R.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# At a glance there's not much difference of malicious package name&lt;/span&gt;
&lt;span class="nv"&gt;$ &lt;/span&gt;npm &lt;span class="nb"&gt;install &lt;/span&gt;electorn
&lt;span class="c"&gt;# compared to the legitimate package name&lt;/span&gt;
&lt;span class="nv"&gt;$ &lt;/span&gt;npm &lt;span class="nb"&gt;install &lt;/span&gt;electron
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Different variations of typosquatting
&lt;/h2&gt;

&lt;p&gt;What is combosquatting? Omission, repetition and transposition? Typosquatting is the collective term for imitating real package names. &lt;br&gt;
But there are multiple variations on how this is achieved. Let's have a closer look, together with some real world examples from the npm ecosystem where this was used.&lt;/p&gt;

&lt;h3&gt;
  
  
  Combosquatting
&lt;/h3&gt;

&lt;p&gt;Combosquatting consists of trying to imitate legitimate packages by appending common words, terms or letters on the original package name. &lt;/p&gt;

&lt;p&gt;&lt;em&gt;Example of combosquatting for package names:&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;twilio -&amp;gt; twilio-npm&lt;/li&gt;
&lt;li&gt;cross-env -&amp;gt; cross-env.js &lt;/li&gt;
&lt;li&gt;fabric -&amp;gt; node-fabric&lt;/li&gt;
&lt;li&gt;lodash -&amp;gt; lodashs&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Where &lt;em&gt;npm&lt;/em&gt;, &lt;em&gt;js&lt;/em&gt; and &lt;em&gt;node&lt;/em&gt; are all common terms in npm and JavaScript.&lt;/p&gt;

&lt;p&gt;Combosquatting is generally considered the most common of the permutations.&lt;/p&gt;

&lt;p&gt;It is also common in website phishing attempts where URLs are appended with seemingly legitimate terms to fool unsuspecting users.&lt;/p&gt;

&lt;h3&gt;
  
  
  Omission
&lt;/h3&gt;

&lt;p&gt;Omission is intentionally leaving out a character in a package name. Either a letter or some other character like a hyphen. &lt;br&gt;
It is aimed at the times when we miss pressing one of the keys in a sequence, or simply to confuse developers with familiar sounding un-hyphenated names.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Example of omission for package names:&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;mongoose -&amp;gt; mongose&lt;/li&gt;
&lt;li&gt;babel-cli -&amp;gt; babelcli&lt;/li&gt;
&lt;li&gt;cross-env -&amp;gt; crossenv&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For the npm ecosystem, the package naming rules was &lt;a href="https://blog.npmjs.org/post/168978377570/new-package-moniker-rules"&gt;updated&lt;/a&gt; to partially cover omission in package names. &lt;br&gt;
But package names are still validated on a case by case basis.&lt;/p&gt;

&lt;h3&gt;
  
  
  Repetition
&lt;/h3&gt;

&lt;p&gt;The inverse of omission is repetition with intentionally adding multiple instances of the same characters. This plays both to our nature of pressing the same key twice by mistake but also to spelling mistakes.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Example of repetition for package names:&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;jquery -&amp;gt; jquerry
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Example of typosquatting dependency in package.json. &lt;/span&gt;
&lt;span class="c"&gt;# Would you notice the difference? &lt;/span&gt;
...
&lt;span class="s2"&gt;"dependencies"&lt;/span&gt;: &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="s2"&gt;"jquerry"&lt;/span&gt;: &lt;span class="s2"&gt;"^2.0.0"&lt;/span&gt;,
    &lt;span class="s2"&gt;"react"&lt;/span&gt;: &lt;span class="s2"&gt;"^17.0.1"&lt;/span&gt;
  &lt;span class="o"&gt;}&lt;/span&gt;
...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Transposition
&lt;/h3&gt;

&lt;p&gt;Transposition switches the position of two adjacent characters. Typos where we press keys in the wrong order, as well as common spelling mistakes are target for transposition (middle -&amp;gt; middel in the example below is a perfect example of this). &lt;/p&gt;

&lt;p&gt;&lt;em&gt;Example of transposition for package names:&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;http-proxy-middleware -&amp;gt; http-proxy-middelware&lt;/li&gt;
&lt;li&gt;electron -&amp;gt; electorn&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Control the risks by controlling your dependencies
&lt;/h2&gt;

&lt;p&gt;A secure supply chain, from typosquatting or other attacks, starts with knowing what open source software you are using. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Use a service like &lt;a href="https://bytesafe.dev"&gt;Bytesafe&lt;/a&gt; to host both private and public packages&lt;/strong&gt;. This enables a central hub with all your dependencies in one place. For both direct and transitive dependencies. &lt;/p&gt;

&lt;p&gt;When new dependencies are added to a project, they are instantly available in Bytesafe as well. Allowing for continuous monitoring and control. Detect issues as they happen instead of waiting for point in time scans or critical issues in your build environments.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Scan dependencies for known vulnerabilities&lt;/strong&gt;. Package typosquatting attempts are continuously being reported and flagged for vulnerabilities. Get notified or block any known vulnerabilities in your supply chain. Directly when adding them or anytime in the future.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Don't run scripts by default during install&lt;/strong&gt;&lt;br&gt;
When installing packages there are often scripts executed as part of the installation process. This is convenient and useful, but executing random scripts is also a major risk. &lt;/p&gt;

&lt;p&gt;Make sure you know what is executed when installing packages. If you have not reviewed the scripts, you are much more likely to be safe installing with the &lt;code&gt;--ignore-scripts&lt;/code&gt; attribute.&lt;/p&gt;

&lt;h2&gt;
  
  
  Want to know more about how Bytesafe can help secure your supply chain?
&lt;/h2&gt;

&lt;p&gt;Visit our dedicated page on &lt;a href="https://bytesafe.dev/supply-chain-security/"&gt;securing the software supply chain&lt;/a&gt; to learn more about the potential problems to look out for and how we can help.&lt;/p&gt;

&lt;p&gt;Also, follow &lt;a href="https://twitter.com/bytesafedev"&gt;bytesafedev&lt;/a&gt; on twitter for continuous updates on everything security related. Stay safe!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://twitter.com/bytesafedev"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ionvFjit--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j3uehdo8j7i2g40bk382.png" alt="Follow Bytesafe on Twitter" width="200" height="90"&gt;&lt;/a&gt; &lt;a href="https://www.producthunt.com/posts/bytesafe?utm_source=badge-featured&amp;amp;utm_medium=badge&amp;amp;utm_souce=badge-bytesafe"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--hcLPyapG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://api.producthunt.com/widgets/embed-image/v1/featured.svg%3Fpost_id%3D300547%26theme%3Dlight" alt="Bytesafe - A better way to control your software supply chain | Product Hunt" width="250" height="54"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>security</category>
      <category>node</category>
      <category>npm</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Why you should host public npm packages in a private registry</title>
      <dc:creator>Andreas Sommarström</dc:creator>
      <pubDate>Wed, 03 Mar 2021 14:22:27 +0000</pubDate>
      <link>https://forem.com/sumstrm/why-you-should-host-public-npm-packages-in-a-private-registry-5h3k</link>
      <guid>https://forem.com/sumstrm/why-you-should-host-public-npm-packages-in-a-private-registry-5h3k</guid>
      <description>&lt;p&gt;This post talks about how using a private npm registry to proxy the public npm registry helps to identify and control the packages you use. And increase the security of your code supply chain. &lt;/p&gt;

&lt;p&gt;Want to manage the package dependencies you use for your projects? Reduce your dependency on the public npm registry? Or perhaps enforce security policies? Then read on.&lt;/p&gt;

&lt;h2&gt;
  
  
  Its a good idea to know of and manage the package you use
&lt;/h2&gt;

&lt;p&gt;Millions of developers use the public npm registry every day and with over 1.5 million packages it is a critical source for open source packages.&lt;/p&gt;

&lt;p&gt;But the convenience of packages from the public registry and the development speed all those available open source packages entail, comes with downsides. It gets increasingly hard to keep track of and manage all those dependencies.&lt;/p&gt;

&lt;p&gt;To avoid blindly trusting code from external sources, users should take steps to improve the control over dependencies and overall security when using npm. It is a necessity for any organization that wants to manage their code supply chain.&lt;/p&gt;

&lt;p&gt;And one of the first things that is usually mentioned for improved npm security is the use of a private npm registry to host your packages.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff6tppwqtj9g593b4cym5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff6tppwqtj9g593b4cym5.png"&gt;&lt;/a&gt;&lt;br&gt;Fully managed private npm registries with &lt;a href="https://bytesafe.dev" rel="noopener noreferrer"&gt;Bytesafe&lt;/a&gt;
  &lt;/p&gt;

&lt;h3&gt;
  
  
  Control over dependencies — How?
&lt;/h3&gt;

&lt;p&gt;There are multiple ways a private registry enables better dependency management:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Central hub for all your required package versions&lt;/strong&gt;: Private and public together, possibly from multiple upstream sources.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Identification and visualization of dependencies&lt;/strong&gt;: With all required packages in one place it enables identification of potential issues. Additionally the proxy caches your packages, removing the worry that an essential package version will be unpublished in the future.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Single package source&lt;/strong&gt;: With all developers using the same registry that contains the same versions, you can ensure all users build and test consistently. Removing the potential issue of unknowingly using different versions of a dependency.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Improved security — How?
&lt;/h3&gt;

&lt;p&gt;Using a private registry as a proxy enables a layer of separation between your organization and the outside world.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Security scanning&lt;/strong&gt;: continuously &lt;a href="https://docs.bytesafe.dev/plugins/vulnerability-scanner/" rel="noopener noreferrer"&gt;scan and monitor your dependencies&lt;/a&gt; for known vulnerabilities and security issues&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Security policies&lt;/strong&gt;: with all packages in one place you can enforce the &lt;a href="https://docs.bytesafe.dev/policies/" rel="noopener noreferrer"&gt;security policies&lt;/a&gt; you require.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;License compliance&lt;/strong&gt;: all dependencies in one place to &lt;a href="(https://bytesafe.dev/license-compliance)"&gt;identify open source licenses and scan for problematic licenses&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Interested in npm package security? Read my related post on avoiding dependency confusion.&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag__link"&gt;
  &lt;a href="/sumstrm" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__pic"&gt;
      &lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F416513%2F9c4bfc54-d8ff-4de8-b0e5-db2b4a71ec2a.png" alt="sumstrm"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="/sumstrm/control-your-npm-packages-avoid-dependency-confusion-1cjh" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;Control your npm packages &amp;amp; avoid dependency confusion&lt;/h2&gt;
      &lt;h3&gt;Andreas Sommarström ・ Feb 19 '21&lt;/h3&gt;
      &lt;div class="ltag__link__taglist"&gt;
        &lt;span class="ltag__link__tag"&gt;#npm&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#node&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#javascript&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#security&lt;/span&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;


&lt;h2&gt;
  
  
  Setting up and using a private registry is easy
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://bytesafe.dev/" rel="noopener noreferrer"&gt;Bytesafe&lt;/a&gt; offers hosted private npm registries that by default can be used to proxy the public npm registry.   &lt;/p&gt;

&lt;p&gt;Allowing for access to public npm packages as well as all the additional benefits that Bytesafe offers to your workflow.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Foazuum5yq21hhxpat8db.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Foazuum5yq21hhxpat8db.png" alt="Bytesafe registry with linked upstream registry"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When using Bytesafe, developers configure their npm client to interact with the private registry instead of the (default) public registry. With a configured upstream, any packages not available in the private registry will be fetched from the upstream registry instead (like registry.npmjs.org in this example).&lt;/p&gt;

&lt;p&gt;Before new packages are pulled into your registries, they are checked against any active security policies, to make sure they do not violate any rules you have configured.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

&lt;span class="c"&gt;# Authenticate to Bytesafe using the npm client&lt;/span&gt;
&lt;span class="nv"&gt;$ &lt;/span&gt;npm &lt;span class="nt"&gt;--registry&lt;/span&gt; https://example.bytesafe.dev/r/default/ login
Username: bytesafe
Password:
Email&lt;span class="o"&gt;(&lt;/span&gt;this IS public&lt;span class="o"&gt;)&lt;/span&gt;: you@example.com
Logged &lt;span class="k"&gt;in &lt;/span&gt;as bytesafe on https://example.bytesafe.dev/r/default/.
&lt;span class="c"&gt;# Work with the regular tooling (but direct your requests to private registry)&lt;/span&gt;
&lt;span class="nv"&gt;$ &lt;/span&gt;npm &lt;span class="nt"&gt;--registry&lt;/span&gt; https://example.bytesafe.dev/r/default/ publish
...


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;With the npm client no longer directly linked to the public registry, it results in the following workflow:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Developers&lt;/strong&gt; - publish/install package versions to/from the Bytesafe private registry — no direct interactions with the public registry. No need to change any behavior or usage patterns. &lt;br&gt;
&lt;strong&gt;Private registry&lt;/strong&gt; - holds all public and private packages and any required dependencies. If a package version is required that is not in the proxy registry it is pulled from upstreams.&lt;br&gt;
&lt;strong&gt;Upstreams registries&lt;/strong&gt; - provides package versions (when required) and is the target for push of packages from private registry. Upstreams can be either a single registry or multiple registries.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Recap
&lt;/h2&gt;

&lt;p&gt;Setting up and using a private npm registry is an easy and effective way to keep your dependencies in check and improve security when using npm. &lt;br&gt;
Without impacting or changing the workflow for developers. &lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;a href="https://bytesafe.dev/" rel="noopener noreferrer"&gt;Bytesafe&lt;/a&gt; offers hosted, private, reliable and private npm registries. And it's free to use for individual developers (so feel free to signup if you need a &lt;br&gt;
private registry). Manage, collaborate and secure your code supply chain with Bytesafe!&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://twitter.com/bytesafedev" rel="noopener noreferrer"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj3uehdo8j7i2g40bk382.png" alt="Follow Bytesafe on Twitter"&gt;&lt;/a&gt; &lt;a href="https://www.producthunt.com/posts/bytesafe?utm_source=badge-featured&amp;amp;utm_medium=badge&amp;amp;utm_souce=badge-bytesafe" rel="noopener noreferrer"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fapi.producthunt.com%2Fwidgets%2Fembed-image%2Fv1%2Ffeatured.svg%3Fpost_id%3D300547%26theme%3Dlight" alt="Bytesafe - A better way to control your software supply chain | Product Hunt"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>npm</category>
      <category>node</category>
      <category>javascript</category>
      <category>security</category>
    </item>
    <item>
      <title>Understanding open source licenses - What is Copyleft?</title>
      <dc:creator>Andreas Sommarström</dc:creator>
      <pubDate>Tue, 23 Feb 2021 09:49:15 +0000</pubDate>
      <link>https://forem.com/sumstrm/understanding-open-source-licenses-what-is-copyleft-3pf5</link>
      <guid>https://forem.com/sumstrm/understanding-open-source-licenses-what-is-copyleft-3pf5</guid>
      <description>&lt;p&gt;Every developer, team and organization owe it to themselves to be aware of and understand at least the basics of open source licenses.&lt;/p&gt;

&lt;p&gt;Using open source dependencies with different types of licenses for a commercial project? Or are you looking for more information on open source licenses as part of setting a license for a package of your own?&lt;/p&gt;

&lt;p&gt;Then you may be looking for answers to questions like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What are open source licenses?&lt;/li&gt;
&lt;li&gt;What are the main differences between copyleft and permissive licenses?&lt;/li&gt;
&lt;li&gt;Why do I have to care about licenses for the packages I use?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Questions that this post aims to answer and provide some context for popular open source licenses on the way.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;But wait, aren't open source packages free to use?&lt;/strong&gt; Open source code is free and available for anyone to use — but there are limitations and restrictions.&lt;br&gt;
The open source license restricts users on what they can or cannot do with a package.&lt;/p&gt;

&lt;p&gt;And it's up to each developer or business to remain compliant.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Disclaimer:&lt;/strong&gt; Information in this post should not be considered legal advice.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Open Source Licenses - the basics
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Open Source Software Licenses&lt;/strong&gt; allow developers to share their code and components as open source.&lt;/p&gt;

&lt;p&gt;With the use of open source packages being the modern standard, the number of dependencies for most projects count in the hundreds. &lt;br&gt;
All these open source dependencies come with license obligations.&lt;/p&gt;

&lt;p&gt;Each license defines how other developers are allowed to use these components in their own work. Typically this can be thought of as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Do's&lt;/strong&gt; - things the license allows you to do&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Don'ts&lt;/strong&gt; - things you are not allowed to do &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Must's&lt;/strong&gt; - things you must do&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;There can be a wide variation between different licenses on what you are allowed and must do.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;By using open source components you’re implicitly signing a contract that binds you&lt;/strong&gt; (i.e. developer or company) to the do’s and don’ts of how you use that piece of code.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Standardized licenses vs non-standard
&lt;/h3&gt;

&lt;p&gt;Most open source packages one encounters uses some form of standardized license.  &lt;/p&gt;

&lt;p&gt;The benefits of using standardized licenses are many: Reliable identification of licenses, recognizability, trust and more. People naturally shy away from the unknown and prefer to use open source packages with standard licenses.&lt;/p&gt;

&lt;p&gt;There are several organizations who provide guidelines and definitions regarding open source software licenses.&lt;br&gt;
The &lt;a href="https://opensource.org/" rel="noopener noreferrer"&gt;Open Source Initiative&lt;/a&gt; defines a list of some 80 certified open source licenses and the &lt;a href="https://spdx.org/licenses/" rel="noopener noreferrer"&gt;SPDX License List&lt;/a&gt; provides a list of commonly found licenses.&lt;/p&gt;

&lt;p&gt;Non-standard licenses, on the other hand, are any license or license text that does not fit into the standardized format. It can be a completely custom license, a custom copyright provided by the author or simply some license that does not fit into the term open source.&lt;br&gt;
What non-standard licenses have in common is that they usually require some kind of manual review and approval from users.&lt;/p&gt;

&lt;h3&gt;
  
  
  Npm package licenses
&lt;/h3&gt;

&lt;p&gt;For npm packages, license(s) information has its own section in the &lt;code&gt;package.json&lt;/code&gt; file.&lt;/p&gt;

&lt;p&gt;But it is important to know that there are no rules forcing package maintainers to provide any license information in &lt;code&gt;package.json&lt;/code&gt;. Licenses might just as well be found in a &lt;code&gt;LICENSE.md&lt;/code&gt; file or as part of &lt;em&gt;any other file of a project&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;Multiple licenses for a single package are also something that needs to be considered. A single package can have multiple licenses that either define the obligations for a specific scenario or for an individual piece of code.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What about open source code without a license?&lt;/strong&gt; A software component without a licence is not free to use. By default it is fully copyright protected, so developers have no legal rights to use, modify or share it.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;One package. Multiple licenses&lt;/strong&gt;&lt;br&gt;
The npm package &lt;a href="https://www.npmjs.com/package/abbrev" rel="noopener noreferrer"&gt;abbrev&lt;/a&gt; has the license &lt;code&gt;ISC&lt;/code&gt; declared in &lt;code&gt;package.json&lt;/code&gt;, but &lt;a href="https://github.com/isaacs/abbrev-js" rel="noopener noreferrer"&gt;two different licenses are available in project files&lt;/a&gt;!&lt;/p&gt;

&lt;p&gt;Want help identifying licenses in your projects? Visit  &lt;a href="https://bytesafe.dev/license-compliance/" rel="noopener noreferrer"&gt;Bytesafe License Compliance&lt;/a&gt; page!&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Copyleft vs Permissive
&lt;/h2&gt;

&lt;p&gt;To allow for easier categorization and understanding of the basic principles of licenses, open source licenses can generally be divided into two main categories: &lt;strong&gt;copyleft&lt;/strong&gt; and &lt;strong&gt;permissive&lt;/strong&gt;. &lt;/p&gt;

&lt;p&gt;This categorization is based on the requirements and restrictions that the license places on users.&lt;/p&gt;

&lt;p&gt;A &lt;strong&gt;copyleft&lt;/strong&gt; (or strong copyleft) license allows derivative work, but requires you to release such work under a compatible copyleft license. &lt;/p&gt;

&lt;p&gt;Copyleft licenses are linked to the principle of reciprocity where authors want to ensure that any derived work (modifications, improvements) are also made available as open source and to the benefit of the public (and not released as closed source).&lt;/p&gt;

&lt;p&gt;A &lt;strong&gt;permissive&lt;/strong&gt; (or non-copyleft) license places minimal restrictions on how others can use the open source components. &lt;/p&gt;

&lt;p&gt;Permissive licenses allow for modifications, use in software distributed under other licenses, as well as use in non-open source (proprietary) software. &lt;br&gt;
As such permissive licenses are usually the go-to type to be used by organizations with commercial intentions for their software.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Weak copyleft&lt;/strong&gt; is a variation of the copyleft type, that is aimed at creation of software libraries. Software that uses a library with a weak copyleft license are not necessarily forced to release derived work under a compatible license (rather it depends on how it is used). &lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Popular Open Source Licenses
&lt;/h2&gt;

&lt;p&gt;Let's look at an overview of some of the most common standardized licenses and the characteristics for them.&lt;/p&gt;

&lt;p&gt;To read the full license text, use the links below (directing to GitHub supported choosealicense.com).&lt;/p&gt;

&lt;h3&gt;
  
  
  MIT &amp;amp; ISC - The go to permissive licenses
&lt;/h3&gt;

&lt;p&gt;The &lt;a href="https://choosealicense.com/licenses/mit/" rel="noopener noreferrer"&gt;MIT License (MIT)&lt;/a&gt; is one of the most recognizable open source licenses. &lt;br&gt;
It is permissive and places minimal restrictions on what you can do and must do. The license allows distribution and use of the component for commercial use while requiring only that the original license notice and copyright is included in any copy of the software. &lt;/p&gt;

&lt;p&gt;The &lt;a href="https://choosealicense.com/licenses/isc/" rel="noopener noreferrer"&gt;ISC License (ISC)&lt;/a&gt; is functionally identical to the MIT License, but with some wording deemed unnecessary removed. &lt;br&gt;
The ISC License is the default license used when setting up a new npm package with the &lt;code&gt;npm init&lt;/code&gt; command. &lt;/p&gt;

&lt;p&gt;With their permissive and simple nature, both the MIT and ISC licenses are popular for open source components. Especially if the primary intent is to be shared as dependencies for other open source projects. &lt;br&gt;
As such they are among the most used licenses for packages in the npm ecosystem. &lt;/p&gt;

&lt;h3&gt;
  
  
  Apache-2.0 - permissive and suitable for use by larger organizations
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://choosealicense.com/licenses/apache-2.0/" rel="noopener noreferrer"&gt;Apache License, Version 2.0 (Apache-2.0)&lt;/a&gt; is another popular permissive license. &lt;/p&gt;

&lt;p&gt;The main characteristics of Apache-2.0, compared to other permissive licenses, is that it provides users with a grant of patent rights from contributors.&lt;br&gt;
This makes an open source component under this license safer to use.&lt;/p&gt;

&lt;p&gt;The fact that Apache-2.0 addresses patent licenses, makes open source component under this license particularly appealing to any organizations that want to make sure they are not infringing patents when using a piece of software.&lt;/p&gt;

&lt;h3&gt;
  
  
  Gnu Public License (GPL) - copyleft at its core
&lt;/h3&gt;

&lt;p&gt;The &lt;a href="https://choosealicense.com/licenses/gpl-3.0/" rel="noopener noreferrer"&gt;Gnu Public License&lt;/a&gt; is the original for the copyleft concept, where use of a GPL licensed component forces derived work to be released to the public under a compatible license as well.&lt;/p&gt;

&lt;p&gt;Developers and organizations that promote collaboration and code sharing before anything else may prefer a license like GPL. &lt;br&gt;
But for many organizations the use of open source components with a GPL License is not preferred compared to a more permissive license with fewer restrictions and limitations.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why you need to care about licenses for the packages you use
&lt;/h2&gt;

&lt;p&gt;Part of dependency management is knowing what packages your projects are using. Including the licenses attached to those dependencies.&lt;/p&gt;

&lt;p&gt;Without this knowledge you could possibly be in breach of open source licenses agreements already.&lt;/p&gt;

&lt;p&gt;A short-list of possible consequences for license non-compliance: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Restrictions on selling your software product&lt;/li&gt;
&lt;li&gt;Involuntary release of your source code&lt;/li&gt;
&lt;li&gt;Negative press coverage for non-compliance&lt;/li&gt;
&lt;li&gt;Loss of reputation with customers or with the open source community&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For a more extensive list of possible consequences, check out our &lt;a href="https://bytesafe.dev/license-compliance/" rel="noopener noreferrer"&gt;Open Source License Compliance&lt;/a&gt; page.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Identifying non-standard licenses&lt;/strong&gt;&lt;br&gt;
The npm package &lt;a href="https://www.npmjs.com/package/jsbn" rel="noopener noreferrer"&gt;jsbn&lt;/a&gt; has the standardized license &lt;code&gt;MIT&lt;/code&gt; declared in &lt;code&gt;package.json&lt;/code&gt;, but &lt;a href="https://github.com/andyperlitch/jsbn" rel="noopener noreferrer"&gt;a custom license is also available in project files&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The Bytesafe &lt;a href="https://docs.bytesafe.dev/plugins/license-scanner/" rel="noopener noreferrer"&gt;License Scanner&lt;/a&gt; can help you identify non-standard or problematic licenses.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  License compliance can be complicated
&lt;/h2&gt;

&lt;p&gt;Make sure to address open source software licenses in your code supply chain. Start by:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Identify what open source licenses you are using&lt;/li&gt;
&lt;li&gt;Identify potentially problematic unlicensed or non-standard licenses&lt;/li&gt;
&lt;li&gt;Prune dependencies using unwanted licenses&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And if you use open source components, don’t forget to support the open source communities.&lt;/p&gt;

&lt;p&gt;Thanks for reading!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://twitter.com/bytesafedev" rel="noopener noreferrer"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj3uehdo8j7i2g40bk382.png" alt="Follow Bytesafe on Twitter"&gt;&lt;/a&gt; &lt;a href="https://www.producthunt.com/posts/bytesafe?utm_source=badge-featured&amp;amp;utm_medium=badge&amp;amp;utm_souce=badge-bytesafe" rel="noopener noreferrer"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fapi.producthunt.com%2Fwidgets%2Fembed-image%2Fv1%2Ffeatured.svg%3Fpost_id%3D300547%26theme%3Dlight" alt="Bytesafe - A better way to control your software supply chain | Product Hunt"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>opensource</category>
      <category>webdev</category>
      <category>node</category>
      <category>npm</category>
    </item>
    <item>
      <title>Control your npm packages &amp; avoid dependency confusion</title>
      <dc:creator>Andreas Sommarström</dc:creator>
      <pubDate>Fri, 19 Feb 2021 14:06:38 +0000</pubDate>
      <link>https://forem.com/sumstrm/control-your-npm-packages-avoid-dependency-confusion-1cjh</link>
      <guid>https://forem.com/sumstrm/control-your-npm-packages-avoid-dependency-confusion-1cjh</guid>
      <description>&lt;p&gt;There has been a lot of great discussions on dependency management and supply chain attacks recently. Alex Birsan posted &lt;a href="https://medium.com/@alex.birsan/dependency-confusion-4a5d60fec610" rel="noopener noreferrer"&gt;this article&lt;/a&gt; &lt;br&gt;
on &lt;em&gt;dependency confusion&lt;/em&gt; and &lt;a href="https://github.blog/2021-02-12-avoiding-npm-substitution-attacks/" rel="noopener noreferrer"&gt;npm added this post&lt;/a&gt; on avoiding &lt;em&gt;substitution attacks&lt;/em&gt; (another term for the same thing).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is dependency confusion?&lt;/strong&gt; Term coined for the confusion facing package managers (npm, yarn, pnpm) on what package version to pull into your project, what source to use and trust, when faced with multiple options.&lt;/p&gt;

&lt;p&gt;With &lt;a href="https://bytesafe.dev/" rel="noopener noreferrer"&gt;Bytesafe&lt;/a&gt;, we have been hard at work the last year to create a service that allows users to stay in control of their package dependencies.&lt;br&gt;
As such, any discussions that raises awareness on potential issues and consequences of not managing your supply chain are a top priority for us as well. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Edit: See &lt;a href="https://dev.to/sumstrm/automatically-protect-your-supply-chain-from-dependency-confusion-2n35"&gt;this follow-up post&lt;/a&gt; with an updated, safe by default solution for dependency confusion.&lt;/strong&gt; &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;How can you use Bytesafe to protect against supply chain attacks and avoid dependency confusion?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;em&gt;Update:&lt;/em&gt; &lt;a href="https://dev.to/sumstrm/automatically-protect-your-supply-chain-from-dependency-confusion-2n35"&gt;Internal packages - our secure by default solution for Dependency confusion&lt;/a&gt;!&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Update:&lt;/em&gt; Get notified with &lt;a href="https://bytesafe.dev/posts/using-issue-tracking/" rel="noopener noreferrer"&gt;Issues&lt;/a&gt; - issues are created for package versions found in multiple external upstreams, with non-matching contents. An indicator for a possible supply chain attacks.&lt;/li&gt;
&lt;li&gt;Use private npm registries to continuously monitor and control the dependencies you are using&lt;/li&gt;
&lt;li&gt;Create a dependency firewall registry&lt;/li&gt;
&lt;li&gt;Use security policies to control the flow of packages&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  Using a private registry for insights and control
&lt;/h2&gt;

&lt;p&gt;Many teams today have limited knowledge and control over the dependencies they are using. There are many talented developers who make it their responsibility to make informed and responsible decisions for the packages used in their projects. &lt;em&gt;But, the tools to get a complete top-down view are often missing&lt;/em&gt;.   &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Faindqyt2avk1s9h6zy1d.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Faindqyt2avk1s9h6zy1d.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So before you can even start to manage issues like dependency confusion, you need to address the overall dependency management:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Use private registries from Bytesafe to centralize, identify and control all the package dependencies you are using.&lt;/em&gt; &lt;br&gt;
&lt;strong&gt;&lt;em&gt;Continuously monitor your dependencies. Scanning them for potential security and license compliance issues.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;By centralizing dependency management, users no longer have to rely on manual reviews of package.json or lock-files, or point in time scans to identify the dependencies used for particular projects.&lt;/p&gt;
&lt;h3&gt;
  
  
  Configure projects to use private registry be default
&lt;/h3&gt;

&lt;p&gt;Your applications security is only as strong as its weakest link. So make sure private registries are used as the default registry for projects, by providing a custom project level &lt;code&gt;.npmrc&lt;/code&gt; configuration file.&lt;/p&gt;

&lt;p&gt;Overwriting potentially problematic individual configs when in that project space.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Example .npmrc file where all packages are fetched from Bytesafe&lt;/span&gt;
&lt;span class="nv"&gt;registry&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;https://workspace.bytesafe.dev/r/example-registry/
//workspace.bytesafe.dev/r/example-registry/:_authToken&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;AUTH_TOKEN&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;
always-auth&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nb"&gt;true&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Claim organization name and use scope for internal packages
&lt;/h2&gt;

&lt;p&gt;One option to close the attack vector for dependency confusion is the use of &lt;a href="https://docs.npmjs.com/cli/v6/using-npm/scope" rel="noopener noreferrer"&gt;scoped packages&lt;/a&gt; in conjunction with blocking your organizations name in the public registry.&lt;/p&gt;

&lt;p&gt;Users that want to deploy this tactic should &lt;a href="https://docs.npmjs.com/creating-an-organization" rel="noopener noreferrer"&gt;claim an organization name&lt;/a&gt; in the public npm registry and use that scope for internal packages (&lt;code&gt;@your-organization/pkg&lt;/code&gt;) in their private registries. &lt;/p&gt;

&lt;p&gt;Blocking the ability for packages with the same name (inside the scope) to be pulled from the public registry by accident.&lt;/p&gt;

&lt;h2&gt;
  
  
  Create dependency firewall registries
&lt;/h2&gt;

&lt;p&gt;The idea behind a dependency firewall is simple: &lt;em&gt;create a single registry that is responsible for the link to the public npm registry and works as a single point of contact with the outside world.&lt;/em&gt; &lt;/p&gt;

&lt;p&gt;All users (or other internal registries) will use this registry as a package source and npm proxy. This enables a central point where security teams can monitor and prune the registry to make sure it only includes approved packages.&lt;/p&gt;

&lt;p&gt;If needed, the link to the public npm registry can be removed entirely, and only reinstated again when package dependencies are to be added or updated. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzwjuf00sydg9uqohtk1k.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzwjuf00sydg9uqohtk1k.png" alt="Dependency firewall"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;By using a dependency firewall in this way, new packages and versions do not automatically trickle down to all other users and applications in an organization.&lt;/p&gt;

&lt;h2&gt;
  
  
  Use policies to lock dependencies or block packages
&lt;/h2&gt;

&lt;p&gt;Bytesafe offers a range of security policies to make sure users are in control of their dependencies.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fc4vhelmvlflcxve88tn9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fc4vhelmvlflcxve88tn9.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Policies are rules that are checked and enforced before registry actions are applied. For example a policy could prevent packages with known security vulnerabilities from being pulled into a registry.&lt;/p&gt;

&lt;p&gt;Short-list of examples: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The &lt;a href="https://docs.bytesafe.dev/policies/freeze/" rel="noopener noreferrer"&gt;Freeze policy&lt;/a&gt; that can be used to make registries read-only (temporarily or permanently)&lt;/li&gt;
&lt;li&gt;The &lt;a href="https://docs.bytesafe.dev/policies/secure/" rel="noopener noreferrer"&gt;Secure policy&lt;/a&gt; blocks packages with known security vulnerabilities&lt;/li&gt;
&lt;li&gt;The &lt;a href="https://docs.bytesafe.dev/policies/block" rel="noopener noreferrer"&gt;Block policy&lt;/a&gt; can be used to block whole packages or ranges of versions &lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Going forward
&lt;/h2&gt;

&lt;p&gt;Our roadmap contains many exciting security policies that we are looking to add to improve the protection against supply chain attacks.&lt;/p&gt;

&lt;p&gt;Have any questions or suggestions on features that you would like to see? Comment below or contact us on Twitter (&lt;a href="https://twitter.com/bytesafedev" rel="noopener noreferrer"&gt;@bytesafedev&lt;/a&gt;). We appreciate all insight!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Want to improve your dependency management with Bytesafe?&lt;/strong&gt; &lt;a href="https://login.bytesafe.dev/signup" rel="noopener noreferrer"&gt;Sign up&lt;/a&gt; for free. Pull your dependencies into one of our registries and test Bytesafe yourself!  &lt;/p&gt;

&lt;p&gt;&lt;a href="https://twitter.com/bytesafedev" rel="noopener noreferrer"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj3uehdo8j7i2g40bk382.png" alt="Follow Bytesafe on Twitter"&gt;&lt;/a&gt; &lt;a href="https://www.producthunt.com/posts/bytesafe?utm_source=badge-featured&amp;amp;utm_medium=badge&amp;amp;utm_souce=badge-bytesafe" rel="noopener noreferrer"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fapi.producthunt.com%2Fwidgets%2Fembed-image%2Fv1%2Ffeatured.svg%3Fpost_id%3D300547%26theme%3Dlight" alt="Bytesafe - A better way to control your software supply chain | Product Hunt"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>npm</category>
      <category>node</category>
      <category>javascript</category>
      <category>security</category>
    </item>
    <item>
      <title>Using private npm packages with GitHub Actions</title>
      <dc:creator>Andreas Sommarström</dc:creator>
      <pubDate>Mon, 15 Feb 2021 08:29:26 +0000</pubDate>
      <link>https://forem.com/sumstrm/using-github-actions-with-a-private-npm-registry-1id8</link>
      <guid>https://forem.com/sumstrm/using-github-actions-with-a-private-npm-registry-1id8</guid>
      <description>&lt;p&gt;If you are using GitHub Actions as the CI/CD service for your build chain, you may be looking for a way to include private npm packages in your builds.&lt;/p&gt;

&lt;p&gt;The solution: configure a custom package source and install your package dependencies from a private npm registry!&lt;/p&gt;

&lt;p&gt;Integrating a private registry with GitHub Actions couldn't be easier. &lt;br&gt;
So let's look into how we can setup GitHub Actions to install package dependencies in this way.&lt;/p&gt;
&lt;h2&gt;
  
  
  But first: the basics behind using a private registry
&lt;/h2&gt;

&lt;p&gt;The default registry when using npm, is the public npm registry. It contains public packages that are available for any developer to pull required packages from.&lt;/p&gt;

&lt;p&gt;But teams often require a separate and private home for their internal packages. Packages that are their own proprietary code, that is never intended to be published to any public registry.&lt;br&gt;
But still need to be shared internally, and most importantly used in builds of applications.&lt;/p&gt;

&lt;p&gt;In such cases, organizations can make use of a private registry to hold their packages. A private registry can either be something that is self-hosted or a service provided by a specialized provider.&lt;/p&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzirdtiuxvv43ov04dr0p.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzirdtiuxvv43ov04dr0p.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://bytesafe.dev" rel="noopener noreferrer"&gt;Bytesafe&lt;/a&gt; offers private npm registries. Users can:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Host and cache their private and public dependencies in a central hub&lt;/li&gt;
&lt;li&gt;Manage, overview and control their whole dependency supply chain&lt;/li&gt;
&lt;li&gt;Scan package dependencies for security vulnerabilities, block packages that are unsecure (read our &lt;a href="https://bytesafe.dev/posts/npm-security-best-practices/" rel="noopener noreferrer"&gt;security best practices&lt;/a&gt; to learn more)&lt;/li&gt;
&lt;li&gt;Identify &lt;a href="https://bytesafe.dev/license-compliance" rel="noopener noreferrer"&gt;open source licenses&lt;/a&gt; of packages used in their build chain and scan for unlicensed or problematic license issues&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;If your team requires a private registry for your CI/CD chain, &lt;a href="https://login.bytesafe.dev/signup" rel="noopener noreferrer"&gt;signup for Bytesafe!&lt;/a&gt;&lt;br&gt;
Our registries are hosted, secure and require minimal setup.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2&gt;
  
  
  GitHub Actions
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://github.com/features/actions" rel="noopener noreferrer"&gt;GitHub Actions&lt;/a&gt; is a workflow automation tool provided by GitHub.&lt;br&gt;
With the widespread use of its repository tool, it is no surprise that the popularity of its related (and to an extent included) automation tool only continues to rise.&lt;/p&gt;

&lt;p&gt;Users can build, test, and deploy code according to workflows they define and trigger the workflows based on certain events, like the push of code to a GitHub repo.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;To get the CI/CD to install dependencies using the private registry, we need to:&lt;/em&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;em&gt;Provide GitHub Actions with custom configuration for the registry to use, as well as a related access token&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Define our Actions workflow for what steps are to be run as part of our build&lt;/em&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;
  
  
  Configuring use of private registry
&lt;/h2&gt;

&lt;p&gt;Like many similar services, GitHub Actions relies on the &lt;code&gt;.npmrc&lt;/code&gt; (npm runtime configuration) file to provide custom instructions to be used by its built-in &lt;code&gt;npm&lt;/code&gt; cli. &lt;/p&gt;

&lt;p&gt;If no custom configuration is provided, &lt;code&gt;npm&lt;/code&gt; will default to fetch required package dependencies from the public registry.&lt;/p&gt;

&lt;p&gt;But as our example uses private packages not available in any public npm registry, we will use &lt;code&gt;.npmrc&lt;/code&gt; to set a custom parameters for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;registry&lt;/code&gt; (provide an URL for our private registry)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;authToken&lt;/code&gt; (provide the authentication details required to communicate with the private registry)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;always-auth=true&lt;/code&gt; (force authentication details to be sent alongside requests to private registry)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The &lt;code&gt;authToken&lt;/code&gt; will be defined as an environment variable, but more on this later.&lt;/p&gt;

&lt;p&gt;For our example we want to pull all packages from the private registry, as such we will override the default, by simply setting a new registry URL to be used for all packages. &lt;/p&gt;

&lt;p&gt;If we want to pull only a subset of packages from a registry, we can make use of &lt;code&gt;@scope&lt;/code&gt; and only packages matching the &lt;a href="https://docs.npmjs.com/cli/v6/using-npm/scope" rel="noopener noreferrer"&gt;scope&lt;/a&gt; will be fetched from that registry.&lt;/p&gt;
&lt;h3&gt;
  
  
  Putting together the .npmrc file
&lt;/h3&gt;

&lt;p&gt;First step is to provide on the registry URL that should be used. Bytesafe private registries use the following pattern:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# replace workspace and registry names to get registry URL &lt;/span&gt;
&lt;span class="nv"&gt;registry&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;https://workspace.bytesafe.dev/r/example-registry/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Next we need to create an &lt;code&gt;authToken&lt;/code&gt; to be used with requests to the private registry. Let's create a fresh token to be used solely for this CI/CD chain:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Replace example registry URL with the url for the registry of your choice&lt;/span&gt;
&lt;span class="nv"&gt;$ &lt;/span&gt;npm &lt;span class="nt"&gt;--registry&lt;/span&gt; https://workspace.bytesafe.dev/r/example-registry/ token create
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We add the generated token from the output to GitHub's built-in secret store (to make sure we do not leak credentials).&lt;/p&gt;

&lt;p&gt;Create a new repository secret called &lt;code&gt;NPM_TOKEN&lt;/code&gt; and save the created token. For more information on storing of repository secrets, refer to &lt;a href="https://docs.github.com/en/actions/automating-your-workflow-with-github-actions/creating-and-using-encrypted-secrets" rel="noopener noreferrer"&gt;GitHub's official documentation on the subject&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;We will configure our workflow to use the environment variable &lt;code&gt;NODE_AUTH_TOKEN&lt;/code&gt;, which in turn links to the &lt;code&gt;NPM_TOKEN&lt;/code&gt; secret. &lt;/p&gt;

&lt;p&gt;At this point your &lt;code&gt;.npmrc&lt;/code&gt; file should look something like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Example .npmrc file where all packages are fetched from Bytesafe&lt;/span&gt;
&lt;span class="nv"&gt;registry&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;https://workspace.bytesafe.dev/r/example-registry/
//workspace.bytesafe.dev/r/example-registry/:_authToken&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;NODE_AUTH_TOKEN&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;
always-auth&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nb"&gt;true&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you are happy with the state of your file, go ahead and push it to the related repository.&lt;/p&gt;

&lt;h3&gt;
  
  
  Alternative: Have GitHub Actions create the .npmrc file for you
&lt;/h3&gt;

&lt;p&gt;GitHub Actions can create the &lt;code&gt;.npmrc&lt;/code&gt; config for you, with the &lt;code&gt;actions/setup-node@v1&lt;/code&gt; action. &lt;/p&gt;

&lt;p&gt;If you use this approach, enter the same registry URL that you would use in &lt;code&gt;.npmrc&lt;/code&gt; and &lt;code&gt;always-auth: true&lt;/code&gt; when configuring the GitHub Actions workflow &lt;code&gt;yaml&lt;/code&gt; file.&lt;/p&gt;

&lt;h2&gt;
  
  
  Define the GitHub Actions workflow
&lt;/h2&gt;

&lt;p&gt;Now we are ready to define the workflow and what actions should be run on our behalf. &lt;/p&gt;

&lt;p&gt;This is done by creating a &lt;code&gt;yaml&lt;/code&gt; file that we store in the projects &lt;code&gt;.github/workflows&lt;/code&gt; directory. The &lt;code&gt;yaml&lt;/code&gt; file contains the steps we want to run through.&lt;/p&gt;

&lt;p&gt;We use it to tell GitHub Actions: what trigger to use (push), to checkout the code, what parameters to use with node and to install the dependencies as part of our example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;on&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;[&lt;/span&gt;&lt;span class="nv"&gt;push&lt;/span&gt;&lt;span class="pi"&gt;]&lt;/span&gt;

&lt;span class="na"&gt;jobs&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;build&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;runs-on&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ubuntu-latest&lt;/span&gt;
    &lt;span class="na"&gt;steps&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;checks out code&lt;/span&gt;
      &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;actions/checkout@v2&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Use Node.js&lt;/span&gt;
      &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;actions/setup-node@v1&lt;/span&gt;
      &lt;span class="na"&gt;with&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="na"&gt;always-auth&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
        &lt;span class="na"&gt;node-version&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;14.x'&lt;/span&gt;
        &lt;span class="na"&gt;registry-url&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;https://workspace.bytesafe.dev/r/example-registry/&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Install dependencies using a safe clean install&lt;/span&gt;
      &lt;span class="na"&gt;run&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;npm ci --ignore-scripts&lt;/span&gt;
      &lt;span class="na"&gt;env&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="na"&gt;NODE_AUTH_TOKEN&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${{secrets.NPM_TOKEN}}&lt;/span&gt;

&lt;span class="c1"&gt;# skip 'registry-url' and 'always-auth: true' parameters if these are provided by a custom .npmrc file&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Voila!&lt;/strong&gt; With that we have now configured a GitHub Actions workflow using packages from a private registry.&lt;/p&gt;

&lt;p&gt;With a setup like this, each time code is pushed to the registry, GitHub Actions will safely install the dependencies using &lt;code&gt;npm ci&lt;/code&gt; with &lt;code&gt;--ignore-scripts&lt;/code&gt; flag set.&lt;br&gt;
And obviously this is only an example. Users can design the workflow to perform the actions required for their needs.&lt;/p&gt;

&lt;p&gt;After a workflow has been triggered, users can check the status and progress of the job in the &lt;strong&gt;Actions&lt;/strong&gt; tab in GitHub.&lt;/p&gt;

&lt;h2&gt;
  
  
  Want to integrate with other cloud platform or CI/CD services?
&lt;/h2&gt;

&lt;p&gt;The basic principle of using the &lt;code&gt;.npmrc&lt;/code&gt; file to provide custom configuration is applicable for many other similar services as well. &lt;/p&gt;

&lt;p&gt;Users that want to integrate Bytesafe with other services can refer to our general &lt;a href="https://docs.bytesafe.dev/use-cases/integrating-services-with-bytesafe/" rel="noopener noreferrer"&gt;guide on integrating services with Bytesafe&lt;/a&gt; on our docs site for more information.&lt;/p&gt;

&lt;p&gt;And if you need more GitHub Actions specific details to get your build chain up and running, refer to the &lt;a href="https://docs.github.com/en/actions/guides/building-and-testing-nodejs" rel="noopener noreferrer"&gt;official GitHub Actions documentation for setting up node.js&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Thanks for reading!&lt;/p&gt;

&lt;p&gt;P.S. &lt;a href="https://login.bytesafe.dev/signup" rel="noopener noreferrer"&gt;Need a private registry for your packages? Start for free with Bytesafe&lt;/a&gt;&lt;/p&gt;

</description>
      <category>github</category>
      <category>npm</category>
      <category>webdev</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Installing unpublished npm modules from Git repos</title>
      <dc:creator>Andreas Sommarström</dc:creator>
      <pubDate>Mon, 01 Feb 2021 20:58:06 +0000</pubDate>
      <link>https://forem.com/sumstrm/installing-unpublished-npm-modules-from-git-repos-39a7</link>
      <guid>https://forem.com/sumstrm/installing-unpublished-npm-modules-from-git-repos-39a7</guid>
      <description>&lt;p&gt;Want to share and collaborate on internal npm modules from your Git repositories during development? &lt;strong&gt;Without&lt;/strong&gt; having to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Push changes to CI/CD systems to build and deploy packages to a registry&lt;/li&gt;
&lt;li&gt;Store local copies of dependencies (checked out from Git) and manage symlinks for them&lt;/li&gt;
&lt;li&gt;Manually point dependencies to a specific Git repository (and branch/commit) and maintain a development version of &lt;code&gt;package.json&lt;/code&gt; for this&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Setting up CI/CD for every feature branch just to be able to share &lt;em&gt;internal packages&lt;/em&gt; in development is not ideal. And manual updates and coordination of versions and dependencies for each commit you want to test is not very ergonomic etiher.&lt;/p&gt;

&lt;p&gt;Use an easier alternative, by connecting your Git repos to &lt;a href="https://bytesafe.dev" rel="noopener noreferrer"&gt;Bytesafe&lt;/a&gt; instead. Developers can install a module from Bytesafe, and the appropriate version will be packaged from the Git repository.&lt;/p&gt;

&lt;p&gt;And by pulling both private and public npm dependencies from Bytesafe, teams can use one central source and benefit from Bytesafe plugins and policies (that can also be applied on modules sourced from Git repositories).&lt;/p&gt;

&lt;h2&gt;
  
  
  Git upstreams
&lt;/h2&gt;

&lt;p&gt;Upstreams are linked registries that are used both as a source and destination for packages for your private registry.&lt;br&gt;
When using a Git repository upstream, teams can access internal npm modules in a way that is completely transparent to developers. Without the need for developers to configure anything special, npm modules are easily accessible for your team members' project, with the tools they regularly use. &lt;/p&gt;

&lt;h3&gt;
  
  
  Example workflow
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fxl4s65x6mfyemv52gb7r.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fxl4s65x6mfyemv52gb7r.png" alt="git-repo-with-bytesafe-workflow"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Using a Git repository as one of the upstreams for a registry. Changes pushed to Git are directly available to be fetched by other team members from Bytesafe(using their regular &lt;code&gt;npm&lt;/code&gt; / &lt;code&gt;yarn&lt;/code&gt; / &lt;code&gt;pnpm&lt;/code&gt; tooling), together with public packages (sourced from registry.npmjs.org).&lt;/em&gt; &lt;/p&gt;

&lt;h3&gt;
  
  
  Versions, branches and tags
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Branches and tags&lt;/strong&gt; Bytesafe understands Git branches and tags, which makes it easy to install versions from feature branches or release tags &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Latest&lt;/strong&gt; The dist-tag &lt;code&gt;@latest&lt;/code&gt; is mapped to the last commit in main (i.e "master" or "main") branch&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Versions&lt;/strong&gt; The version from package.json in the main branch can also be installed in addition to the versions that the above tags point to
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Installing a pkg from a Git upstream without specifying a version&lt;/span&gt;
&lt;span class="c"&gt;# Installs the latest commit from the main branch&lt;/span&gt;
&lt;span class="nv"&gt;$ &lt;/span&gt;npm &lt;span class="nt"&gt;-r&lt;/span&gt; https://abc.bytesafe.dev/r/default/ &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="s1"&gt;'your-module'&lt;/span&gt;
...
&lt;span class="c"&gt;# To install and test your project with a new branch of a dependency, &lt;/span&gt;
&lt;span class="c"&gt;# specify the branch when adding the package&lt;/span&gt;
&lt;span class="nv"&gt;$ &lt;/span&gt;npm &lt;span class="nt"&gt;-r&lt;/span&gt; https://abc.bytesafe.dev/r/default/ &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="s1"&gt;'your-module@feature-branch'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Multiple modules in a Git repository&lt;/strong&gt;&lt;br&gt;
Bytesafe finds all modules in a Git repository and makes them available for install (very useful for monorepos).&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Configuring Git upstreams
&lt;/h2&gt;

&lt;p&gt;You can add Git repositories as upstreams to a Bytesafe registry in one of two ways: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Using a URL&lt;/strong&gt; Any repository available over HTTPS and with a URL ending with .git. For private repos you can add a username/password for authentication. &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Using the Github integration&lt;/strong&gt; you can connect one or more Github accounts to Bytesafe. Allowing you to easily add repos (both public and private) by selecting them in a drop-down list.&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Private and public&lt;/strong&gt;&lt;br&gt;
Both public and private Git repositories can be added as upstreams. The Github integration makes it easy to use private repos without needing to manage tokens.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  TL;DR: Treat your Git repos like any registry
&lt;/h2&gt;

&lt;p&gt;Don't compromise on usability just because the source is a Git repository. Include the Git repository into your Bytesafe workflow instead!&lt;/p&gt;

&lt;p&gt;Interested? Head over to &lt;a href="https://bytesafe.dev/" rel="noopener noreferrer"&gt;Bytesafe&lt;/a&gt; to try it for yourself.&lt;/p&gt;

</description>
      <category>npm</category>
      <category>git</category>
      <category>javascript</category>
      <category>github</category>
    </item>
  </channel>
</rss>
