We shipped an AGPL library without noticing
Published
An older version of this site bundled a library licensed under the AGPL-3.0 into a public web page, in a way that was hard to reconcile with the license's conditions. Nobody noticed for months. This is what happened, why it was easy to miss, and how you can check your own project in a few minutes.
What happened
The old site was a collection of free browser tools. One of them, a background remover, used the npm package @imgly/background-removal. The build tool bundled that package into the JavaScript file served to every visitor of that page.
The package is licensed under the GNU Affero General Public License v3 (AGPL-3.0). Meanwhile, the site:
- declared its own license as
ISCinpackage.json, with no LICENSE file in the repository, - had no link to its source code anywhere on the site,
- stated in its terms of service that its source code was the property of the site.
Why that was a problem
Two parts of the AGPL matter here. Sending a bundled JavaScript file to every visitor's browser is commonly treated as distributing ("conveying") that code, and section 6 requires conveyed object code to come with a way to get its corresponding source. Section 13 ("Remote Network Interaction") adds that if you modify the program and let users interact with it over a network, you must offer those users the source as well.
A closed-source claim in the terms of service, with no source offered anywhere, is hard to square with either. We are not lawyers, and exactly which obligations apply depends on details. But the claim that the whole site's source code was proprietary was clearly not something we could make.
Why nobody noticed
The license was not hidden, but it was not visible where people usually look either. In package-lock.json, the package's entry did not say AGPL-3.0. It said:
"license": "SEE LICENSE IN LICENSE.md"
This is a valid form described in the npm documentation for packages that use a license file instead of an SPDX identifier. The actual terms were in the package's own LICENSE.md, which turned out to be the AGPL-3.0 text.
So anything that scans license names for "GPL" sees nothing alarming here. The word never appears in the lockfile.
How to check your own project
1. List every license that isn't one you already know
Run this in the folder that contains package-lock.json (npm 7 or later; bash, zsh or similar). It prints production dependencies whose license is not MIT, ISC, Apache-2.0 or BSD:
node -e 'const l=require("./package-lock.json");for(const[p,v]of Object.entries(l.packages||{}))if(p&&!v.dev&&!/^(MIT|ISC|Apache-2\.0|BSD-[23]-Clause)$/.test(v.license||""))console.log(p.replace(/^.*node_modules\//,""),v.license||"(none)")'
On the old site's lockfile it printed exactly one line:
@imgly/background-removal SEE LICENSE IN LICENSE.md
Or drop the file into the license checker on this site, which groups packages by risk and reads the file only in your browser.
2. Open the license file of everything that isn't a plain identifier
Entries such as SEE LICENSE IN …, a missing license field or an unusual string can't be classified automatically. Open the LICENSE file in node_modules/<package>/ or in the package's repository and read the first lines. That is where surprises tend to be.
3. Check whether it actually ships
A dependency used only in tests or the build rarely matters for distribution. One that is bundled into what users download or use over the network does. In our case the package was clearly shipped: its name and its model download URL appeared in the deployed JavaScript bundle.
What the checker found on the old site
After building the license checker, we ran it on the old site's lockfile. Of the 58 production dependencies, 57 were permissive (MIT, ISC, Apache-2.0 and so on). One was marked "needs manual check": @imgly/background-removal.
To be precise about what that means: the checker could not tell that the package was AGPL. The lockfile simply doesn't say so. What it can do is single out the one package out of 58 that needs a human to open its license file. For this site, that would have been enough.
What we did
There were four options: make the site comply with the AGPL by releasing its source under the same license, replace the library with one under a permissive license, buy the commercial license the vendor offers, or remove the tool.
The site had almost no traffic, so we removed the background remover and its dependency, and rewrote the terms so they no longer claimed ownership of the source code. Later the whole site was rebuilt, and the tools now use no third-party libraries. The only external script is the one that shows ads.
Takeaways
- A dependency's license is not always in its license field.
SEE LICENSE INmeans "go and read the file". - Scanning for "GPL" is not enough. Review everything that isn't a license identifier you recognise.
- What matters is what you ship and how. Check bundled code, not just the dependency list.
To check your own project, drop your package-lock.json into the npm license checker. It runs in your browser and nothing is uploaded.
This article describes our own case and is not legal advice.