License Compliance

Earn 25 points (50 with Pro) in two steps

  1. ① Read through the lesson — each section gets a ✓ as you scroll through it.
  2. ② When every section has a ✓, tap Complete lesson.

0 of 11 read · keep scrolling

✦ See fewer ads and earn double points — 50 a lesson instead of 25 — with Pro

Master Class: License Compliance in Modern Software Supply Chains

Introduction: Why License Compliance Matters

In the modern era of software development, building an application from scratch is a rarity. Most projects rely heavily on open-source libraries, frameworks, and tools to accelerate delivery and functionality. While this modular approach is efficient, it introduces a significant risk: legal and intellectual property exposure through software licenses. License compliance is the practice of ensuring that the software components you use—whether direct dependencies or transitive dependencies—are used in accordance with the legal terms set forth by their respective copyright holders.

Failing to manage these licenses can lead to severe consequences, ranging from forced open-sourcing of proprietary code to costly litigation and brand damage. If you unknowingly include a library under a "copyleft" license (like GPL) in a commercial product, you might be legally obligated to release your entire proprietary source code to the public. As supply chains grow more complex, manually tracking these licenses becomes impossible. This lesson explores how to automate license compliance using Dependency Review and Software Bill of Materials (SBOM) practices, providing you with the tools to secure your software supply chain effectively.


Not read yet

Understanding the Landscape of Software Licenses

To manage compliance, you must first understand the different categories of software licenses. Not all open-source licenses are created equal. They generally fall into three main buckets: Permissive, Weak Copyleft, and Strong Copyleft.

1. Permissive Licenses

These are the most developer-friendly licenses. They allow you to use, modify, and distribute the software with very few restrictions, provided you include the original copyright and license notice. Examples include:

  • MIT License: Very short and simple; allows almost anything.
  • Apache 2.0: Similar to MIT but includes an explicit grant of patent rights from contributors.
  • BSD (2-Clause or 3-Clause): Similar to MIT, often used in academia and infrastructure projects.

2. Weak Copyleft Licenses

These licenses occupy a middle ground. They require that if you modify the library itself, you must release those changes under the same license, but you can typically link to the library from your proprietary code without needing to open-source your entire application. Examples include:

  • LGPL (Lesser General Public License): Frequently used for shared libraries.
  • MPL (Mozilla Public License): Requires file-level sharing of modifications.

3. Strong Copyleft Licenses

These are the most restrictive. If your application incorporates or links to a library under a strong copyleft license, the "viral" nature of the license may require you to release your entire source code under the same license if you distribute your software. Examples include:

  • GPL (General Public License): The gold standard for open-source, but risky for proprietary commercial software.
  • AGPL (Affero GPL): Specifically designed to close the "SaaS loophole," meaning if you provide the software as a service, you must provide the source code to users.

Callout: The "Viral" Nature of Licenses The term "viral" is often used to describe strong copyleft licenses like the GPL. It implies that if your code touches this library, the license spreads to your code. While "viral" is not a legal term, it accurately captures the risk: the license terms can propagate through your entire software stack if you are not careful about how you integrate components.


Not read yet

Building an SBOM (Software Bill of Materials)

An SBOM is essentially a formal, structured list of every component, library, and module that makes up your application. Think of it like an ingredient label on a food package. Without an SBOM, you are flying blind regarding what is inside your software.

Why SBOMs are Essential for Compliance

Creating an SBOM allows you to scan your dependencies automatically. By generating a machine-readable document (like SPDX or CycloneDX), you can feed this into automated compliance tools. These tools compare the contents of your SBOM against a database of known licenses, flagging any problematic components before they reach production.

Step-by-Step: Generating an SBOM

Most modern package managers have plugins or CLI tools to generate SBOMs. Here is how you might generate one for a standard Node.js project using the cyclonedx-npm tool.

  1. Install the tool: npm install -g @cyclonedx/cyclonedx-npm
  2. Navigate to your project root: cd my-project
  3. Generate the SBOM: cyclonedx-npm --output-format JSON --output-file bom.json

Once you have the bom.json file, you have a complete inventory of your dependencies. You can then use this file to perform automated checks.

Note: Always generate your SBOM from the lockfile (e.g., package-lock.json, go.sum, poetry.lock) rather than the manifest file (package.json). The lockfile contains the exact resolved versions and sub-dependencies, which is critical for accurate compliance reporting.


Not read yet

Implementing Dependency Review

Dependency Review is the practice of inspecting new dependencies before they are merged into your codebase. By integrating this into your CI/CD pipeline, you can prevent "license creep," where an engineer accidentally introduces a library with an incompatible license.

Setting up Automated Dependency Review

Most CI/CD platforms (like GitHub Actions) offer native Dependency Review features. These features compare the dependencies in a Pull Request against a predefined policy. If a developer attempts to add a dependency with a restricted license, the build fails automatically.

