Skip to content

chore(lockfile): add pear/packagist installed.json fixture variants#33

Merged
shino merged 2 commits intomainfrom
fix/merge-installed-json
Apr 28, 2026
Merged

chore(lockfile): add pear/packagist installed.json fixture variants#33
shino merged 2 commits intomainfrom
fix/merge-installed-json

Conversation

@shino
Copy link
Copy Markdown
Collaborator

@shino shino commented Apr 28, 2026

Summary

Add a minimal-form Composer 2.x installed.json fixture alongside the existing full-form one, and group both under per-shape sub-directories:

  • New: data/lockfile/installed-pear/installed.json — entries with only name/version/type/install-path (pear/log, pear/pear_exception). Represents PEAR-style or hand-crafted vendor entries.
  • Moved: data/lockfile/installed.jsondata/lockfile/installed-packagist/installed.json — the existing Packagist-shape entries (guzzlehttp/psr7, psr/http-message, ralouphie/getallheaders) with full source/dist/require/autoload metadata. Content unchanged.

The directory-per-variant layout matches the convention already used for npm-v1/v2/v3, poetry-v1/v2, conan-v1/v2, etc.

int-config.toml and int-redis-config.toml: replace the single [servers.composer-vendor] entry with [servers.composer-vendor-pear] and [servers.composer-vendor-packagist].

Why

future-architect/vuls used to keep a duplicate of the Packagist-shape installed.json under scanner/testdata/fixtures/installed.json, plus its own minimal-form fixture. OpenSSF Scorecard (alert future-architect/vuls#81) misread those duplicates as real vuls dependencies. Bringing the minimal-form fixture into this repo lets the companion vuls PR drop the duplicates and read both shapes from here, while still exercising the parser against each shape.

Companion PR

future-architect/vuls#2531 — switches TestAnalyzeLibrary_Golden to read from this repo and pins the integration ref to the merge commit of this PR.

Test plan

Combine the scanner-side fixture from future-architect/vuls (pear/log
and pear/pear_exception with only install-path metadata) with the
existing full-form packages (guzzlehttp/psr7, psr/http-message,
ralouphie/getallheaders) in data/lockfile/installed.json. After this,
vuls can delete its duplicate scanner/testdata/fixtures/installed.json
and read this single file directly, while the parser test still
exercises both the minimal and the full Composer 2.x package shapes.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@shino shino force-pushed the fix/merge-installed-json branch from 23d4e1b to fa54f93 Compare April 28, 2026 06:24
@shino shino marked this pull request as ready for review April 28, 2026 06:25
@shino shino requested a review from Copilot April 28, 2026 06:25
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Merges the previously duplicated “minimal-shape” Composer installed.json fixture (pear/log + pear/pear_exception with only core fields and install-path) into this repository’s existing data/lockfile/installed.json, so downstream consumers (future-architect/vuls) can use a single shared fixture while still covering both minimal and “rich” package entries.

Changes:

  • Added two minimal-form package entries (pear/log, pear/pear_exception) to the top of the packages array in installed.json.
  • Kept the existing rich-form Composer package entries (e.g., guzzlehttp/psr7) intact in the same fixture.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@shino shino requested a review from MaineK00n April 28, 2026 06:33
Replace the merged data/lockfile/installed.json with two siblings:
data/lockfile/installed-pear/installed.json (pear/log,
pear/pear_exception — minimal install-path-only entries) and
data/lockfile/installed-packagist/installed.json (guzzlehttp/psr7,
psr/http-message, ralouphie/getallheaders — full Packagist-shape
entries). This matches the directory-per-variant convention already
used for npm-v1/v2/v3, poetry-v1/v2, conan-v1/v2 and keeps the two
parser-test inputs cleanly distinct.

Update int-config.toml and int-redis-config.toml accordingly:
[servers.composer-vendor] is replaced by [servers.composer-vendor-pear]
and [servers.composer-vendor-packagist].

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
shino added a commit to future-architect/vuls that referenced this pull request Apr 28, 2026
Match the integration repo's directory split (vulsio/integration#33):
the merged installed.json fixture is replaced by two distinct fixtures
under installed-pear/ and installed-packagist/, exercising the minimal
PEAR-style and the full Packagist-style Composer 2.x package shapes
separately. Update TestAnalyzeLibrary_Golden's lockfileEntry list and
regenerate the golden files; drop the now-unused installed.json.json.

The submodule pointer and the integration ref in
.github/workflows/test.yml will be bumped together once the companion
integration PR lands.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@shino shino changed the title chore(lockfile): merge minimal-form packages into installed.json chore(lockfile): split installed.json into pear and packagist fixtures Apr 28, 2026
@shino shino changed the title chore(lockfile): split installed.json into pear and packagist fixtures chore(lockfile): add pear/packagist installed.json fixture variants Apr 28, 2026
Copy link
Copy Markdown
Collaborator

@MaineK00n MaineK00n left a comment

Choose a reason for hiding this comment

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

📚

shino added a commit to future-architect/vuls that referenced this pull request Apr 28, 2026
…ff LIBS

The two pseudo servers added in vulsio/integration#33 (replacing the
old [servers.composer-vendor] that was never wired into LIBS) need to
be listed here so make diff actually exercises the installed.json
parser. Closes a pre-existing gap as a side effect: composer-vendor
has been an orphan entry in int(-redis)-config.toml since it was added.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@shino shino merged commit 6dfd745 into main Apr 28, 2026
@shino shino deleted the fix/merge-installed-json branch April 28, 2026 08:54
shino added a commit to future-architect/vuls that referenced this pull request Apr 28, 2026
…plit

