-
Notifications
You must be signed in to change notification settings - Fork 36
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
[Security] Bump websocket-extensions #37
base: main
Are you sure you want to change the base?
Conversation
Hi @dawsbot, Just within this organisation, we have:
All of these modules have both Node.js and Ruby versions, and many other packages in those ecosystems depend directly or indirectly on some set of these. I don't believe it is or should be necessary for every package in the graph between the affected library and end-user applications to release a new version in order to make the patch "bubble up" manually. We have mechanisms so that applications will get alerts if they are including a vulnerable package anywhere in their dependency tree, and they can update the package themselves or rely on dependabot to do it for them. If an application does not upgrade as a result of the security alerts we issued about That being said, I'm open to doing the work of releasing new versions of all the above packages, if there's a convincing case that it will make it more likely that applications upgrade. One further question I have if we do that, is whether those releases should come with GitHub security alerts and/or CVEs, and if so what those alerts should say. |
Node.js libraries usually have a locking mechanism for locking dependency versions, either |
A piece of information that would really help me decide how to proceed with this is: @dawsbot @jakubzitny did you receive alerts on your repositories that are using this package, and were you able to upgrade it? |
@jcoglan I use firebase in our application and I got this security alert. I updated thanks to dependabot, but if we didn't have dependabot, we'd be running around with a vulnerable version pinned to that vulnerable version "thanks" to our |
We did receive alert in our internal CI via Snyk, however we don't use this library directly. We use it inside sockjs-client which uses faye-websocket which uses websocket-driver. For this case, where upgrade of sockjs-client is not yet available, I usually use yarn resolutions field, where I specify and upgraded version of nested dependency (websocket-extensions in this case) and that auto-generates the proper yarn.lock. If I was a new "user" of sockjs-client though, I would only find out about this after my initial installation. I would not be able to get vulnerability-free version of it "out of the box". Now, I know sockjs-client is not your "problem", but we can only submit a bump PR for them when faye-websocket is OK, etc. |
FWIW we also received an alert for our application (via Github). We're consuming
Low priority for us, as Still, I'm kinda surprised that we're not receiving the |
@dawsbot Relying on dependabot to do this is exactly what I expect end users to do, that's what it's there for. @jakubzitny Likewise, using resolutions is the way I believe Yarn intends for people to handle this. @derryl Your version of |
Yes, but |
After looking into this in more detail I realised my knowledge of Yarn is based on using it years ago, and on googling solutions to this problem that make it sound like upgrading indirect dependencies is hard, or not supported. Several issues on the Yarn git repo give that impression. Its own documentation says this is exactly what I tried this out myself and forced Yarn to install {
"dependencies": {
"webpack-dev-server": "*"
},
"resolutions": {
"websocket-extensions": "<0.1.4"
}
} Running Does this command not work for you? If not, are you able to determine why it is not giving you the latest version of this package, as it should? |
If this repo relied on dependabot, you'd also get the same security alert I did and be prompted for a version upgrade. Can you introduce a lockfile to this repo, bump the vulnerable dep, and call it a day? |
@dawsbot Libraries are not supposed to pin their dependencies, and npm does not include lockfiles when it builds packages, so adding a lockfile to this repository would have no effect. The fact the people are asking me to do this indicates there's a problem I don't fully understand, and I'd rather get to the bottom of that before making hasty changes that will complicate the release process. As far as I can tell, the only person in this thread that says they've been unable to install the latest |
I am also running into a similar issue. My security vulnerability is being reported by Github, and my project uses npm (6.14.4). 'Npm update' installs the latest version of websocket-extensions (0.1.4), but from what I can tell, the dependency listing from package.json in the websocket-driver is making its way into my project's package-lock.json file, which is triggering the Github warning despite the actual websocket-extensions package being up-to-date. The text of Github's warning includes:
Here's the path by which I am consuming websocket-extensions: Since at least the beginning of version 6 of npm, when the package-lock.json file is created, it includes dependencies listed in "requires" object which seem to be lifted from the package.json files of each dependent project (see the end of the discussion here ). The package-lock.json file ends up looking like this:
When I push my project code to Github (including the package-lock.json file, which is the recommended practice, see here), their security scanner is looking at the package-lock.json file, sees the allowance for the vulnerable package as listed in the "requires" object, and puts up a vulnerability warning. It doesn't seem to matter that the actual package installed by the npm update (0.1.4) is the safe one, just that a potential vulnerable one is listed somewhere in that lockfile. Manually changing the package-lock.json file (to change the websocket-driver's "requirements" listing in the package-lock.json file to >=0.1.4) makes the Github warning go away. However, this is not a permanent solution, since next time that I do an npm install/update of the project, it will update the package-lock.json file with the "requires" data lifted from your project's package.json, which will once again trigger the Github warning. If I don't want to change anything about my project workflow (don't want to change the process of generating and committing the lockfile, don't want to fork your package, etc), there do seem to be some npm-specific solutions similar to the "resolutions" that yarn offers (for example here). However, the best suggested route still seems to be to file a PR such as this one. I haven't figured out yet if adding a lockfile to your project would help in my specific case, but the change indicated in this PR would, since I think that would cause the info printed in my own project's lockfile to escape the Github vulnerability scan. I hope this helps, but I am still pretty new to the world of dependency management, so let me know if I am mistaken about anything here! |
@tomato-gits I've just tried out this workflow myself to see how GitHub handled it and I'm getting different results. First, I set up a project to depend on jcoglan/test-github-npm-sec@bd7d516#diff-32607347f8126e6534ebc7ebaec4853dR87-R101 When I pushed this commit, GitHub gave me an alert as you describe. I then ran The reason I'm trying to get to the bottom of this is that if people are struggling to get the right version of And just to reiterate: adding a lockfile to this repo would not help, because npm does not publish lockfiles when it builds packages. And since npm and yarn have different lockfile formats, the solution would only work for one of them anyway. |
I also got a PR from dependabot, which it automatically closed once it noticed I updated the version. If you're seeing behaviour different from this, my instinct would be to take it up with GitHub. |
@jcoglan Apologies for the extreme tardiness! I did not see these replies until now. I'll try running |
Any progress? |
@slangberg I'm not sure what action I need to take here, if any. Do you have an application in which you currently cannot upgrade |
Our group uses black duck in our CI pipelines, your package's latest version has been flagged for a critical security issue. We have had to force a downgrade as we are not allowed to proceed with the defect, due you know the nature of the issue and how could it could be resolved. If not prepare for a departure of users |
@slangberg sorry, there's a few things I don't understand here, would you mind clarifying them for me:
|
Black Duck provides a comprehensive software composition analysis (SCA) solution for managing security, quality, and license compliance risk that comes from the use of open source and third-party code in applications. The issue at the start of this thread is most likely the flaw that has been flagged but do not know exact reason. The package websocket-extensions v0.1.4 seems to have been a security flagged so I would guess any automated security stuff will flag that package version I have tired #37 (comment) to see if this resolves the issue temporally |
|
Did everyone manage to upgrade |
@jcoglan Thank-you for maintaining this package and several others. I understand that dealing with numerous security warnings across multiple packages can be frustrating, as is the cascade of dependency updates that they can trigger. But it would be greatly appreciated if you could raise this dependency to |
@MoreSaltMoreLemon Something that would help here is if I understand what would lead to a user installing a vulnerable version today, and how bumping the dependency version in this package, and then this package's dependents, and those packages' dependents, and so on, would prevent that from occurring. |
@jcoglan Someone more knowledgeable than I might have a better take, but the issue as I see it is that, there is no version of websocket-driver which is actually safe and guaranteed not to use a pre Because of this, any upstream maintainers utilizing this library aren't able to bump their own requirements to a safe version, and the issue cascades all the way to the end developer who is now responsible for personally interceding in the versioning of a package 5+ levels down. Personally I'm currently undergoing a dependency risk assessment which flagged this library, as well as a number of other libraries. But this library is unique in that it hasn't version bumped its dependencies in response to downstream risks, despite there being a secure version available, so I can't simply choose a newer version of my own direct dependency which doesn't have a pre As it stands, if I were to version bump a dependency which has this library further down the dependency tree, because this package's own dependencies are already set in the |
@MoreSaltMoreLemon What is the name of tool or process you refer to when you say "I'm currently undergoing a dependency risk assessment which flagged this library"? Who is performing this assessment and what tools and information are they using? |
@jcoglan The tool used for the assessment is WhiteSource, and that's about as much as I can answer at this time. |
@MoreSaltMoreLemon Are you able to put me in contact with somebody from WhiteSource to discuss this? |
@jcoglan No, I'm afraid that I have no direct contact with someone at WhiteSource. WhiteSource will recognize the use of a pre-0.1.4 version of websocket-extensions as a security risk based on this report: CVE-2020-7662 |
@MoreSaltMoreLemon Are you able to say more precisely what you mean by "use" here? The thing a security audit should be concerned with is whether an application is loading and running insecure code. If this is the case, then I'm keen to understand how an application would come to be installing and running |
@MoreSaltMoreLemon One thing I forgot to ask earlier is, what's the complete chain of dependencies between your application and |
Yh |
We received a security alert for the
firebase
npm module which includes this downstream. Pre 1.0.4 versions of this package are at-risk of a Denial of service attack (dependable told us this):