Skip to content

fix: improve reliability around call graph generation - #1276

Merged
muscar merged 1 commit into
masterfrom
fix/flow-336-call-graph-generation-reliability-improvements
Jul 22, 2020
Merged

fix: improve reliability around call graph generation#1276
muscar merged 1 commit into
masterfrom
fix/flow-336-call-graph-generation-reliability-improvements

Conversation

@muscar

@muscar muscar commented Jul 17, 2020

Copy link
Copy Markdown
Contributor
  • Ready for review
  • Follows CONTRIBUTING rules
  • Reviewed by Snyk internal team

What does this PR do?

This is meant to improve the experience around reachable vulns by:

  • giving control to the CLI on how long the call graph generator can run;
  • running the user command (e.g. monitor, test) even if the call graph generation failed;
  • allowing for better error messages is the call graph generation fails.

Merge after snyk/snyk-cli-interface#36 and snyk/snyk-mvn-plugin#73, and after updating the dependencies to the appropriate versions.

What are the relevant tickets?

https://snyksec.atlassian.net/browse/FLOW-336

Screenshots

Running with a timeout:

step1

Running with a timeout and passing -d:

step2

@muscar
muscar requested a review from darmalovan July 17, 2020 11:23
Comment thread src/lib/monitor/index.ts Outdated
Comment thread src/lib/types.ts Outdated
// Used with the Docker plugin only. Allows application scanning.
'app-vulns'?: boolean;
reachableVulns?: boolean;
callGraphBuilderTimeout?: number;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Nice!

@darmalovan

Copy link
Copy Markdown

@muscar nice! how should the usage of the timeout from the user perspective should look like?

@muscar
muscar force-pushed the fix/flow-336-call-graph-generation-reliability-improvements branch from 7fb307a to 34f53d4 Compare July 20, 2020 13:53
@muscar
muscar marked this pull request as ready for review July 20, 2020 13:53
@muscar
muscar requested review from a team as code owners July 20, 2020 13:53
@ghost
ghost requested review from MegaBean and orsagie July 20, 2020 13:53
@muscar
muscar force-pushed the fix/flow-336-call-graph-generation-reliability-improvements branch from 34f53d4 to 081577a Compare July 20, 2020 13:56
Comment thread src/lib/types.ts Outdated
Comment thread src/lib/monitor/index.ts Outdated
Comment thread src/lib/monitor/index.ts Outdated
Comment thread src/lib/snyk-test/run-test.ts Outdated
@darmalovan

Copy link
Copy Markdown

@muscar can you add screenshot on the pr description?

@muscar
muscar force-pushed the fix/flow-336-call-graph-generation-reliability-improvements branch from 081577a to e1768aa Compare July 20, 2020 14:58
@muscar
muscar requested a review from darmalovan July 20, 2020 15:00
Comment thread help/help.txt Outdated
Comment thread help/help.txt Outdated
Comment thread help/help.txt Outdated
Comment thread src/lib/monitor/index.ts Outdated

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I think the as as CallGraphError is not needed now, but maybe help in reading?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can you elaborate on the different kinds of errors? If it's a timeout error, a permissions error, or something else. Each one will have a different action the user can take before contacting us

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@orsagie We don't have enough context in the CLI right now to elaborate--because we only have a generic CallGraphError with a generic string message, and an inner error. Since string messages can change, I don't think inspecting those to glean more info is a good idea, because it leads to brittle code.

I do agree with your point that it's good to provide users with a more detailed reason for the failure so they can provide that info to support.

I see two ways of achieving this:

  1. Change the error message to tell them to re-run the command with -d, and provide the output in their support query; or
  2. Change the error message in the maven plugin to something less generic, and more error specific.

I would personally prefer the first approach as the code in the plugin doesn't have to change as new error cases appear, and we'll be getting almost the same info anyway. What do you think?

@orsagie orsagie Jul 21, 2020

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Just noticed I didn't comment in the right place, this comment's place is after the request to registry has been made, and regards how we handle those responses.

This error handling is specifically for after a call to the plugins, and in that case I agree with point 1. I think the error from maven plugin already asks to run with -d, can you double check? might not need to change anything here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The maven plugin doesn't print the -d advice, but I will open a PR to make it do so.

@muscar
muscar force-pushed the fix/flow-336-call-graph-generation-reliability-improvements branch 2 times, most recently from e9fdab8 to d64ac7f Compare July 20, 2020 15:52
Comment thread help/help.txt Outdated

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I see other flags have a new line after the flag

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Also, can add like others
(test and monitor command only)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Can you write that is only available for paid users?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I am a little uneasy about adding a flag for paid users only. In the past we have checked against feature flags, but eventually released to all. Maybe instead display an error saying something like This feature is not available for this org, please contact us if you wish to use it?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This is static text - rather not to share this info in the help text?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Then do it in both places. They might not be targeting the correct org?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I thought the plan is to roll this to free users at some point, right? And we already have a feature flag which we check for, and show a message. We could change the feature flag message slightly to say that this is a paid feature only (for now)?

cc/ @orsagie @darmalovan

Comment thread help/help.txt Outdated

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

--reachable-vulns-timeout=<number> ? (and new line)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is there a case where users want different timeouts for different cases? Consider allowing to set a longer default in the config? (maybe not for now, but in future)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@orsagie I don't know. I think this is highly project specific, so the users are in the best position to tweak it as needed. We provide a default just because we don't want it to block their flows for too long.

Comment thread src/cli/args.ts Outdated

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Why toString btw?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@darmalovan Because WebStorm (and typescript) complains that the value can't be a number.

Comment thread src/cli/args.ts Outdated
@muscar
muscar force-pushed the fix/flow-336-call-graph-generation-reliability-improvements branch from d64ac7f to d47e4b0 Compare July 21, 2020 09:27
@CLAassistant

CLAassistant commented Jul 21, 2020

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@muscar
muscar force-pushed the fix/flow-336-call-graph-generation-reliability-improvements branch from d47e4b0 to 8bb2c7b Compare July 21, 2020 09:30
@muscar
muscar force-pushed the fix/flow-336-call-graph-generation-reliability-improvements branch 2 times, most recently from 3d5c805 to 8e17159 Compare July 21, 2020 10:27
Comment thread help/help.txt Outdated
@muscar
muscar force-pushed the fix/flow-336-call-graph-generation-reliability-improvements branch from 8e17159 to 97c6817 Compare July 21, 2020 11:56

@orsagie orsagie left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

small typo, but otherwise the changes LGTM now.

@muscar
muscar force-pushed the fix/flow-336-call-graph-generation-reliability-improvements branch from 97c6817 to 907a9f7 Compare July 21, 2020 12:29
Comment thread src/lib/monitor/index.ts Outdated
@muscar
muscar force-pushed the fix/flow-336-call-graph-generation-reliability-improvements branch 2 times, most recently from 0b4eb38 to 495e096 Compare July 21, 2020 16:01
@muscar
muscar force-pushed the fix/flow-336-call-graph-generation-reliability-improvements branch from 495e096 to 44fc1e8 Compare July 21, 2020 16:07
@github-actions

github-actions Bot commented Jul 21, 2020

Copy link
Copy Markdown
Contributor

Expected release notes (by @muscar)

fixes:
improve reliability around call graph generation (44fc1e8)

  • I hereby acknowledge these release notes are 🥙 AWESOME 🥙

@muscar
muscar merged commit c70c657 into master Jul 22, 2020
@muscar
muscar deleted the fix/flow-336-call-graph-generation-reliability-improvements branch July 22, 2020 07:43
@snyksec

snyksec commented Jul 22, 2020

Copy link
Copy Markdown

🎉 This PR is included in version 1.364.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.

6 participants