Skip to content

fix(security): Go-Git Has an Argument Injection via the URL Field (DD-3703) - #97

Open
defectdojo-sensei-demo[bot] wants to merge 1 commit into
masterfrom
sensei-fix/secops-demo-cloud-defectdojo-com/DD-3703
Open

fix(security): Go-Git Has an Argument Injection via the URL Field (DD-3703)#97
defectdojo-sensei-demo[bot] wants to merge 1 commit into
masterfrom
sensei-fix/secops-demo-cloud-defectdojo-com/DD-3703

Conversation

@defectdojo-sensei-demo

Copy link
Copy Markdown

Automated remediation generated by DefectDojo Sensei.

This pull request applies a fix for 1 security finding.

Commit: d725c94555c6017c2884c776aa2c455c7141b86f


DD-3703: Go-Git Has an Argument Injection via the URL Field

Severity: High

File: go.mod

The vulnerability GHSA-v725-9546-7q7m affects gopkg.in/src-d/go-git.v4, which is an archived/unmaintained fork of go-git. This library is vulnerable to argument injection via the URL field when making git operations that delegate to the git binary. An attacker who can control the repository URL could inject additional git command-line arguments (e.g., --upload-pack=malicious-command), potentially leading to remote code execution. The fix is to migrate from the abandoned gopkg.in/src-d/go-git.v4 to the actively maintained successor github.com/go-git/go-git/v5, which has patched this vulnerability.

Suggested change
```diff
 require (
 	github.com/briandowns/spinner v1.6.1
 	github.com/mtesauro/commandeer v1.1.4
 	github.com/spf13/viper v1.4.0
 	golang.org/x/text v0.13.0
-	gopkg.in/src-d/go-git.v4 v4.12.0
+	github.com/go-git/go-git/v5 v5.12.0
 )
 
 require (
 	github.com/emirpasic/gods v1.12.0 // indirect
 	github.com/fatih/color v1.7.0 // indirect
 	github.com/fsnotify/fsnotify v1.4.7 // indirect
 	github.com/hashicorp/hcl v1.0.0 // indirect
 	github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
 	github.com/kevinburke/ssh_config v0.0.0-20180830205328-81db2a75821e // indirect
 	github.com/magiconair/properties v1.8.0 // indirect
 	github.com/mattn/go-colorable v0.1.2 // indirect
 	github.com/mattn/go-isatty v0.0.8 // indirect
 	github.com/mitchellh/go-homedir v1.1.0 // indirect
 	github.com/mitchellh/mapstructure v1.1.2 // indirect
-	github.com/pelletier/go-buffruneio v0.2.0 // indirect
 	github.com/pelletier/go-toml v1.2.0 // indirect
 	github.com/sergi/go-diff v1.0.0 // indirect
 	github.com/spf13/afero v1.1.2 // indirect
 	github.com/spf13/cast v1.3.0 // indirect
 	github.com/spf13/jwalterweatherman v1.0.0 // indirect
 	github.com/spf13/pflag v1.0.3 // indirect
-	github.com/src-d/gcfg v1.4.0 // indirect
+	github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
+	github.com/go-git/go-billy/v5 v5.6.1 // indirect
 	github.com/xanzy/ssh-agent v0.2.1 // indirect
 	golang.org/x/crypto v0.14.0 // indirect
 	golang.org/x/net v0.17.0 // indirect
 	golang.org/x/sys v0.13.0 // indirect
-	gopkg.in/src-d/go-billy.v4 v4.3.0 // indirect
 	gopkg.in/warnings.v0 v0.1.2 // indirect
 	gopkg.in/yaml.v2 v2.4.0 // indirect
 )

Important: After editing go.mod, you must also:

  1. Update all import paths in your Go source files from gopkg.in/src-d/go-git.v4 to github.com/go-git/go-git/v5.
  2. Run go mod tidy to regenerate go.sum and resolve all transitive dependencies automatically. The go.sum file will need to be regenerated entirely due to the package change.

</details>

---

_Review the change before merging._

@sonarqubecloud

Copy link
Copy Markdown

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants