Skip to content
mentoor

Topic 1 of 5 · 4 min read

Open-source licences engineers must know

Goal: Classify a licence as permissive or copyleft and state what it requires if its code ends up in your product.

An open-source licence is a set of conditions attached to code: permissive licences ask for little, copyleft licences ask you to share your own code under the same terms. Code on the internet is not free to use just because it is public. With no licence at all, the default is that you may not copy it.

Check yourself · 1 of 3

Which licence is permissive?

Choose one answer

Why it matters to you

An assistant such as Copilot, Cursor or Claude Code can add a library or paste a function in seconds. You are still the one who ships it. If the code carries a condition you cannot meet, the company can be forced to remove the feature, publish source code, or settle a claim.

The main families

  • Permissive: MIT, BSD and Apache-2.0. You may use, change and sell the code, including in closed products. You must keep the copyright notice and licence text. Apache-2.0 also gives an explicit patent grant and asks you to state changes.
  • Weak copyleft: LGPL and MPL-2.0. Changes to the licensed files or library must stay under the same licence. Your own separate code can stay closed. With LGPL, users must be able to swap the library for a modified one.
  • Strong copyleft: GPL. If you distribute a combined work that includes GPL code, the whole work must be offered under the GPL with its source.
  • Network copyleft: AGPL. It extends the GPL duty to users who only use the software over a network, so a hosted service can trigger it even without shipping a binary.

The trigger for most copyleft duties is distribution: giving the software to someone else. Internal use is usually different. AGPL is the common exception.

How to check a licence quickly

  1. Find the licence name, written as an SPDX identifier such as MIT or GPL-3.0-only.
  2. Place it in a family: permissive, weak copyleft, strong copyleft, network copyleft.
  3. Ask how you use it: ship it in an app, host it as a service, or only use it internally.
  4. Write down the duty: keep notice, share changes, or share everything.

Before and after

Weak: "The library is on GitHub, so we can use it." Better: "The library is GPL-3.0-only. We ship a desktop app, so shipping it would require offering our whole app's source under the GPL. We need another library or a legal review."

What goes wrong

  • Assuming "open source" means "no conditions". Every open licence has conditions.
  • Missing the licence of a transitive dependency. The package you asked for may pull in a GPL one.
  • Mixing up a licence and a policy. Whether your company allows a licence is a separate decision from what the licence says.
  • No licence found. A repo with no licence file gives you no rights, however easy copying is.

Examples

Two libraries, same job

Two JSON-schema libraries do what your agent needs. One is Apache-2.0, the other AGPL-3.0-only. Your company runs a hosted SaaS. The AGPL one can oblige you to offer your service's source to its users, so you pick the Apache one. The decision came from the licence family, not from the features.

A licence hidden one level down

An assistant adds fast-thumbs, which is MIT. Its own dependency, libresize, is GPL-2.0-only. The package you chose looks fine, but your lockfile now contains strong copyleft code. Check the full tree, not the top line.

Key points

  • Public code is not free code: with no licence file, you have no right to copy it.
  • Permissive licences (MIT, BSD, Apache-2.0) mainly require you to keep the copyright notice and licence text.
  • Copyleft licences (GPL, AGPL, LGPL, MPL) require you to share code under the same terms when conditions are met.
  • Most copyleft duties start when you distribute the software; AGPL also covers use over a network.
  • Check transitive dependencies, not only the package an assistant named.

Common mistakes

  • Treating anything on GitHub as free to copy.
  • Reading only the top-level package licence and ignoring its dependencies.
  • Thinking permissive means no obligations; the notice and licence text still have to ship.
  • Assuming a hosted service is safe from copyleft; AGPL is written for exactly that case.

Check yourself · 2 of 3

A public GitHub repo has no licence file. What may you do with its code?

Choose one answer

Check yourself · 3 of 3

Your team hosts a web service and wants to add a library under AGPL-3.0. What is the main risk?

Choose one answer

Practice items, not counted towards your mastery.

Start here

More for this topic