Skip to content
mentoor

Topic 3 of 5 · 4 min read

Attribution, notices and SPDX identifiers

Goal: Determine the attribution an AI-added dependency or snippet requires and write the correct notice or SPDX entry.

Almost every open licence, even the most permissive, requires that you keep the copyright notice and licence text with the code; SPDX identifiers and SBOMs are the standard way to track this without losing anything. An agent that adds a dependency or pastes a snippet will not do this paperwork for you.

Check yourself · 1 of 3

You ship a product using an MIT-licensed package. What must you do?

Choose one answer

What each family asks for

  • MIT and BSD: include the copyright line and the licence text in copies or substantial portions. A third-party notices file in your app or docs usually covers it.
  • Apache-2.0: keep the licence, keep any NOTICE file contents that apply, mark files you changed, and keep existing copyright and patent notices.
  • GPL, LGPL, MPL: the notice duties above, plus offering source for the covered code, and keeping the licence on it.

When in doubt, keep the original header on a copied file.

SPDX identifiers

SPDX gives every common licence a short, exact name, such as MIT, Apache-2.0 or GPL-3.0-only. Putting the identifier at the top of a file lets tools and people read the licence at a glance:

// SPDX-FileCopyrightText: 2026 Northwind Ltd
// SPDX-License-Identifier: Apache-2.0

The REUSE convention asks for these two tags in every file, and ships a checker. For an expression with two licences, write MIT OR Apache-2.0 (you may choose) or MIT AND BSD-3-Clause (both apply).

SBOMs

A software bill of materials lists every package in a build, with versions and licences. SPDX is one of the formats for it. An SBOM generated at build time answers "where did we ship this licence?" months later.

Steps when an assistant adds something

  1. Find the licence of the new package or snippet.
  2. Copy its copyright line and licence text into your notices file, or keep the file header.
  3. Add the SPDX tag to any new files you or the tool create.
  4. Make sure the SBOM or lockfile report includes the new package.

Before and after

Weak: the agent pastes a 40-line helper from a blog post into utils.ts with no note. Better: you find the post is under MIT, add the author's copyright line and licence text to THIRD_PARTY_NOTICES, and mark the function with // SPDX-License-Identifier: MIT.

What goes wrong

  • Stripped headers. Tools and cleanups that delete top-of-file comments also delete the licence notice.
  • Wrong identifier. GPL-3.0 is deprecated in SPDX; use GPL-3.0-only or GPL-3.0-or-later and mean one of them.
  • Notices only in the repo. If you ship a binary, the notice has to ship with it.

Examples

A file header for generated code

// SPDX-FileCopyrightText: 2026 Northwind Ltd
// SPDX-License-Identifier: Apache-2.0

export function backoff(attempt: number): number {
  return Math.min(30_000, 2 ** attempt * 250);
}

New files created with an agent get the same two tags as every other file. Put the rule in the agent's instructions file so it adds them itself.

A minimal SPDX package entry

PackageName: left-pad-lite
PackageVersion: 2.1.0
PackageLicenseDeclared: MIT
PackageCopyrightText: Copyright (c) 2021 J. Rivera

Each dependency the assistant adds shows up with its declared licence and copyright text, so the notices file can be generated instead of typed by hand.

Key points

  • MIT, BSD and Apache-2.0 still require you to keep the copyright notice and licence text.
  • Apache-2.0 adds duties for NOTICE file content and for marking files you changed.
  • SPDX identifiers such as MIT or GPL-3.0-only give each licence one exact, machine-readable name.
  • An SBOM produced at build time records which packages and licences you actually shipped.
  • Notices must travel with what you ship, not just sit in the repository.

Common mistakes

  • Believing permissive licences need no attribution at all.
  • Letting a cleanup tool or agent remove file headers that carry the licence.
  • Using an outdated or vague licence name instead of an exact SPDX identifier.
  • Keeping notices in the repo but not shipping them with the product.

Check yourself · 2 of 3

What does the tag SPDX-License-Identifier: Apache-2.0 at the top of a file do?

Choose one answer

Check yourself · 3 of 3

An agent moved code into a new file and dropped the top comment containing the original copyright and licence line. What should you do?

Choose one answer

Practice items, not counted towards your mastery.

Start here

More for this topic