storybook icon indicating copy to clipboard operation
storybook copied to clipboard

[Bug]: The latest version depends on the highly vulnerable `ip` package

Open fyodorio opened this issue 1 year ago • 16 comments

Describe the bug

The vulnerability is described here: https://github.com/advisories/GHSA-78xj-cgh5-2h22.

As far as I can see now, the ip package is used only ones in the core-server package here — https://github.com/storybookjs/storybook/blob/ece1fb269cc44f43a5384f986a2b9f48613b0095/code/lib/core-server/src/utils/server-address.ts#L13C1-L13C80

This can easily be swapped with some other package, like for instance https://www.npmjs.com/package/ip-address, the way socks' lib maintainer did here — https://github.com/JoshGlazebrook/socks/pull/94/files.

WDYT guys? Is it a good candidate for a quick fix? I could participate if necessary with the PR, for sure.

To Reproduce

Install any storybook flavour via npm (most of them depend on the vulnerable package through core-server)

System

No response

Additional context

No response

fyodorio avatar Feb 13 '24 10:02 fyodorio

+1

emangoro-sc avatar Feb 13 '24 10:02 emangoro-sc

+1

totmaxim avatar Feb 13 '24 12:02 totmaxim

For people searching by CVE number, it is: CVE-2023-42282

0xR avatar Feb 13 '24 13:02 0xR

Just to set some context for the ip vulnerability:

The affected ip.isPublic() method is not used by Storybook. Hence, the vulnerability reported by npm audit doesn't affect Storybook users. We should still consider replacing the package with another one since it isn't maintained anymore.

@fyodorio Please feel free to create a PR with the quick fix :)

valentinpalkovic avatar Feb 13 '24 15:02 valentinpalkovic

+1

shajjhusein avatar Feb 13 '24 23:02 shajjhusein

@valentinpalkovic which branch should I target the fix PR to? Hadn't found any rules/strategies on that. As I can see, most of the PRs are targeted to next but I guess it's the 8th version, right? Or it's OK to do the the same and the update will be backported in a patch to 7th?

fyodorio avatar Feb 14 '24 04:02 fyodorio

Hey @fyodorio. I guess into the latest-release.

letavocado avatar Feb 14 '24 04:02 letavocado

Oh no! Into next. Based on my research the Release bot generates changes.

For example this PR#25907 commits into next. And release bot takes it as a generated changelog and commits into latest-release PR#25843.

image

letavocado avatar Feb 14 '24 05:02 letavocado

Correct! next is the right branch.

valentinpalkovic avatar Feb 14 '24 06:02 valentinpalkovic

@valentinpalkovic made the suggestion via https://github.com/storybookjs/storybook/pull/26025, please review, any feedback is welcome, as I'm a first-time contributor here.

fyodorio avatar Feb 14 '24 08:02 fyodorio

+1

JulienMalcouronne avatar Feb 14 '24 17:02 JulienMalcouronne

Please use the 👍 emoji reaction on the initial issue message to upvote the issue, otherwise all core maintainers and participants get notified every time someone posts a „+1“ message, which additionally adds a lot of noise to the thread.

valentinpalkovic avatar Feb 14 '24 18:02 valentinpalkovic

is the plan to add this to 8.0 or will there be the possibility of a 7.X security patch when a solution is chosen 😊

alilland avatar Feb 14 '24 19:02 alilland

I definitely plan to patch this back to 7.6.x!

valentinpalkovic avatar Feb 14 '24 19:02 valentinpalkovic

I'm replacing ip with https://www.npmjs.com/package/ip-address in some of my packages. I wanted to share this because it took some time for me to figure what the ip should be replaced with.

grybykm avatar Feb 15 '24 10:02 grybykm

Seems to be fixed with 2.0.1: https://github.com/indutny/node-ip/pull/138#issuecomment-1951710634

There is also a PR https://github.com/storybookjs/storybook/pull/26086 (crosslinking https://github.com/storybookjs/storybook/issues/26011)

jase88 avatar Feb 19 '24 07:02 jase88

Heads up: The 7.6.17 release contains the fix.

valentinpalkovic avatar Feb 20 '24 10:02 valentinpalkovic

@valentinpalkovic Thanks it's working fine!

shajjhusein avatar Mar 01 '24 20:03 shajjhusein

Unfortunately the vulnerabilty was not fixed completely in ip:2.0.1 and the new CVE-2024-29415 is So reopening this thread and switching to a replacement for the ip package would probably be the way to go.

sinnedh avatar May 31 '24 14:05 sinnedh

#26073 seems the best way to fix the problem. Could be reopened too ?

xfournet avatar Jun 02 '24 18:06 xfournet

https://github.com/storybookjs/storybook/pull/26073 seems the best way to fix the problem. Could be reopened too ?

That would be great. Or use https://www.npmjs.com/package/address as an alternative solution? CVE-2023-42282 is annoying and not fixed in [email protected].

j-hannes avatar Jun 03 '24 13:06 j-hannes