dsh-license-guard: Open Source License Compliance Check for Dependency Trees and the Project

Preface

When building applications or plugins with DSH, dependencies often nest layer by layer. Before a release, open-sourcing, or customer audit, relying solely on a visual scan of package.json easily leads to missing highly infectious licenses like GPL/AGPL, or failing to find identifiable license information in the project root directory or manifest. If questioned later about “why GPL was used without open-sourcing as required,” the risk already existed from the moment of “distribution.”

The following introduces the DSH plugin dsh-license-guard by maintainer feely0208 (npm package name @deepwhale-cn/dsh-license-guard, category admin-security). It scans the dependency tree in the current project directory and flags license-related risks according to fixed rules; it can also be run via CLI independently without installing DSH. The check usually takes only a few seconds, and the exit code can be used for CI.

What is this

dsh-license-guard performs open-source license and license compliance checks: it scans the dependency tree to identify risks such as GPL/AGPL infection, unknown licenses, and missing LICENSE files, making it suitable for a run before release, open-sourcing, or during audits.

Unlike tools that “only list dependency licenses,” the README explicitly states that it does not just look at dependencies but also examines the project itself—for example, a missing LICENSE in the repository or a missing license field in package.json. These two types of issues prevent downstream users from determining whether they can legally use your code.

The plugin belongs to the GitHub repository feely0208/dsh-license-guard and can be found in the DSH community directory (e.g., the skillhub.cn plugin page). The DSH ecosystem philosophy is “everything is a plugin”; the community directory is an independent site and has no official affiliation with DeepSeek / High-Flyer.

What it checks

The README summarizes the key check points using a level table (the tool internally has 5 rules, covering dependency tree license risks and basic project files):

Level Content
High GPL / AGPL —— Strongly infectious
Medium Unknown license (no license ≠ free to use) · Missing LICENSE in project
Low LGPL / MPL / EPL · Missing license field in package.json

Does not cover: Patent clauses, trademarks, export controls, and non-SPDX custom agreements like SSPL/BUSL. The license field in dependency declarations may be inaccurate (written incorrectly by maintainers); this tool does not verify its authenticity.

The README uses a typical scenario to illustrate “what happens without it”: if an undetected GPL dependency is mixed into a product and distributed externally, GPL obligations may be triggered from the time of distribution; running a check costs very little, contrasting with the cost of a post-incident audit. This is an explanatory scenario in the README, not third-party empirical data.

Installation and Enablement

Install in the DSH environment (commands from the official README):

# DSH Plugin (Recommended)
dsh plugin --profile web add @deepwhale-cn/dsh-license-guard

When not dependent on DSH, it can be executed once via npm (also from the README):

npx @deepwhale-cn/dsh-license-guard

package.json requires Node >=18 and DSH engine >=0.1.0-rc.6. The plugin reads directory and dependency information with the current dsh process privileges; before installing or using, you should review the repository source code and MIT license declaration yourself, and take responsibility for compliance conclusions. README boundary declaration: Users must comply with local laws and regulations and assume responsibility for the consequences of using this project.

Typical Usage

Execute the following commands in the project root directory (all from the README):

dsh-license-guard                # Scan current directory
dsh-license-guard --demo         # See effects with built-in samples
dsh-license-guard --html r.html  # Output HTML report

Scanning without parameters is suitable for self-checks before daily releases; --demo facilitates confirming the output format without connecting to a real repository; --html generates an HTML report that can be archived or attached to audit materials. The README explains that exit codes can be hooked into CI; specific pipeline configurations need to be set according to your CI’s strategy for non-zero exit codes.

Report examples and rule explanation diagrams can be found in the links in the README (deepwhale.org.cn plugin resource path).

Applicable Scenarios and Notes

Who it is for: Developers maintaining Node/frontend or DSH plugin repositories who need to quickly scan for license risks before release/open-sourcing/audits. When paired with plugins like dependency poisoning and Bill of Materials in the DeepWhale Security Guard series’ “Supply Chain and Build” direction, the README positions it as “one plugin for one job,” allowing combination use when security issues appear in a chain.

Must know:

  1. The tool provides rule-based alerts based on declarations and project files, which cannot replace legal advice.
  2. It does not cover custom agreements like SSPL/BUSL or dimensions like patents and trademarks.
  3. The license field in the dependency tree is not verified for authenticity by the tool.

Conclusion

dsh-license-guard combines “dependency infectious licenses” and “missing license information in the project itself” into a single scan. Using short commands and CI-ready exit codes, it turns license self-checks before releases, open-sourcing, and audits into a fixed step.

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye