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: Propagate --insecure parameter #78

Merged
merged 2 commits into from
May 3, 2021
Merged

Conversation

miiila
Copy link

@miiila miiila commented Apr 30, 2021

To unify behaviour with default snyk test command, this PR takes an advantage of snyk/cli@5ae3182#diff-1bc78dd2ada161f97e1a1e595957fbe2487468b6a81191600acf0aa63769ad88R136

@miiila miiila requested a review from a team as a code owner April 30, 2021 15:05
@miiila miiila requested review from shinin-light, j-sp4 and Arvi3d April 30, 2021 15:05
@miiila miiila self-assigned this Apr 30, 2021
ignoreUnknownCA: boolean;
}
declare const global: Global;

const agentOptions = {
keepAlive: true,
maxSockets: 100, // Maximum number of sockets to allow per host. Defaults to Infinity.
maxFreeSockets: 10,
freeSocketTimeout: 60000, // // Maximum number of sockets to leave open for 60 seconds in a free state. Only relevant if keepAlive is set to true. Defaults to 256.
Copy link
Author

Choose a reason for hiding this comment

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

@Arvi3d I am fairly sure this settings does nothing here 😇 It is not supported at https://nodejs.org/docs/latest-v12.x/api/http.html#http_new_agent_options and it looks like it is used only, when https://www.npmjs.com/package/agentkeepalive is around. I'd vote for removing it and typing agentOptions properly.

@miiila miiila force-pushed the fix/propagate-insecure branch 2 times, most recently from da83d13 to 37eaa19 Compare April 30, 2021 15:20
Copy link
Contributor

@j-sp4 j-sp4 left a comment

Choose a reason for hiding this comment

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

Great Job this looks great, 1 super small change requested

@@ -3,12 +3,19 @@ import http from 'http';
import https from 'https';
import emitter from './emitter';

// For a compatibility with Snyk CLI
export declare interface Global extends NodeJS.Global {
ignoreUnknownCA: boolean;
Copy link
Contributor

Choose a reason for hiding this comment

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

Required: Does CA stand for certification Authorities? Could we add a comment explaining that?

Copy link
Author

Choose a reason for hiding this comment

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

CA should be widely known abbrev, so I don't wanna to add a comment just because of that. However, I can elaborate on a comment explaining, how it can be turned on.

@@ -3,12 +3,19 @@ import http from 'http';
import https from 'https';
import emitter from './emitter';

// For a compatibility with Snyk CLI
export declare interface Global extends NodeJS.Global {
Copy link
Contributor

Choose a reason for hiding this comment

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

Question: maybe I am lacking some understanding but why do you have to extend the global object? Is this because typescript does not define the property that is already there?

Copy link
Author

Choose a reason for hiding this comment

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

Global is an Interface with defined properties and TypeScript interfaces are closed for additions. So we need to create our own interface.

@@ -42,7 +42,7 @@ describe('Requests to public API', () => {
if (response.type === 'error') return;
expect(new Set(response.value.configFiles)).toEqual(new Set(['.dcignore', '.gitignore']));
expect(new Set(response.value.extensions)).toEqual(
new Set(['.es', '.es6', '.htm', '.html', '.js', '.jsx', '.py', '.ts', '.tsx', '.vue', '.java']),
new Set(['.es', '.es6', '.htm', '.html', '.js', '.jsx', '.py', '.ts', '.tsx', '.vue', '.java', '.java-dummy']),
Copy link
Contributor

Choose a reason for hiding this comment

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

Question: Why do we now return .java-dummy in this list?

Copy link
Author

Choose a reason for hiding this comment

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

Ask t-42 ¯_(ツ)_/¯ Looks like something reachability related.

Mila Votradovec added 2 commits May 3, 2021 10:21
This is important for a unified behaviour when running both snyk test and snyk code test
@miiila miiila force-pushed the fix/propagate-insecure branch from 37eaa19 to 0290866 Compare May 3, 2021 08:21
@miiila miiila changed the base branch from develop to master May 3, 2021 08:38
@miiila miiila changed the base branch from master to develop May 3, 2021 08:40
@miiila miiila merged commit 6f37bd5 into develop May 3, 2021
@miiila miiila deleted the fix/propagate-insecure branch May 3, 2021 08:40
@snyksec
Copy link

snyksec commented May 3, 2021

🎉 This PR is included in version 3.5.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
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants