diff options
author | Pavlo Strokov <pstrokov@gitlab.com> | 2020-06-07 15:38:03 +0300 |
---|---|---|
committer | Pavlo Strokov <pstrokov@gitlab.com> | 2020-06-18 17:38:08 +0300 |
commit | 73f8a828a72e0e6a3be80820fcde69345d1f2c09 (patch) | |
tree | 38016a5bf0c79fe477eb57b29326cc576163cc66 /internal/helper/security_test.go | |
parent | ceb84269c65974da7353c35c3abc96ea7830c85a (diff) |
Remove dependency on global var to detect repo location
Removes dependency on the global var config.Config to
detect location of the repository of storage at the
filesystem.
Locator interface includes set of methods from helper
package that are use in the services to get location of
the repository.
Implementation of the interface is injected into the
context via tags mechanism.
In order to break cyclic dependencies some of other funcs
was also moved.
Part of: https://gitlab.com/gitlab-org/gitaly/-/issues/2699
Diffstat (limited to 'internal/helper/security_test.go')
-rw-r--r-- | internal/helper/security_test.go | 30 |
1 files changed, 0 insertions, 30 deletions
diff --git a/internal/helper/security_test.go b/internal/helper/security_test.go index 6122f35a6..640e36b3b 100644 --- a/internal/helper/security_test.go +++ b/internal/helper/security_test.go @@ -6,36 +6,6 @@ import ( "github.com/stretchr/testify/assert" ) -func TestValidateRelativePath(t *testing.T) { - for _, tc := range []struct { - path string - cleaned string - error error - }{ - {"/parent", "parent", nil}, - {"parent/", "parent", nil}, - {"/parent-with-suffix", "parent-with-suffix", nil}, - {"/subfolder", "subfolder", nil}, - {"subfolder", "subfolder", nil}, - {"subfolder/", "subfolder", nil}, - {"subfolder//", "subfolder", nil}, - {"subfolder/..", ".", nil}, - {"subfolder/../..", "", ErrRelativePathEscapesRoot}, - {"/..", "", ErrRelativePathEscapesRoot}, - {"..", "", ErrRelativePathEscapesRoot}, - {"../", "", ErrRelativePathEscapesRoot}, - {"", ".", nil}, - {".", ".", nil}, - } { - const parent = "/parent" - t.Run(parent+" and "+tc.path, func(t *testing.T) { - cleaned, err := ValidateRelativePath(parent, tc.path) - assert.Equal(t, tc.cleaned, cleaned) - assert.Equal(t, tc.error, err) - }) - } -} - func TestSanitizeString(t *testing.T) { testCases := []struct { input string |