-
Notifications
You must be signed in to change notification settings - Fork 4k
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
fix(cdk): cdk depends on a version of netmask impacted by cve-2021-28918 #13910
Conversation
netmask@1 is affected by CVE-2021-28918 GHSA-pch5-whg9-qr2r netmask is a depdendency to the CDK via aws-cdk → proxy-agent@4.0.1 → pac-proxy-agent@4.1.0 → pac-resolver@4.1.0 → netmask@1.0.6 None of these dependencies have upgraded to netmask@2 as yet. Use yarn's [selective dependency resolution], to explicitly pick netmask@2. This upgrades yarn.lock and the CLI's npm-shrinkwrap.json. With this fix, npm customers will no longer depend on netmask@2 transitively via the CDK. For yarn customers, there is no clean resolution since yarn does not respective the the 'resolutions' key in dependencies' package.json and does not respect the shrinkwrap. The init templates now ship the 'resolutions' key so that new customers using yarn will be unaffected. A different solution has to be devised for existing customers on yarn. [selective dependency resolution]: https://classic.yarnpkg.com/en/docs/selective-version-resolutions/ ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
see [CHANGELOG](https://github.com/aws/aws-cdk/blob/71a39b2955fa1ec40e5c8d138c78874c45f21e26/CHANGELOG.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
The 'requires' clause in the generated shrinkwrap still refers to netmask@1. Hot patch this version. This is being applied on the release branch, since it's terribly hackery. A proper fix on master needs to be applied before the next minor version release.
Testing
|
7746fb5
to
00fec6e
Compare
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
"resolutions": { | ||
"netmask": "^2.0.1" |
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.
Are those necessary? I mean they'll be shipping with a newer CLI that has a corrected dependency...
"http-proxy-agent", | ||
"https-proxy-agent", | ||
"lru-cache", | ||
"pac-proxy-agent", |
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.
Well technically - you're removing this one aren't you?
@@ -383,7 +383,7 @@ function parseHttpOptions(options: SdkHttpOptions) { | |||
// https://aws.amazon.com/blogs/developer/using-the-aws-sdk-for-javascript-from-behind-a-proxy/ | |||
debug('Using proxy server: %s', proxyAddress); | |||
// eslint-disable-next-line @typescript-eslint/no-require-imports | |||
const ProxyAgent: any = require('proxy-agent'); | |||
const ProxyAgent: any = require('../../../proxy-agent'); |
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.
Would recommend making it such that it's:
const ProxyAgent: any = require('../../../proxy-agent'); | |
const ProxyAgent: any = require('../../../vendor/proxy-agent'); |
superceded by #13914 |
The fix here is to fork and vendor in the npm package proxy-agent.
Further, apply a patch to remove the support for 'pac' protocol.
The implication of this is that the 'pac' protocols are no longer
supported by the proxy feature of the AWS CDK.
This will be reverted once the upstream node packages upgrade
to netmask@2.0.1 or greater.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license