aboutsummaryrefslogtreecommitdiffstats
path: root/config/config.go
diff options
context:
space:
mode:
authorJoseph Vusich <jvusich@amazon.com>2018-05-30 02:42:46 +0000
committerJoseph Vusich <jvusich@amazon.com>2018-05-30 17:42:09 +0000
commit79b7f24160029966238b04dd41f69add0741a1d2 (patch)
treeba6f5db1fc1ebbe478e46b166ef65531842795ee /config/config.go
parent57570e84f8c5739f0f4a59387493e590e709dde9 (diff)
downloadgo-git-79b7f24160029966238b04dd41f69add0741a1d2.tar.gz
config: modules, Ignore submodules with dotdot '..' path components. Fixes CVE-2018-11235
References: * https://blogs.msdn.microsoft.com/devops/2018/05/29/announcing-the-may-2018-git-security-vulnerability/ * https://security-tracker.debian.org/tracker/CVE-2018-11235 * https://github.com/git/git/commit/0383bbb9015898cbc79abd7b64316484d7713b44 Signed-off-by: Joseph Vusich <jvusich@amazon.com>
Diffstat (limited to 'config/config.go')
-rw-r--r--config/config.go12
1 files changed, 8 insertions, 4 deletions
diff --git a/config/config.go b/config/config.go
index c730015..ce6506d 100644
--- a/config/config.go
+++ b/config/config.go
@@ -135,7 +135,7 @@ func (c *Config) Unmarshal(b []byte) error {
if err := c.unmarshalPack(); err != nil {
return err
}
- c.unmarshalSubmodules()
+ unmarshalSubmodules(c.Raw, c.Submodules)
if err := c.unmarshalBranches(); err != nil {
return err
@@ -182,13 +182,17 @@ func (c *Config) unmarshalRemotes() error {
return nil
}
-func (c *Config) unmarshalSubmodules() {
- s := c.Raw.Section(submoduleSection)
+func unmarshalSubmodules(fc *format.Config, submodules map[string]*Submodule) {
+ s := fc.Section(submoduleSection)
for _, sub := range s.Subsections {
m := &Submodule{}
m.unmarshal(sub)
- c.Submodules[m.Name] = m
+ if m.Validate() == ErrModuleBadPath {
+ continue
+ }
+
+ submodules[m.Name] = m
}
}