TL;DR
This paper introduces LiResolver, a novel tool designed to automatically detect and resolve license incompatibilities in open-source software (OSS) projects. By deeply understanding license semantics and considering license hierarchies, LiResolver significantly outperforms existing methods in identifying these critical legal issues and offers practical solutions, including recommending official licenses or generating custom ones.
What Problem Does This Paper Address?
The widespread adoption of open-source software (OSS) brings immense benefits, but it also introduces a significant challenge: license incompatibility. When developers incorporate third-party OSS components into their projects, they must adhere to the licenses of each component, as well as their own project's license. Conflicts can arise when these licenses impose contradictory conditions (e.g., one license allows sublicensing while another prohibits it). Resolving these incompatibilities is a complex and time-consuming task, often requiring deep legal understanding and manual effort. Existing tools struggle with the sheer volume and complexity of OSS licenses, often supporting only a limited set and lacking the ability to understand the nuanced semantics of license texts. This gap leaves many projects vulnerable to legal risks.
Methods
LiResolver tackles license incompatibility through a three-pronged approach:
- License Understanding: This is the core innovation. Instead of treating licenses as monolithic blocks, LiResolver breaks them down into fine-grained entities (actions, objects, attitudes, conditions) and extracts the relationships between these entities. This is achieved through a two-step process:
- Fine-grained Entity Extraction: Using a pre-trained RoBERTa model and a transition-based parser, LiResolver identifies these specific components within license texts.
- Relation Extraction: A prompt-based model (KnowPrompt) is employed to reconstruct the structured knowledge about how these entities relate to each other (e.g., "distribute" [action] "software" [object]).
- Incompatibility Issue Localization: LiResolver leverages a hierarchical understanding of licenses. It constructs a license hierarchy based on the project's file structure, recognizing that licenses at different levels (project-level vs. component-level) have different scopes. This hierarchy, combined with the detailed license understanding, allows for precise detection of conflicts. A key aspect here is also considering copyright holders, as licenses with the same copyright holder as the project license can be more easily modified.
- License Incompatibility Resolution: Once an incompatibility is detected, LiResolver offers solutions. It prioritizes recommending existing, official OSS licenses that satisfy the identified constraints. If no suitable official license exists, it generates a custom license tailored to the project's specific needs. This generation process is template-based, ensuring precision and avoiding the pitfalls of machine learning for legal text. The tool also handles exceptions for complex scenarios where multiple child licenses conflict and cannot be modified.
Datasets
The paper utilizes several datasets for training and evaluation:
- License Sentences: A dataset of 21,844 license sentences (11,973 from tldrlegal and 9,871 from GitHub) was manually labeled for entities and relations.
- Real-world OSS Projects: 300 popular GitHub projects were crawled and analyzed for incompatibility detection. A ground-truth dataset was constructed by three authors and a lawyer.
- Incompatible Projects: From the 300 projects, 230 were identified as having license incompatibility issues and used for evaluating the resolution capabilities.
The authors also made their datasets and replication package publicly available.
Key Insights and Ideas
- Granularity Matters: Breaking down licenses into fine-grained entities (actions, objects, attitudes, conditions) and understanding their relationships is crucial for accurate incompatibility detection, far surpassing previous approaches that treated license terms more broadly.
- Hierarchy is Key: The hierarchical structure of licenses within a project (project license vs. component licenses) is not just organizational; it fundamentally impacts how incompatibilities should be detected and resolved. Ignoring this hierarchy leads to less accurate results.
- Copyright Holders as Levers: Recognizing that licenses with the same copyright holder as the project license can be modified significantly expands the scope of potential solutions, enabling more successful resolutions.
- Beyond Official Licenses: While recommending official licenses is ideal, the ability to generate custom licenses is a vital fallback, providing flexibility when existing options are insufficient.
- Developer Awareness is Lacking: The feedback from OSS developers highlights a significant gap in understanding OSS licenses, with many unaware of subtle incompatibilities or the implications of certain license clauses.
Key Results
- Incompatibility Localization: LiResolver achieved a remarkably low false positive (FP) rate of 4.09% and a near-zero false negative (FN) rate of 0.02% for incompatibility issue localization across 230 real-world projects. This significantly outperforms existing tools like Ninka, SPDX-VT, Librariesio, and LiDetector.
- Incompatibility Resolution: LiResolver successfully resolved license incompatibilities in 144 out of 230 (62.61%) incompatible projects.
- 34.52% of issues were resolved by recommending official licenses.
- 41.56% were resolved by generating custom licenses without exceptions.
- 12.98% were resolved by generating custom licenses with exceptions.
- Developer Feedback: 10 out of 14 reported issues received positive feedback or were fixed by developers, validating the practical utility of LiResolver's findings.
Limitations and Future Work
- Project License Dependency: If a project lacks a license or its license doesn't specify a copyright holder, LiResolver's ability to identify modifiable internal licenses is limited.
- Irrelevant Licenses: The current system does not explicitly handle licenses solely intended for testing purposes, which could potentially influence results.
- Multiple Root Licenses: Projects with multiple licenses in their root directory are treated as supplementary, which might affect detection accuracy.
- Future Work: The authors suggest exploring more sophisticated methods for license generation and potentially incorporating more advanced NLP techniques for even deeper license understanding. Addressing the limitations regarding projects without clear copyright holders is also a promising direction.
Summary updated