Skip to content
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: fetch patch ignoring command line arguments #813

Merged
merged 1 commit into from
Oct 10, 2019

Conversation

gitphill
Copy link
Contributor

@gitphill gitphill commented Oct 9, 2019

BST-889
Fetch patch was making http requests by using needle directly
Changed to use lib request which uses command line arguments when invoking needle
Added tests for lib request
Changed fetch patch fail test to typescript
Removed patch fetch proxy test (now covered by lib request test)
Added @types/sinon devDependency to help write test with sinon assertions and matchers

  • Ready for review
  • Follows CONTRIBUTING rules
  • Reviewed by Snyk internal team

What does this PR do?

Fix issue when snyk protect run as part of snyk wizard and doesn’t keep the --insecure flag
Module fetch-patch was using needle directly
I've changed to use lib/request which handles command line arguments like --insecure

How should this be manually tested?

Run DEBUG=* snyk wizard --insecure against a project where a patch can be applied. Notice that fetch patch does not use insecure flag and should result in needle using rejectUnauthorized option.

What are the relevant tickets?

BST-889

Screenshots

Screenshot 2019-10-09 at 22 49 55

@gitphill gitphill requested a review from a team as a code owner October 9, 2019 21:24
@ghost ghost requested review from dkontorovskyy and miiila October 9, 2019 21:24
@gitphill gitphill self-assigned this Oct 10, 2019
Copy link
Contributor

@miiila miiila left a comment

Choose a reason for hiding this comment

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

Very nice! Can you please just check the situation around deleted test?

@@ -1,89 +0,0 @@
var test = require('tap').test;
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't see this test being migrated. Is it desired?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it's covered by the new request.test.ts

Copy link
Contributor

Choose a reason for hiding this comment

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

Cool. And could we get back all the cases describe in https://github.com/snyk/snyk/pull/813/files#diff-f932f6df5ce16fc0d2438970c1daabd0L39? Or do you think it's not necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure I can add tests using http_proxy and no_proxy

BST-889
Fetch patch was making http requests by using needle directly
Changed to use lib request which uses command line arguments when invoking needle
Added tests for lib request
Changed fetch patch fail test to typescript
Removed patch fetch proxy test (now covered by lib request test)
Added @types/sinon devDependency to help write test with sinon assertions and matchers
@gitphill gitphill merged commit 2de3447 into master Oct 10, 2019
@gitphill gitphill deleted the fix/fetch-patch-use-request branch October 10, 2019 16:42
@snyksec
Copy link

snyksec commented Oct 11, 2019

🎉 This PR is included in version 1.234.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants