Skip to content

Conversation

@IchiiDev
Copy link

This feature was suggested by Issue #80, I have implemented it on my fork.
What has been asked is basically to add a warning if a package was pushed recently, to prevent package hijacking and malwares.

What I have done to implement it:

  1. Everytime a dependency is prompted, it will fetch https://registry.npmjs.com/:package to fetch the version's publication date
  2. Will check if 3 days have passed since the last publish
  3. If not then it will throw an error, a warning or an info telling the user the package was pushes recently and that they should be careful when upgrading.

This has been tested with some recently pushed packages and it works as expected. I will be available during the next few days to edit if any review requires changes.

@houd1ni
Copy link

houd1ni commented Dec 31, 2022

hi, @IchiiDev !
PRs here are quite stuck, hence maybe make an independent project began from the fork ? Seems that this one could be a nice start.
I have a huge issue when being at bad network environments and almost cannot npm-upgrade at all, therefore willin' to commit some code into there asap.

@IchiiDev
Copy link
Author

I'm going to send an email directly to @th0r to suggest giving ownership/management to someone else, both on the NPM registery and GitHub. If no answers ensues I will try and send a ticket to NPM's support to request ownership due to inactivity. 😄

@houd1ni
Copy link

houd1ni commented Dec 31, 2022

I'm going to send an email directly to @th0r to suggest giving ownership/management to someone else, both on the NPM registery and GitHub. If no answers ensues I will try and send a ticket to NPM's support to request ownership due to inactivity. 😄

Nice! Tag me here, please, with any news!

@houd1ni
Copy link

houd1ni commented Jan 14, 2023

@IchiiDev salut! Any news ?

@ImLunaHey
Copy link

@IchiiDev any chance you'd be able to reopen this and check it works with the latest version?

@IchiiDev
Copy link
Author

I could check, I just saw that @th0r reacted in the referenced Issue, so I'll open it again if they are willing to take a look at the changes if up to date. I closed the PR due to previous inactivity.

@IchiiDev IchiiDev reopened this May 14, 2025
@IchiiDev
Copy link
Author

image
Still works as intended 3 years ago 😄

Aside from some ESLint errors I just fixed, nothing to report here. Waiting for review. (see #80)

@IchiiDev
Copy link
Author

Will check this tomorrow

@IchiiDev IchiiDev requested a review from th0r May 19, 2025 13:57
@IchiiDev IchiiDev requested a review from th0r June 2, 2025 15:04
@IchiiDev IchiiDev requested a review from th0r June 5, 2025 09:18
publishedDatesCache[`${name}@${to}`] = getVersionPublicationDate(name, to)
.then(date => new Date(date))
.catch(() => null);
});

Choose a reason for hiding this comment

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

what're you actually trying to do because this just doesn't look right?

Copy link
Author

Choose a reason for hiding this comment

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

I am adding every promises to the object so that they can resolve in the background and be awaited once needed in the loop.

Choose a reason for hiding this comment

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

that's not really how promises work. nothing will resolve until they're awaited.

Copy link
Author

Choose a reason for hiding this comment

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

that's not really how promises work. nothing will resolve until they're awaited.

What would be the best way to approach this issue then?

Choose a reason for hiding this comment

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

what're you actually trying to do?

Choose a reason for hiding this comment

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

@IchiiDev awaiting answer here 😁

Copy link
Author

Choose a reason for hiding this comment

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

Well, I was actually waiting for someone to give some pointers on the issue, but work on the side didn't leave me much time to fix this PR.

Maybe if someone could give me any actual clue instead of asking me what I want to do? After two years I kind of gave up on the actual thing and kept the PR open out of courtesy to not throw everything in the trash.

So would anyone have any clue on how to implement the background resolution of promises the proper way?

Choose a reason for hiding this comment

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

the reason im asking is because i dont see why you need to do any of this background stuff. just resolve it as is.

Copy link
Author

Choose a reason for hiding this comment

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

@th0r asked for it, to reduce latency after each prompt.

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.

5 participants