Skip to content

Add reference-only notices for extractor dependencies - #23363

Closed
asgerf wants to merge 9 commits into
mainfrom
asgerf/go-license-notices
Closed

asgerf wants to merge 9 commits into
mainfrom
asgerf/go-license-notices

Conversation

@asgerf

@asgerf asgerf commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

No description provided.

asgerf and others added 9 commits December 4, 2026 14:37
Discover transitive dependencies across supported platforms and track copied tokenizer sources. Keep generation metadata and NOTICES alongside dependency updates, and reject stale packaged notices without requiring access to the shared legal texts.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Generic shared license texts such as MIT start with a placeholder pointing back to each package's copyright, so NOTICES entries need to carry the copyright lines the license requires us to reproduce.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Add a rust_notices macro that inventories the crates actually linked into shipped binaries, across every bundle platform, using an aspect and analysis-only C++ and Swift toolchains (registered in MODULE.bazel along with the extra Rust target triples). cargo_notices.py turns that inventory into NOTICES entries that reference shared legal texts, and fails when a license has no shared text, a copyright needs review, or native code linked into Rust is not covered by the extractor's extras. Wiring individual extractors follows separately.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
List the crates linked into the extractor, and through notices-extras.json the vendored Lark, blib2to3, CPython sources, six stubs and the tree-sitter-python grammar embedded in the local tsp crate.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
swift-syntax and the statically linked Swift runtime are native code linked into the Rust extractor, so they are attributed through notices-extras.json.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The internal C/C++ pack ships this file at its root.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Derive the JavaScript extractor inventory from the TypeScript parser wrapper's production dependency graph in package-lock.json. Keep reviewed license references in the generated NOTICES and fail generation when a new dependency has no reviewed attribution. Validate the public pack output against the CLI's shared legal texts in the internal packaging layer.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@asgerf
asgerf requested review from a team as code owners December 4, 2026 13:38
Copilot AI adaptive review requested due to automatic review settings December 4, 2026 13:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Unsupported Starlark lambda syntax breaks all five Rust extractors’ build and packaging targets, while experimental notice references resolve incorrectly and installed peer dependencies are omitted from attribution.

3 open issues
What changed in this PR

Adds reference-only dependency notices to CodeQL extractor packages, keeping legal texts centralized in the CLI distribution.

Changes:

  • Adds dependency inventories and generated notices for seven extractor components.
  • Integrates notice generation and freshness checks into Bazel packaging.
  • Adds shared validation utilities, tests, and regeneration documentation.
File Description
unified/​notices-extras.json Records Swift dependency attribution.
unified/​NOTICES Adds Unified dependency notices.
unified/​BUILD.bazel Packages checked notices.
rust/​NOTICES Adds Rust dependency notices.
rust/​BUILD.bazel Integrates notice checks and packaging.
ruby/​NOTICES Adds Ruby dependency notices.
ruby/​BUILD.bazel Integrates notice checks and packaging.
python/​notices-extras.json Records vendored dependency attribution.
python/​NOTICES Adds Python dependency notices.
python/​BUILD.bazel Integrates notice checks and packaging.
MODULE.bazel Enables cross-platform inventory analysis.
misc/​notices/​stub-swift-version Supplies analysis-only Swift version metadata.
misc/​notices/​stub_cc_toolchain.bzl Defines an analysis-only C++ toolchain.
misc/​notices/​README.md Documents notice generation and review.
misc/​notices/​notices.py Renders notices and validates legal-file references.
misc/​notices/​notices_test.py Tests shared rendering and validation.
misc/​notices/​crate_reviews.py Records reviewed crate attribution overrides.
misc/​notices/​cargo_notices.py Generates notices from Cargo inventory facts.
misc/​notices/​cargo_notices_test.py Tests license selection and attribution checks.
misc/​notices/​cargo_facts.py Extracts crate license metadata.
misc/​notices/​BUILD.bazel Defines notice tools, tests, and analysis platforms.
misc/​bazel/​rust_notices.bzl Discovers Rust dependencies and defines notice targets.
misc/​bazel/​go_notices.bzl Discovers shipped Go dependencies and Java sources.
javascript/​README.md Documents notice regeneration.
javascript/​NOTICES Adds TypeScript attribution.
javascript/​generate_notices.py Inventories locked production dependencies.
javascript/​generate_notices_test.py Tests dependency discovery and review checks.
javascript/​extractor/​lib/​typescript/​BUILD.bazel Exposes manifests to notice generation.
javascript/​BUILD.bazel Generates, checks, and packages notices.
go/​README.md Documents attribution and regeneration workflows.
go/​NOTICES Adds Go and OpenCSV attribution.
go/​generate_notices.py Generates notices from shipped dependency inventories.
go/​generate_notices_test.py Tests inventory coverage and attribution validation.
go/​extractor/​BUILD.bazel Exposes module metadata.
go/​BUILD.bazel Integrates inventory generation and checked notices.
cpp/​extractor/​bmn/​NOTICES Adds bmn dependency notices.
cpp/​extractor/​bmn/​BUILD.bazel Adds Rust notice-generation targets.

Review effort: Balanced (adaptive)

Comment on lines +112 to +126
def _rust_inventory_impl(ctx):
inventories = [
dep[_InventoryInfo]
for deps in ctx.split_attr.components.values()
for dep in deps
]
if not any([inventory.has_rust for inventory in inventories]):
fail("No shipped Rust code found in %s" % ctx.attr.components)
toolchain = ctx.toolchains["@rules_rust//rust:toolchain_type"]
manifest = ctx.actions.declare_file(ctx.label.name + ".manifest.json")
ctx.actions.write(manifest, json.encode_indent({
"crates": sorted([
json.decode(crate)
for crate in depset(transitive = [inventory.crates for inventory in inventories]).to_list()
], key = lambda crate: (crate["name"], crate["version"])),
Comment on lines +65 to +68
for child in record.get("dependencies", {}):
pending.append((package_path, child))
for child in record.get("optionalDependencies", {}):
pending.append((package_path, child))
Comment thread unified/BUILD.bazel
name = "codeql-extractor-yml",
srcs = [
"codeql-extractor.yml",
":checked-notices",
@asgerf asgerf closed this Dec 4, 2026
@asgerf
asgerf deleted the asgerf/go-license-notices branch December 4, 2026 13:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants