Commit 6ca9bc1e authored by Nick Thomas's avatar Nick Thomas

Merge branch 'security-snippet-auth' into 'master'

Release workhorse v8.10.0

See merge request gitlab-org/gitlab-workhorse!421
parents 33a5eb7d fc4c1e51
...@@ -2,6 +2,11 @@ ...@@ -2,6 +2,11 @@
Formerly known as 'gitlab-git-http-server'. Formerly known as 'gitlab-git-http-server'.
v8.10.0
- Use accelerated uploads for users/personal snippets
- Fix typo in keywatcher prometheus metrics !420
v8.9.0 v8.9.0
- Update Gitaly library code to v1.57.0 !407 - Update Gitaly library code to v1.57.0 !407
...@@ -10,12 +15,20 @@ v8.9.0 ...@@ -10,12 +15,20 @@ v8.9.0
- Add prometheus counter for Gitaly connection stubs !414 - Add prometheus counter for Gitaly connection stubs !414
- Support passing on Gitaly feature flags !410 - Support passing on Gitaly feature flags !410
v8.8.1
- Use accelerated uploads for users/personal snippets
v8.8.0 v8.8.0
- Filter title, description, text, and body from logs !402 - Filter title, description, text, and body from logs !402
- Remove redirections from Terminal to Channel !397 - Remove redirections from Terminal to Channel !397
- Add option to set Sentry environment !396 - Add option to set Sentry environment !396
v8.7.1
- Use accelerated uploads for users/personal snippets
v8.7.0 v8.7.0
- Don't log http.ErrAbortHandler panics in sentry !392 - Don't log http.ErrAbortHandler panics in sentry !392
......
...@@ -44,10 +44,12 @@ type routeOptions struct { ...@@ -44,10 +44,12 @@ type routeOptions struct {
} }
const ( const (
apiPattern = `^/api/` apiPattern = `^/api/`
ciAPIPattern = `^/ci/api/` ciAPIPattern = `^/ci/api/`
gitProjectPattern = `^/([^/]+/){1,}[^/]+\.git/` gitProjectPattern = `^/([^/]+/){1,}[^/]+\.git/`
projectPattern = `^/([^/]+/){1,}[^/]+/` projectPattern = `^/([^/]+/){1,}[^/]+/`
snippetUploadPattern = `^/uploads/personal_snippet`
userUploadPattern = `^/uploads/user`
) )
func compileRegexp(regexpStr string) *regexp.Regexp { func compileRegexp(regexpStr string) *regexp.Regexp {
...@@ -217,6 +219,8 @@ func (u *upstream) configureRoutes() { ...@@ -217,6 +219,8 @@ func (u *upstream) configureRoutes() {
// Uploads // Uploads
route("POST", projectPattern+`uploads\z`, upload.Accelerate(api, proxy)), route("POST", projectPattern+`uploads\z`, upload.Accelerate(api, proxy)),
route("POST", snippetUploadPattern, upload.Accelerate(api, proxy)),
route("POST", userUploadPattern, upload.Accelerate(api, proxy)),
// For legacy reasons, user uploads are stored under the document root. // For legacy reasons, user uploads are stored under the document root.
// To prevent anybody who knows/guesses the URL of a user-uploaded file // To prevent anybody who knows/guesses the URL of a user-uploaded file
......
...@@ -102,10 +102,6 @@ func parseJWT(token *jwt.Token) (interface{}, error) { ...@@ -102,10 +102,6 @@ func parseJWT(token *jwt.Token) (interface{}, error) {
} }
func TestAcceleratedUpload(t *testing.T) { func TestAcceleratedUpload(t *testing.T) {
reqBody, contentType, err := multipartBodyWithFile()
if err != nil {
t.Fatal(err)
}
ts := uploadTestServer(t, func(r *http.Request) { ts := uploadTestServer(t, func(r *http.Request) {
jwtToken, err := jwt.Parse(r.Header.Get(upload.RewrittenFieldsHeader), parseJWT) jwtToken, err := jwt.Parse(r.Header.Get(upload.RewrittenFieldsHeader), parseJWT)
require.NoError(t, err) require.NoError(t, err)
...@@ -120,14 +116,16 @@ func TestAcceleratedUpload(t *testing.T) { ...@@ -120,14 +116,16 @@ func TestAcceleratedUpload(t *testing.T) {
ws := startWorkhorseServer(ts.URL) ws := startWorkhorseServer(ts.URL)
defer ws.Close() defer ws.Close()
resource := `/example` resources := []string{`/example`, `/uploads/personal_snippet`, `/uploads/user`}
resp, err := http.Post(ws.URL+resource, contentType, reqBody) for _, resource := range resources {
if err != nil { reqBody, contentType, err := multipartBodyWithFile()
t.Error(err) require.NoError(t, err)
}
defer resp.Body.Close() resp, err := http.Post(ws.URL+resource, contentType, reqBody)
if resp.StatusCode != 200 { require.NoError(t, err)
t.Errorf("GET %q: expected 200, got %d", resource, resp.StatusCode) require.Equal(t, 200, resp.StatusCode)
resp.Body.Close()
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment