-
Notifications
You must be signed in to change notification settings - Fork 10
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
feat: throw forbidden error when package is blocked by security policy #1
Conversation
17a0e05
to
c88c666
Compare
const isForbidden = target && policyRestrictions && packument.policyRestrictions.restrictedVersions[target] | ||
const pckg = `${packument.name}@${wanted}${ | ||
opts.enjoyBy | ||
? ` with an Enjoy By date of ${ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Curious. What is this 'Enjoy By' date about?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting. So what's the benefit of filtering out packages that are newer than a given date? Avoiding packages that haven't been thoroughly tested or widely deployed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@djsauble Reproducing installs as they would have happened at some point in the past.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❤️
aa2c6c9
to
45b6df3
Compare
✏️ Changes
This PR introduces a new error in the case that a forbidden package was requested and blocked by the security proxy. If no manifest was found under the
versions
object, then a check is done to verify if the package is forbidden under therestrictedVersions
object. If it is, a new error code is thrownE403
and the admin custom message will be shown on the CLI like:If no policy restrictions are found on the packument then the behavior will continue as is right now and throw a
ETARGET
error.🔗 References
RFC: https://npmjs.slab.com/posts/proposed-package-filtering-messaging-on-the-cli-kejlhyow
🔍 Testing
Automated testing
✅ This change has unit test coverage
This PR depends on: npm/cli#234