Skip to content

fix(scan): include a source path on license findings - #345

Merged
vibgrate-team merged 2 commits into
mainfrom
cursor/license-finding-source-path-4df1
Oct 5, 2026
Merged

vibgrate-team merged 2 commits into
mainfrom
cursor/license-finding-source-path-4df1

Conversation

@vibgrate-team

Copy link
Copy Markdown
Contributor

Summary

vg scan JSON and SARIF now name a stable source file for a declared license whenever the scan has one.

  • A package.json license or licenses field is recorded at that manifest (projects[].license.path).
  • Otherwise the first existing LICENSE / LICENCE / COPYING / NOTICE file (fixed name order, including .md and .txt) is the evidence path.
  • Text that does not resolve as SPDX is a vibgrate/license-parse-failed warning at that path (location and details.path in JSON; SARIF artifactLocation.uri and properties.path). The same rule the scan already uses for dependency license strings, via licenseParseDiagnostic. An explicit NOASSERTION is not a failure.
  • The license body is not copied into the artifact. A symlink that leaves the repository is not followed.
  • Registry-only dependency licenses still have no local file. Those findings keep the project path and omit details.path.
  • File findings are sorted by path, so the output does not follow directory walk order.

Related issues

Closes #213

Checklist

  • pnpm test passes
  • pnpm lint is clean
  • pnpm typecheck is clean
  • Docs updated (README / DOCS / ARCHITECTURE) where behavior changed
  • Determinism preserved — identical input still produces identical graph.json / report output (content-hashed IDs, stable sorts; no time, randomness, or filesystem-order dependence)
  • No proprietary or internal references — public, Apache-2.0 content only
  • Commits use Conventional Commits and are signed off (git commit -s, DCO)

Notes for reviewers

pnpm test (4982 passed), pnpm lint (existing unused-var warnings only, none in this change), and pnpm typecheck all passed.

test/license-findings.test.ts covers a fixture pkg/LICENSE whose body is not an SPDX expression. It asserts pkg/LICENSE on projects[].license.path, the JSON finding (location, details.path), and the SARIF artifactLocation.uri / properties.path, and that a later line of the file is absent from the artifact. A second call on the same tree is byte-identical. This repository's own package.json (Apache-2.0), LICENSE, and NOTICE produce no finding.

Open in Web Open in Cursor 

cursoragent and others added 2 commits October 4, 2026 12:07
Name the manifest or LICENSE/NOTICE/COPYING file on vg scan license
findings in JSON and SARIF, and report unparseable SPDX text at that
path instead of dropping it.

Signed-off-by: Cursor Agent <cursoragent@cursor.com>

Co-authored-by: vibgrate-team <vibgrate-team@users.noreply.github.com>
@vibgrate-team
vibgrate-team marked this pull request as ready for review October 5, 2026 05:40
@vibgrate-team
vibgrate-team merged commit eaa47e8 into main Oct 5, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enhancement: include source path for license findings in machine-readable scan output

2 participants