Example Configuration (GitHub Actions)

You can create a workflow file .github/workflows/dependency-review.yml to automate this:

name: Dependency Review
on: [pull_request]

jobs:
  dependency-review:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v3

      - name: Run Dependency Review
        uses: actions/dependency-review-action@v3
        with:
          # Define your allowed licenses here
          allow-licenses: MIT, Apache-2.0, BSD-3-Clause
          # Fail the build if a forbidden license is found
          fail-on-severity: critical

This configuration ensures that any PR adding a dependency with a license other than MIT, Apache 2.0, or BSD-3-Clause will fail the check. This forces the developer to justify the addition or find a compliant alternative.


Not read yet

Best Practices for License Compliance

Managing licenses is as much about process as it is about tooling. Follow these best practices to maintain a clean software supply chain.

1. Establish a Corporate License Policy

Before you can enforce compliance, you must define what is allowed. Create a document that categorizes licenses into:

  • Approved: Permissive licenses that require no review.
  • Conditional: Weak copyleft licenses that require legal/architecture review.
  • Prohibited: Strong copyleft licenses that are banned for proprietary products.

2. Shift Left

Don't wait until the end of a sprint to check for license compliance. By "shifting left," you move the compliance check to the developer's workstation or the initial Pull Request stage. This makes it significantly cheaper and easier to swap out a non-compliant library early in the development cycle.

3. Audit Transitive Dependencies

Many developers focus only on direct dependencies—the libraries they explicitly import. However, those libraries have their own dependencies, which have their own dependencies. License compliance issues are most common in these deep, hidden layers of the dependency tree. Always use tools that perform recursive audits.

4. Maintain an Automated Inventory

Do not rely on manual spreadsheets. Use tools that automatically update your SBOM and license inventory whenever a build runs. This ensures that your documentation is always current, which is vital for audits or when preparing for a product release.

5. Document Exceptions

Sometimes, you might have a legitimate reason to use a library with a restrictive license (e.g., it is a critical utility and you are only using it in a build-time tool, not shipping it in the product). Create a formal process to grant and document these exceptions so that developers aren't blocked unnecessarily.

Callout: Compliance vs. Security While license compliance and vulnerability management often overlap, they are distinct. Vulnerability management focuses on security flaws (CVEs), while license compliance focuses on legal obligations. You can have a dependency that is "secure" (no known vulnerabilities) but "non-compliant" (an incompatible license). You need separate policies and workflows for both.


Not read yet

Common Pitfalls and How to Avoid Them

Pitfall 1: Ignoring the "Dual-License" Problem

Some libraries are dual-licensed, meaning the author provides them under two different licenses (e.g., GPL and a commercial license). If you are using the library in a commercial setting, you might need to purchase a commercial license to avoid the GPL requirements.

  • Solution: Use tools that can detect dual-licensing and ensure your developers are aware of which license they are opting into.

Pitfall 2: Assuming "Open Source" means "Free"

Developers often confuse "open source" with "public domain." Just because code is available on GitHub does not mean you can do whatever you want with it.

  • Solution: Educate your team on the difference between "open source" and "public domain." Always check the LICENSE file in the repository. If it is missing, treat the code as "all rights reserved" and do not use it.

Pitfall 3: Failing to Attribute

Even with permissive licenses like MIT, you are legally required to include the original copyright notice in your product's documentation or "About" screen.

  • Solution: Automate the generation of a "Third-Party Notices" file. Many build tools can crawl your node_modules or library folders and aggregate all license files into a single NOTICE file that you can ship with your app.

Pitfall 4: The "SaaS Loophole" Mistake

Many developers believe that as long as they don't distribute their software (i.e., they run it as a service), they don't have to worry about copyleft licenses. This is false for AGPL-licensed software.

  • Solution: Explicitly blacklist AGPL-licensed software from your environment unless it has been vetted by legal counsel.

Not read yet

Comparison: License Management Approaches

Feature Manual Spreadsheet Automated SBOM/CI Tools
Accuracy Low (Human error) High (Machine-verified)
Speed Slow (Weeks/Months) Instant (Seconds)
Visibility Limited to direct deps Full (Recursive/Transitive)
Enforcement Reactive (Audit-based) Proactive (Build-gate)
Scalability Poor Excellent

Step-by-Step: Handling a License Violation

If your automated system flags a license violation, follow this structured process to resolve it:

  1. Analyze the Alert: Determine exactly which dependency is causing the issue and what the license is. Verify if it is a direct or transitive dependency.
  2. Evaluate the Risk: Does this library actually pose a legal risk? If it is a build-time tool (like a test runner or linter) that is not shipped with your final binary, the risk is usually lower. If it is part of the core product code, the risk is high.
  3. Search for Alternatives: Can you replace the library with one that has a more permissive license? Search the ecosystem for functionally equivalent packages.
  4. Request Exception: If the library is critical and no alternative exists, prepare a business case for why it is necessary and present it to your legal/security team for an exception.
  5. Remediate: If no exception is granted, remove the dependency or refactor your code to remove the reliance on that specific library.
  6. Verify: Re-run your CI pipeline to ensure the build passes and the violation is cleared.

Not read yet

Advanced Topic: Managing Transitive Dependencies

Transitive dependencies—the "dependencies of your dependencies"—are the primary source of license headaches. For instance, you might use a library that is licensed under Apache 2.0, but that library might rely on a sub-dependency that is licensed under GPL. If you are not scanning the full graph, you will never know that your product is technically "tainted."

Using Lockfile Analysis

To solve this, your compliance tool must parse the lockfile of your package manager.

  • npm/yarn: Parse package-lock.json or yarn.lock.
  • Python: Parse poetry.lock or requirements.txt (though requirements.txt is less reliable for transitive versions).
  • Go: Use go.sum and go.mod.

Dependency Pinning

By pinning your dependencies to specific versions, you ensure that your license landscape doesn't change unexpectedly between builds. If a sub-dependency updates its license in a new version, a floating dependency version could introduce a violation without you changing any of your own code.

Tip: Use a tool like npm-audit or snyk regularly, even outside of your CI/CD pipeline, to monitor your dependency tree for license changes in existing versions, as sometimes project maintainers may re-license their code.


Not read yet

The Role of Legal Counsel

While automation handles 90% of license compliance, it cannot replace legal judgment. Your automated system should be configured to flag "conditional" licenses (like LGPL or MPL) for manual review.

When a developer triggers a flag for a manual review, provide the legal team with:

  • The name of the library and its license.
  • How the library is being used (e.g., dynamically linked, statically linked, or as a standalone CLI tool).
  • Whether the library is being distributed to end-users or only used internally.
  • The business impact of using or not using the library.

This context allows the legal team to make an informed decision rather than simply saying "no" to everything.


Quick Reference: License Categories

License Family Examples Risk Level Compliance Action
Permissive MIT, Apache 2.0, BSD Low Automated approval
Weak Copyleft LGPL, MPL Medium Legal review required
Strong Copyleft GPL, AGPL High Generally prohibited
Proprietary Custom/Unknown High Legal review required

Not read yet

Frequently Asked Questions (FAQ)

Q: Does using a library under the GPL license in my unit tests count as distribution?

A: Generally, no. Unit tests are typically not distributed to end-users. However, you should confirm this with your legal team, as internal distribution can sometimes trigger different requirements.

Q: What if a library has no license file?

A: If a library has no license file, you have no legal right to use it. You must assume "all rights reserved" and find an alternative or reach out to the author to request a license.

Q: Can I use an SBOM to manage security vulnerabilities too?

A: Yes. An SBOM is a foundational document for both license compliance and security. Many tools, like Dependency-Track, use the SBOM to continuously monitor for both license violations and newly discovered CVEs.

Q: How often should I scan for license compliance?

A: You should scan on every Pull Request and at least once a day in your main branch. This ensures that you catch violations immediately and that you are aware of any new license changes in the ecosystem.


Not read yet

Key Takeaways

  1. Automation is Mandatory: Manual license tracking is prone to error and cannot scale. Use CI/CD tools to automate the generation of SBOMs and the enforcement of license policies.
  2. Define Your Policy: Clearly distinguish between allowed, restricted, and prohibited licenses within your organization. Communicate this policy to all developers early in the development lifecycle.
  3. Focus on Transitive Dependencies: Most compliance issues hide in the sub-dependencies. Ensure your tools are configured to scan the entire dependency graph, not just the top-level libraries.
  4. Shift Left: Integrate compliance checks into the development workflow (e.g., Pull Request gates) to catch issues before they are merged into the main codebase.
  5. Documentation is Legal Protection: Always maintain an up-to-date SBOM and a file of third-party notices. This is essential for transparency and legal compliance during software audits or acquisitions.
  6. Don't Ignore the "No License" Case: Code without an explicit license is not "free." It is copyrighted and legally restricted. Avoid using libraries that do not explicitly state their license terms.
  7. Treat Compliance as a Shared Responsibility: License compliance is not just the job of the legal team. Developers, architects, and security engineers must collaborate to ensure the supply chain remains healthy and compliant.

By implementing these practices, you transform license compliance from a scary, "hidden" risk into a manageable, automated part of your software delivery process. This not only protects your organization from legal threats but also contributes to the overall maturity and sustainability of your software supply chain.

Not read yet

Each section gets a ✓ as you scroll through it. Tap the button to jump to the next one.