vulsio/integration#33 has merged at 6dfd74510f5944e7c973e40d7844020d53dbb3a7.
Update both sources of truth for the integration test data:

- .github/workflows/test.yml: actions/checkout ref pin
- integration/ submodule pointer

CI on this PR can now resolve installed-pear/installed.json and
installed-packagist/installed.json against the upstream merge commit.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
shino added a commit to future-architect/vuls that referenced this pull request Apr 28, 2026
CI broke after the previous suggestion changed the ref to
refs/pull/33/merge: that ref is server-side only while the PR is
open, so once vulsio/integration#33 was merged the runner got
"fatal: couldn't find remote ref refs/pull/33/merge".

Pin to the actual merge commit SHA (6dfd74510f5944e7c973e40d7844020d53dbb3a7).
A SHA is also the correct anchor for the security argument: a mutable
ref defeats the point of pinning, since whoever can move the ref can
swap in arbitrary code that go test would execute.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
shino added a commit to future-architect/vuls that referenced this pull request Apr 30, 2026
* fix(scanner/fixture): source lockfiles from vulsio/integration

OpenSSF Scorecard alert #81 was triggered by old packages declared in
scanner/testdata/fixtures/go.mod (OPA v0.35.0, docker v20.10.11, etc.)
being scanned as real dependencies of vuls. Those fixtures were just
copies of files already in vulsio/integration; they had been
duplicated here to avoid pulling submodules in CI, which would let a
fork PR redirect .gitmodules to attacker code that "go test" would
then run.

Delete the 30 duplicate files and have TestAnalyzeLibrary_Golden read
straight from integration/data/lockfile/. CI now fetches that repo
via a separate actions/checkout step pinned by commit SHA. The pin
lives in the workflow file (not .gitmodules), so a fork PR cannot
redirect it without a reviewable diff. The submodule entry stays for
local development and "make diff".

After vulsio/integration merges the matching installed.json change,
bump the ref SHA in .github/workflows/test.yml and the submodule
pointer to that merge commit.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* fix(scanner/fixture): split installed.json into pear and packagist

Match the integration repo's directory split (vulsio/integration#33):
the merged installed.json fixture is replaced by two distinct fixtures
under installed-pear/ and installed-packagist/, exercising the minimal
PEAR-style and the full Packagist-style Composer 2.x package shapes
separately. Update TestAnalyzeLibrary_Golden's lockfileEntry list and
regenerate the golden files; drop the now-unused installed.json.json.

The submodule pointer and the integration ref in
.github/workflows/test.yml will be bumped together once the companion
integration PR lands.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* fix(scanner/fixture): add composer-vendor-{pear,packagist} to make diff LIBS

The two pseudo servers added in vulsio/integration#33 (replacing the
old [servers.composer-vendor] that was never wired into LIBS) need to
be listed here so make diff actually exercises the installed.json
parser. Closes a pre-existing gap as a side effect: composer-vendor
has been an orphan entry in int(-redis)-config.toml since it was added.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* fix(scanner/fixture): bump integration ref to merged installed.json split

vulsio/integration#33 has merged at 6dfd74510f5944e7c973e40d7844020d53dbb3a7.
Update both sources of truth for the integration test data:

- .github/workflows/test.yml: actions/checkout ref pin
- integration/ submodule pointer

CI on this PR can now resolve installed-pear/installed.json and
installed-packagist/installed.json against the upstream merge commit.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* Update .github/workflows/test.yml

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* fix(scanner/fixture): only skip golden tests on missing integration dir

Per Copilot review: os.Stat returning a non-not-exist error (e.g.,
permission, IO) should fail the test, not silently skip — those
indicate real issues that masking would hide. Distinguish via
errors.Is(err, fs.ErrNotExist).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* fix(scanner/fixture): restore SHA pin for integration ref

CI broke after the previous suggestion changed the ref to
refs/pull/33/merge: that ref is server-side only while the PR is
open, so once vulsio/integration#33 was merged the runner got
"fatal: couldn't find remote ref refs/pull/33/merge".

Pin to the actual merge commit SHA (6dfd74510f5944e7c973e40d7844020d53dbb3a7).
A SHA is also the correct anchor for the security argument: a mutable
ref defeats the point of pinning, since whoever can move the ref can
swap in arbitrary code that go test would execute.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* fix(scanner/fixture): always fail when integration data is missing

Per Copilot review: t.Skipf can mask CI misconfiguration (e.g. someone
removes the integration checkout step or changes the path) and silently
disable golden-test coverage. Drop the skip path entirely — both CI and
local runs now hard-fail with a message pointing at the right remediation
(git submodule update --init locally, or check the workflow). Removes the
errors/io/fs imports that were only there for the skip branch.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* fix(scanner): fix goldenFileName doc comment example to include .json suffix

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@shino shino self-assigned this Apr 30, 2026
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.

3 participants