Skip to content
This repository has been archived by the owner on Feb 9, 2024. It is now read-only.

Commit

Permalink
revendor teleport / bump etcd (#650)
Browse files Browse the repository at this point in the history
* bump planet with etcd clients restart fix

* revendor teleport with fixes for doyensec security findings

* fix interface change

* fix tar path sanitization when link path is absolute (#19)

* fix tar path sanitization when link path is absolute

* don't mangle extracted links, just generate an error instead

* update path sanitization unit tests to reflect changes in handling absolute paths

* fix extra newline

* revendor teleport

* bump planet to avoid time drift check

* revendor teleport
  • Loading branch information
Kevin Nisbet authored Sep 18, 2019
1 parent 89b3922 commit 0d12e6d
Show file tree
Hide file tree
Showing 77 changed files with 3,401 additions and 598 deletions.
15 changes: 8 additions & 7 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ ignored = [

[[override]]
name = "github.com/gravitational/trace"
version = "=1.1.7"
version = "=1.1.8"

[[override]]
name = "github.com/mitchellh/go-ps"
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ RELEASE_OUT ?=
TELEPORT_TAG = 3.0.5
# TELEPORT_REPOTAG adapts TELEPORT_TAG to the teleport tagging scheme
TELEPORT_REPOTAG := v$(TELEPORT_TAG)
PLANET_TAG := 5.5.23-$(K8S_VER_SUFFIX)
PLANET_TAG := 5.5.26-$(K8S_VER_SUFFIX)
PLANET_BRANCH := $(PLANET_TAG)
K8S_APP_TAG := $(GRAVITY_TAG)
TELEKUBE_APP_TAG := $(GRAVITY_TAG)
Expand Down
15 changes: 11 additions & 4 deletions lib/archive/archive.go
Original file line number Diff line number Diff line change
Expand Up @@ -394,13 +394,20 @@ func SanitizeTarPath(header *tar.Header, dir string) error {
// Security: sanitize that all tar paths resolve to within the destination directory
destPath := filepath.Join(dir, header.Name)
if !strings.HasPrefix(destPath, filepath.Clean(dir)+string(os.PathSeparator)) {
return trace.BadParameter("%s: illegal file path", header.Name)
return trace.BadParameter("%s: illegal file path", header.Name).AddField("prefix", dir)
}
// Security: Ensure link destinations resolve to within the destination directory
if header.Linkname != "" {
linkPath := filepath.Join(dir, header.Linkname)
if !strings.HasPrefix(linkPath, filepath.Clean(dir)+string(os.PathSeparator)) {
return trace.BadParameter("%s: illegal link path", header.Linkname)
if filepath.IsAbs(header.Linkname) {
if !strings.HasPrefix(filepath.Clean(header.Linkname), filepath.Clean(dir)+string(os.PathSeparator)) {
return trace.BadParameter("%s: illegal link path", header.Linkname).AddField("prefix", dir)
}
} else {
// relative paths are relative to the filename after extraction to a directory
linkPath := filepath.Join(dir, filepath.Dir(header.Name), header.Linkname)
if !strings.HasPrefix(linkPath, filepath.Clean(dir)+string(os.PathSeparator)) {
return trace.BadParameter("%s: illegal link path", header.Linkname).AddField("prefix", dir)
}
}
}
return nil
Expand Down
30 changes: 27 additions & 3 deletions lib/archive/archive_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -280,14 +280,14 @@ func TestSanitizeTarPath(t *testing.T) {
{
header: &tar.Header{
Name: "test7.txt",
Linkname: "/dir/../dir2/test7.txt",
Linkname: "./dir/../dir2/test7.txt",
},
expectError: false,
},
{
header: &tar.Header{
Name: "test8.txt",
Linkname: "./dir/test8.txt",
Name: "dir1/test8.txt",
Linkname: "dir1/../dir2/test8.txt",
},
expectError: false,
},
Expand Down Expand Up @@ -319,6 +319,30 @@ func TestSanitizeTarPath(t *testing.T) {
},
expectError: true,
},
// Relative link that remains inside the directory
{
header: &tar.Header{
Name: "/test/dir/test13.txt",
Linkname: "../../test2/dir2/test14.txt",
},
expectError: false,
},
// Linkname is absolute path outside extraction directory
{
header: &tar.Header{
Name: "test14.txt",
Linkname: "/test14.txt",
},
expectError: true,
},
// Linkname is absolute path inside extraction directory
{
header: &tar.Header{
Name: "test15.txt",
Linkname: "/tmp/test15.txt",
},
expectError: false,
},
}

for _, tt := range cases {
Expand Down
6 changes: 5 additions & 1 deletion lib/process/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -433,11 +433,15 @@ func (t *teleportProxyService) getTLSConfig(clusterName string) (*tls.Config, er
Username: constants.OpsCenterUser,
Groups: []string{defaults.SystemAccountOrg},
}
subject, err := identity.Subject()
if err != nil {
return nil, trace.Wrap(err)
}
cert, err := tlsAuthority.GenerateCertificate(
tlsca.CertificateRequest{
Clock: clockwork.NewRealClock(),
PublicKey: cryptoPublicKey,
Subject: identity.Subject(),
Subject: subject,
NotAfter: time.Now().UTC().Add(defaults.CertTTL),
})
if err != nil {
Expand Down
4 changes: 4 additions & 0 deletions vendor/github.com/gravitational/teleport/Makefile

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions vendor/github.com/gravitational/teleport/constants.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

87 changes: 84 additions & 3 deletions vendor/github.com/gravitational/teleport/lib/auth/apiserver.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 0d12e6d

Please sign in to comment.