fix: make the deny check respect pkg namespaces#1015
fix: make the deny check respect pkg namespaces#1015dominikvagner wants to merge 1 commit intoactions:mainfrom
Conversation
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
|
Hey @dominikvagner , Came across your GitHub profile while checking recent PR activity — really liked your work 👀 Quick question — do PR reviews ever slow you down? I’m building Mesrai AI — it connects to GitHub and reviews PRs and changes instantly (bugs, improvements, suggestions) before human review. You can try it here — free & quick setup (~1 min): Would really appreciate your feedback — I’m building this to solve real PR review problems, and your input would be super valuable 🙌 |
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