Skip to content

Enhancement: keep composer.json require-dev packages as development rows in vg scan and vg sbom export #544

Closed

Description

@vibgrate-team

Context

parseComposerJson in src/core-open/scanners/php-scanner.ts already reads require-dev with isDev: true, but the scanner then keeps only allDeps.filter(d => !d.isDev) before building rows, so PHP development packages never reach the scan artifact. docs/sbom-dependency-scope.md lists this as gap 9: PHPUnit, PHPStan and friends are invisible in vg sbom export, unlike npm, Python, Rust, JVM, .NET and Elixir dev dependencies, which are exported with CycloneDX scope: excluded and SPDX DEV_DEPENDENCY_OF.

What to do

  • Emit require-dev packages as section: 'devDependencies' rows (the row-building code already maps isDev to that section).
  • Keep Packagist lookups and drift buckets on production rows only, as Elixir and Python do, so drift scores do not change.
  • A name in both require and require-dev is stored once, as dependencies.
  • Update the composer rows and gap 9 in docs/sbom-dependency-scope.md.

Acceptance

  • A require-dev package appears in vg sbom export with CycloneDX scope: excluded and SPDX DEV_DEPENDENCY_OF.
  • Drift score and buckets for a PHP fixture are unchanged.
  • Tests cover dev-only, prod-only, and a name in both tables.

Activity

  1. added
    enhancement
    on Nov 2, 2026
  2. vibgrate-team commented on Nov 2, 2026

    @vibgrate-team
    ContributorAuthor

    Confirmed: parseComposerJson already sets isDev: true for require-dev, and the row builder maps dep.isDev to devDependencies (around line 330 of php-scanner.ts), but the loop runs over prodDeps = allDeps.filter(d => !d.isDev), so dev rows never get built. Keep prodDeps for the Packagist lookups and drift buckets, then add dev rows in a separate pass that skips the registry call and the bucket counters, the same pattern elixir-scanner.ts uses. Dedupe by name first so a package in both tables stays dependencies. Updating gap 9 in docs/sbom-dependency-scope.md to say require-dev is now exported (while composer.lock expansion is still #550) will keep the doc honest.

  3. added a commit that references this issue on Nov 5, 2026
    4c89eb5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions