Skip to content

Commit 6a6170d

Browse files
authored
Merge pull request #105 from Masterminds/moar-fixes
Moar fixes
2 parents 4ff382e + 2e485aa commit 6a6170d

File tree

5 files changed

+21
-20
lines changed

5 files changed

+21
-20
lines changed

CHANGELOG.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
# Changelog
22

3-
## 1.13.1 (2022-03-xx)
3+
## 1.13.2 (2022-03-30)
44

55
### Fixed
66

7+
- Fix for CVE-2022-21235
78
- #103: Fixed CI testing. This included moving to GitHub Actions, updating the
89
the Git submodule handling, and skipping bzr tests on Windows (bzr has
910
discontinued and the installer now installs a broken environment)

bzr.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ func (s *BzrRepo) Get() error {
8080
}
8181
}
8282

83-
out, err := s.run("bzr", "branch", s.Remote(), s.LocalPath())
83+
out, err := s.run("bzr", "branch", "--", s.Remote(), s.LocalPath())
8484
if err != nil {
8585
return NewRemoteError("Unable to get repository", err, string(out))
8686
}
@@ -90,7 +90,7 @@ func (s *BzrRepo) Get() error {
9090

9191
// Init initializes a bazaar repository at local location.
9292
func (s *BzrRepo) Init() error {
93-
out, err := s.run("bzr", "init", s.LocalPath())
93+
out, err := s.run("bzr", "init", "--", s.LocalPath())
9494

9595
// There are some windows cases where bazaar cannot create the parent
9696
// directory if it does not already exist, to the location it's trying
@@ -104,7 +104,7 @@ func (s *BzrRepo) Init() error {
104104
return NewLocalError("Unable to initialize repository", err, "")
105105
}
106106

107-
out, err = s.run("bzr", "init", s.LocalPath())
107+
out, err = s.run("bzr", "init", "--", s.LocalPath())
108108
if err != nil {
109109
return NewLocalError("Unable to initialize repository", err, string(out))
110110
}
@@ -310,13 +310,13 @@ func (s *BzrRepo) Ping() bool {
310310

311311
// This is the same command that Go itself uses but it's not fast (or fast
312312
// enough by my standards). A faster method would be useful.
313-
_, err = s.run("bzr", "info", s.Remote())
313+
_, err = s.run("bzr", "info", "--", s.Remote())
314314
return err == nil
315315
}
316316

317317
// ExportDir exports the current revision to the passed in directory.
318318
func (s *BzrRepo) ExportDir(dir string) error {
319-
out, err := s.RunFromDir("bzr", "export", dir)
319+
out, err := s.RunFromDir("bzr", "export", "--", dir)
320320
s.log(out)
321321
if err != nil {
322322
return NewLocalError("Unable to export source", err, string(out))

git.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ func (s GitRepo) Vcs() Type {
7171

7272
// Get is used to perform an initial clone of a repository.
7373
func (s *GitRepo) Get() error {
74-
out, err := s.run("git", "clone", "--recursive", s.Remote(), s.LocalPath())
74+
out, err := s.run("git", "clone", "--recursive", "--", s.Remote(), s.LocalPath())
7575

7676
// There are some windows cases where Git cannot create the parent directory,
7777
// if it does not already exist, to the location it's trying to create the
@@ -85,7 +85,7 @@ func (s *GitRepo) Get() error {
8585
return NewLocalError("Unable to create directory", err, "")
8686
}
8787

88-
out, err = s.run("git", "clone", s.Remote(), s.LocalPath())
88+
out, err = s.run("git", "clone", "--recursive", "--", s.Remote(), s.LocalPath())
8989
if err != nil {
9090
return NewRemoteError("Unable to get repository", err, string(out))
9191
}
@@ -101,7 +101,7 @@ func (s *GitRepo) Get() error {
101101

102102
// Init initializes a git repository at local location.
103103
func (s *GitRepo) Init() error {
104-
out, err := s.run("git", "init", s.LocalPath())
104+
out, err := s.run("git", "init", "--", s.LocalPath())
105105

106106
// There are some windows cases where Git cannot create the parent directory,
107107
// if it does not already exist, to the location it's trying to create the
@@ -115,7 +115,7 @@ func (s *GitRepo) Init() error {
115115
return NewLocalError("Unable to initialize repository", err, "")
116116
}
117117

118-
out, err = s.run("git", "init", s.LocalPath())
118+
out, err = s.run("git", "init", "--", s.LocalPath())
119119
if err != nil {
120120
return NewLocalError("Unable to initialize repository", err, string(out))
121121
}
@@ -132,7 +132,7 @@ func (s *GitRepo) Init() error {
132132
// Update performs an Git fetch and pull to an existing checkout.
133133
func (s *GitRepo) Update() error {
134134
// Perform a fetch to make sure everything is up to date.
135-
out, err := s.RunFromDir("git", "fetch", "--tags", s.RemoteLocation)
135+
out, err := s.RunFromDir("git", "fetch", "--tags", "--", s.RemoteLocation)
136136
if err != nil {
137137
return NewRemoteError("Unable to update repository", err, string(out))
138138
}

hg.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ func (s HgRepo) Vcs() Type {
7272

7373
// Get is used to perform an initial clone of a repository.
7474
func (s *HgRepo) Get() error {
75-
out, err := s.run("hg", "clone", s.Remote(), s.LocalPath())
75+
out, err := s.run("hg", "clone", "--", s.Remote(), s.LocalPath())
7676
if err != nil {
7777
return NewRemoteError("Unable to get repository", err, string(out))
7878
}
@@ -81,7 +81,7 @@ func (s *HgRepo) Get() error {
8181

8282
// Init will initialize a mercurial repository at local location.
8383
func (s *HgRepo) Init() error {
84-
out, err := s.run("hg", "init", s.LocalPath())
84+
out, err := s.run("hg", "init", "--", s.LocalPath())
8585
if err != nil {
8686
return NewLocalError("Unable to initialize repository", err, string(out))
8787
}
@@ -100,7 +100,7 @@ func (s *HgRepo) UpdateVersion(version string) error {
100100
return NewLocalError("Unable to update checked out version", err, string(out))
101101
}
102102
if len(strings.TrimSpace(version)) > 0 {
103-
out, err = s.RunFromDir("hg", "update", version)
103+
out, err = s.RunFromDir("hg", "update", "--", version)
104104
} else {
105105
out, err = s.RunFromDir("hg", "update")
106106
}
@@ -310,14 +310,14 @@ func (s *HgRepo) TagsFromCommit(id string) ([]string, error) {
310310

311311
// Ping returns if remote location is accessible.
312312
func (s *HgRepo) Ping() bool {
313-
_, err := s.run("hg", "identify", s.Remote())
313+
_, err := s.run("hg", "identify", "--", s.Remote())
314314
return err == nil
315315
}
316316

317317
// ExportDir exports the current revision to the passed in directory.
318318
func (s *HgRepo) ExportDir(dir string) error {
319319

320-
out, err := s.RunFromDir("hg", "archive", dir)
320+
out, err := s.RunFromDir("hg", "archive", "--", dir)
321321
s.log(out)
322322
if err != nil {
323323
return NewLocalError("Unable to export source", err, string(out))

svn.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ func NewSvnRepo(remote, local string) (*SvnRepo, error) {
3737
if err == nil && r.CheckLocal() {
3838
// An SVN repo was found so test that the URL there matches
3939
// the repo passed in here.
40-
out, err := exec.Command("svn", "info", local).CombinedOutput()
40+
out, err := exec.Command("svn", "info", "--", local).CombinedOutput()
4141
if err != nil {
4242
return nil, NewLocalError("Unable to retrieve local repo information", err, string(out))
4343
}
@@ -80,7 +80,7 @@ func (s *SvnRepo) Get() error {
8080
} else if runtime.GOOS == "windows" && filepath.VolumeName(remote) != "" {
8181
remote = "file:///" + remote
8282
}
83-
out, err := s.run("svn", "checkout", remote, s.LocalPath())
83+
out, err := s.run("svn", "checkout", "--", remote, s.LocalPath())
8484
if err != nil {
8585
return NewRemoteError("Unable to get repository", err, string(out))
8686
}
@@ -341,14 +341,14 @@ func (s *SvnRepo) TagsFromCommit(id string) ([]string, error) {
341341

342342
// Ping returns if remote location is accessible.
343343
func (s *SvnRepo) Ping() bool {
344-
_, err := s.run("svn", "--non-interactive", "info", s.Remote())
344+
_, err := s.run("svn", "--non-interactive", "info", "--", s.Remote())
345345
return err == nil
346346
}
347347

348348
// ExportDir exports the current revision to the passed in directory.
349349
func (s *SvnRepo) ExportDir(dir string) error {
350350

351-
out, err := s.RunFromDir("svn", "export", ".", dir)
351+
out, err := s.RunFromDir("svn", "export", "--", ".", dir)
352352
s.log(out)
353353
if err != nil {
354354
return NewLocalError("Unable to export source", err, string(out))

0 commit comments

Comments
 (0)