fix: make the deny check respect pkg namespaces#1015
Open
dominikvagner wants to merge 1 commit intoactions:mainfrom
Open
fix: make the deny check respect pkg namespaces#1015dominikvagner wants to merge 1 commit intoactions:mainfrom
dominikvagner wants to merge 1 commit intoactions:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR enhances the package denial logic to include namespace checking, preventing false positives when packages share the same name but belong to different namespaces. The getNamespace call is refactored to be computed once per change and reused across both denied packages and denied groups checks.
Key changes:
- Added namespace comparison to the denied packages matching logic
- Moved namespace extraction outside the loops for better code reuse and performance
- Added test coverage for namespace differentiation scenarios
Reviewed Changes
Copilot reviewed 2 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/deny.ts | Refactored to extract namespace once per change and added namespace check to denied packages logic |
| dist/index.js | Compiled JavaScript output reflecting the source changes |
| tests/deny.test.ts | Added test for namespace differentiation and updated existing test data with explicit package URLs |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
465a957 to
494dbc6
Compare
494dbc6 to
e9082bb
Compare
This adds a namespace condition into the deny check. This will fix an issue where the check would deny different packages than those actually provided. Also adds a test for this and fixes one test present by providing package URLs.
e9082bb to
f0f8aee
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This adds a namespace condition into the deny check. This will fix an issue where the check would deny different packages than those actually provided.
Also adds a test for this and fixes one test present by providing package URLs.
Testing steps
Steps to reproduce the behavior:
(ex.: a repo that has the valid
eslintpkg as a dependency)(ex.: deny the malware
@typescript_eslinter/eslintpkg)eslintas a denied package.Closes: #1014