Skip to content

Fix vulnerability table duplication across manifests in comment summary #953

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

alecbuchanan
Copy link

Move vulnerability table row array initialization inside manifest loop to prevent cross-contamination of vulnerability data between different manifest files (package.json, requirements.txt, etc).

Previously, when multiple manifests contained vulnerabilities, the same rows array was being reused across all manifests, causing vulnerabilities to appear duplicated in subsequent manifest tables. This was due to the rows array being declared once outside the manifest iteration loop.

The fix ensures each manifest gets its own clean array by moving the const rows: SummaryTableRow[] = [] declaration inside the for loop that iterates over manifests.

Added comprehensive test coverage:

  • Separate table creation for different manifests
  • Vulnerability deduplication across manifest tables
  • Multiple vulnerabilities per package in different manifests
  • Correct vulnerability grouping within manifests

All existing tests continue to pass, confirming no regression in functionality.

Move vulnerability table row array initialization inside manifest loop
to prevent cross-contamination of vulnerability data between different
manifest files (package.json, requirements.txt, etc).

Previously, when multiple manifests contained vulnerabilities, the same
rows array was being reused across all manifests, causing vulnerabilities
to appear duplicated in subsequent manifest tables. This was due to the
rows array being declared once outside the manifest iteration loop.

The fix ensures each manifest gets its own clean array by moving the
`const rows: SummaryTableRow[] = []` declaration inside the for loop
that iterates over manifests.

Added comprehensive test coverage:
- Separate table creation for different manifests
- Vulnerability deduplication across manifest tables
- Multiple vulnerabilities per package in different manifests
- Correct vulnerability grouping within manifests

All existing tests continue to pass, confirming no regression in
functionality.
@Copilot Copilot AI review requested due to automatic review settings July 29, 2025 16:08
@alecbuchanan alecbuchanan requested a review from a team as a code owner July 29, 2025 16:08
Copy link

@Copilot 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

This PR fixes a bug where vulnerability table rows were being duplicated across different manifest files due to shared array reference. The fix moves the rows array initialization inside the manifest loop to ensure each manifest gets its own clean array.

  • Moves rows array declaration inside the manifest iteration loop
  • Adds comprehensive test coverage for multi-manifest vulnerability scenarios
  • Ensures proper isolation of vulnerability data between manifests

Reviewed Changes

Copilot reviewed 2 out of 4 changed files in this pull request and generated no comments.

File Description
src/summary.ts Moves rows array initialization inside manifest loop to prevent cross-contamination
tests/summary.test.ts Adds comprehensive test coverage for multi-manifest vulnerability scenarios

@alecbuchanan
Copy link
Author

alecbuchanan commented Jul 29, 2025

@alecbuchanan alecbuchanan changed the title Fix vulnerability table duplication across manifests Fix vulnerability table duplication across manifests in comment summary Jul 30, 2025
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.

1 participant