Skip to content

Commit

Permalink
Update callgraph documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
jonna-debricked authored and ProgHaj committed Sep 15, 2023
1 parent 879083d commit 51e40b5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
17 changes: 13 additions & 4 deletions internal/cmd/callgraph/callgraph.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,13 @@ var generateTimeout int
func NewCallgraphCmd(generator callgraph.IGenerator) *cobra.Command {
cmd := &cobra.Command{
Use: "callgraph [path]",
Short: "Generate a static callgraph for the given directory and subdirectories",
Long: `If a directory is inputted all manifest files without a lock file are resolved.
Short: "Generate a static call graph for the given directory and subdirectories",
Long: `Generate a static call graph for a project in the given directory. The command consists of two main parts: build and callgraph.
Build: Build the project and resolve dependencies. In this step, all necessary .class files are created.
Callgraph: Generate the static call graph using debricked Vulnerable Functionality.
The full documentation is available here https://portal.debricked.com/debricked-cli-63/debricked-cli-documentation-298
Example:
$ debricked callgraph
`,
Expand All @@ -38,6 +43,7 @@ $ debricked callgraph
fileExclusionExample := filepath.Join("*", "**.lock")
dirExclusionExample := filepath.Join("**", "node_modules", "**")
exampleFlags := fmt.Sprintf("-e \"%s\" -e \"%s\"", fileExclusionExample, dirExclusionExample)

cmd.Flags().StringArrayVarP(&exclusions, ExclusionFlag, "e", exclusions, `The following terms are supported to exclude paths:
Special Terms | Meaning
------------- | -------
Expand All @@ -49,8 +55,11 @@ Special Terms | Meaning
Example:
$ debricked files resolve . `+exampleFlags)
cmd.Flags().BoolVar(&buildDisabled, NoBuildFlag, false, "Should not automatically build all source code in project to enable call graph generation.")
cmd.Flags().IntVar(&generateTimeout, GenerateTimeoutFlag, 60*60, "Timeout generate callgraph")
cmd.Flags().BoolVar(&buildDisabled, NoBuildFlag, false, `Do not automatically build all source code in the project to enable call graph generation.
This option requires a pre-built project. For more detailed documentation on Vulnerable Functionality, visit our portal:
https://portal.debricked.com/vulnerability-management-43/how-do-i-enable-the-vulnerable-functionality-246`)
cmd.Flags().IntVar(&generateTimeout, GenerateTimeoutFlag, 60*60, "Timeout (in seconds) on call graph generation.")

viper.MustBindEnv(ExclusionFlag)

return cmd
Expand Down
6 changes: 3 additions & 3 deletions internal/cmd/scan/scan.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@ $ debricked scan . `+exampleFlags)
cmd.Flags().BoolVarP(&passOnDowntime, PassOnTimeOut, "p", false, "pass scan if there is a service access timeout")
cmd.Flags().BoolVar(&noResolve, NoResolveFlag, false, `disables resolution of manifest files that lack lock files. Resolving manifest files enables more accurate dependency scanning since the whole dependency tree will be analysed.
For example, if there is a "go.mod" in the target path, its dependencies are going to get resolved onto a lock file, and latter scanned.`)
cmd.Flags().BoolVar(&callgraph, CallGraphFlag, false, `Enables callgraph generation during scan.`)
cmd.Flags().IntVar(&callgraphUploadTimeout, CallGraphUploadTimeoutFlag, 10*60, "Sets a timeout on callgraph upload")
cmd.Flags().IntVar(&callgraphGenerateTimeout, CallGraphGenerateTimeoutFlag, 60*60, "Sets a timeout on callgraph generation")
cmd.Flags().BoolVar(&callgraph, CallGraphFlag, false, `Enables call graph generation during scan.`)
cmd.Flags().IntVar(&callgraphUploadTimeout, CallGraphUploadTimeoutFlag, 10*60, "Set a timeout (in seconds) on call graph upload.")
cmd.Flags().IntVar(&callgraphGenerateTimeout, CallGraphGenerateTimeoutFlag, 60*60, "Set a timeout (in seconds) on call graph generation.")

viper.MustBindEnv(RepositoryFlag)
viper.MustBindEnv(CommitFlag)
Expand Down

0 comments on commit 51e40b5

Please sign in to comment.