Commit Graph

182 Commits

Author SHA1 Message Date
GitLab Bot 9c72b346ac Add latest changes from gitlab-org/gitlab@master 2020-10-15 09:08:41 +00:00
GitLab Bot 16515bdfcb Add latest changes from gitlab-org/gitlab@master 2020-10-13 15:08:53 +00:00
GitLab Bot c02e2a5ef6 Add latest changes from gitlab-org/gitlab@master 2020-10-09 00:08:41 +00:00
GitLab Bot 6092dcc437 Add latest changes from gitlab-org/gitlab@master 2020-10-02 12:09:03 +00:00
GitLab Bot dc86d5615e Add latest changes from gitlab-org/gitlab@master 2020-09-18 12:09:50 +00:00
GitLab Bot 692f4b734f Add latest changes from gitlab-org/gitlab@master 2020-09-03 21:08:18 +00:00
GitLab Bot 08b3b98051 Add latest changes from gitlab-org/gitlab@master 2020-09-01 12:11:01 +00:00
GitLab Bot 184906087f Add latest changes from gitlab-org/gitlab@master 2020-08-31 00:10:37 +00:00
GitLab Bot aca89cb7e9 Add latest changes from gitlab-org/gitlab@master 2020-08-04 15:09:27 +00:00
GitLab Bot ed00b1a6a3 Add latest changes from gitlab-org/gitlab@master 2020-07-28 12:09:49 +00:00
GitLab Bot ce34395e91 Add latest changes from gitlab-org/gitlab@master 2020-07-13 12:09:18 +00:00
GitLab Bot c59765a50a Add latest changes from gitlab-org/gitlab@master 2020-06-24 18:09:03 +00:00
GitLab Bot c6e6762bbf Add latest changes from gitlab-org/gitlab@master 2020-06-01 09:08:28 +00:00
GitLab Bot a5650b86b5 Add latest changes from gitlab-org/gitlab@master 2020-05-13 21:08:55 +00:00
GitLab Bot 3aeda4e614 Add latest changes from gitlab-org/gitlab@master 2020-04-30 21:09:47 +00:00
GitLab Bot b71a496c7a Add latest changes from gitlab-org/gitlab@master 2020-04-15 03:09:11 +00:00
GitLab Bot 132dd28342 Add latest changes from gitlab-org/gitlab@master 2020-03-28 09:08:30 +00:00
GitLab Bot 6f2065c468 Add latest changes from gitlab-org/gitlab@master 2020-03-25 15:07:47 +00:00
GitLab Bot 76e9fc7b29 Add latest changes from gitlab-org/gitlab@master 2020-03-11 18:09:23 +00:00
GitLab Bot 1fa79760ad Add latest changes from gitlab-org/gitlab@master 2020-03-10 12:08:16 +00:00
GitLab Bot 22e9af3c8b Add latest changes from gitlab-org/gitlab@master 2020-01-27 12:08:35 +00:00
GitLab Bot a5ab3467a7 Add latest changes from gitlab-org/gitlab@master 2020-01-13 15:07:53 +00:00
GitLab Bot 7f8330873c Add latest changes from gitlab-org/gitlab@master 2019-12-18 21:07:37 +00:00
GitLab Bot e723867717 Add latest changes from gitlab-org/gitlab@master 2019-12-17 18:07:48 +00:00
GitLab Bot d5b4360051 Add latest changes from gitlab-org/gitlab@master 2019-11-26 03:06:24 +00:00
GitLab Bot 34b3567c97 Add latest changes from gitlab-org/gitlab@master 2019-11-19 09:06:16 +00:00
GitLab Bot 2b3007dc96 Add latest changes from gitlab-org/gitlab@master 2019-09-20 18:06:35 +00:00
Robert Speicher b51770c66a Merge branch 'local-test-failures' into 'master'
git-user-related local test failures

See merge request gitlab-org/gitlab-ce!31437
2019-08-29 14:27:05 +00:00
Thong Kuah 8c42a0eac0 Add frozen_string_literal to lib part 2
Using the sed script from
https://gitlab.com/gitlab-org/gitlab-ce/issues/59758
2019-08-23 00:15:24 +12:00
David H. Wilkins 6391eeec30 git-user-related local test failures
Some of the tests fail locally due to the git user being different
than it is on the test runners.   I'd really like to be able to run
all of the tests locally.
2019-08-02 18:18:09 -05:00
Stan Hu 01203e7188 Fix health checks not working behind load balancers
The change in
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/24199 caused
requests coming from a load balancer to arrive as 127.0.0.1 instead of
the actual IP.

`Rack::Request#ip` behaves slightly differently different than
`ActionDispatch::Request#remote_ip`: the former will return the first
X-Forwarded-For IP if all of the IPs are trusted proxies, while the
second one filters out all proxies and falls back to REMOTE_ADDR, which
is 127.0.0.1.

For now, we can revert back to using `Rack::Request` because these
middlewares don't manipulate parameters. The actual fix problem involves
fixing Rails: https://github.com/rails/rails/issues/28436.

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/58573
2019-03-12 12:46:40 -07:00
Ash McKenzie c0a5b628c8
Allow sidekiq admin requests, regardless of root 2019-01-16 19:14:46 +11:00
Stan Hu 7d28e39f58 Fix multipart attachments not uploading
Mixing and matching the use of Rack::Request and ActionDispatch::Request
in Rails 5 is bad, particularly if you have middleware that
manipulates or accesses environment variables.

`Gitlab::Middleware::Multipart` attempts to rewrite request parameters
to the proper values (e.g. replacing `data_file` with
`UploadedFile`). It does this by calling `Rack::Request#update_params`,
which essentially updates `env['rack.request.form_hash']`.

By changing to `ActionDispatch::Request`, the Go middleware was causing
the request parameters to be stored inside
`env['action_dispatch.request.request_parameters']`. Later calls to
`Rack::Request#update_params` would not have any effect because it would
attempt to update `env['rack.request.form_has']` instead of
`env['action_dispatch.request.request_parameters']`. As a result, the
controller still saw the old parameters.

Since the Go middleware appears to be using `ActionDispatch::Request`
for authorization methods, we can switch the multipart middleware to
use it too.

Closes https://gitlab.com/gitlab-org/gitlab-ee/issues/9035
2019-01-05 01:56:47 -08:00
mortyccp 0e061adfcb Fix lint errors 2019-01-03 20:28:02 +08:00
mortyccp 3a62f15657 Remove authentication via warden and PRIVATE_TOKEN header 2019-01-03 20:28:02 +08:00
mortyccp b7e0a09de2 Fix rspec error in rails 4 2019-01-03 20:28:02 +08:00
mortyccp d1fea99deb Allow basic authentication on go get middleware 2019-01-03 20:28:02 +08:00
Jasper Maes 807139b6b9 Remove deprecated ActionDispatch::ParamsParser 2018-12-16 10:47:24 +01:00
Marcel Amirault eb640eded7 Correct Gitlab Capitalization in code files 2018-09-21 12:05:37 +00:00
Jan Provaznik 4ca9f3b417 Add public/uploads/tmp to allowed upload paths
When direct_upload is enabled and a for file is being uploaded,
then workhorse uses `public/uploads/tmp` path. If `uploads.storage_path`
i sset to a different directory, then upload fails because
`public/uploads/tmp` is not in allowed paths.
2018-08-21 17:39:46 +02:00
Stan Hu 22d44ae9a6 Use /-/health instead of breaking /-/liveness 2018-07-28 14:35:02 -07:00
Stan Hu eb2bc7d99a Simplify /-/liveness check to avoid connecting to the database
The previous implementation would hit the database each time
and provide a dummy response. If the database goes down, this
means all application workers would be taken out of service.
Simplify this check by using a Rails middleware that intercepts
this endpoint and returns a 200 response.
2018-07-28 14:35:02 -07:00
Mark Chao a63bce1a4b Resolve "Rename the `Master` role to `Maintainer`" Backend 2018-07-11 14:36:08 +00:00
Jan Provaznik 6b2ebea7dc Added test and used Array() instead of .wrap 2018-07-09 13:06:12 +02:00
Brett Walker f3e1028371 Refactor rspec matchers in read_only_spec.rb 2018-07-07 04:22:44 +00:00
Kamil Trzciński (OoO till 3th) 34694c3afc Merge branch 'jprovazn-direct-upload' into 'master'
Add workhorse authorize method for project/group uploads

Closes #44663

See merge request gitlab-org/gitlab-ce!19717
2018-07-04 09:50:29 +00:00
Ash McKenzie 26bea57883 Better route matching for read-only detection 2018-07-02 17:29:04 +10:00
Jan Provaznik 249c24891a Updated multipart to support workhorse direct uploads 2018-06-27 12:54:46 +02:00
Lin Jen-Shin bb4fcb7809 Move constants and update for feedback 2018-03-03 00:39:42 +08:00
Lin Jen-Shin 6c5a7d5305 Merge remote-tracking branch 'upstream/master' into 42572-release-controller
* upstream/master: (889 commits)
  SlackService - respect `notify_only_default_branch` for push events
  Clarify usage ping wording in admin area
  Update incoming emails documents
  Allow to include also descendant group labels
  Update docs on grouping CI jobs
  Support additional LabelsFinder parameters for group labels
  Extend Cluster Applications to install GitLab Runner to Kubernetes cluster
  Remove registry list webpack entry point
  Remove trailing newline that was causing an EE conflict
  Small fixes in Vuex docs
  Remove u2f webpack bundle
  Update documentation WRT to request parameters
  remove common_vue CommonsChunk config
  Fetch commit signatures from Gitaly in batches
  migrate stl_viewer to dynamic import
  migrate sketch_viewer to dynamic import
  migrate pdf_viewer to dynamic import
  migrate notebook_viewer to dynamic import
  migrate balsamiq_viewer to dynamic import
  Add some strings that were missing in gitlab.pot
  ...
2018-03-03 00:10:21 +08:00
Douwe Maan 7a6c7bd66b Allow token authentication on go-get request 2018-02-23 10:33:46 +00:00
Alessio Caiazza 34c2a59c57
Honour workhorse provided file name
In the attempt to unify file uploading at workhorse level gitlab-org/gitlab-workhorse!230
we moved to a prefix-based tempfile creation in order to avoid upload collisions.

Artifacts and LFS uploads already set original_filename to workhorse provided filename

This commit add the same feature to `Gitlab::Middleware::Multipart`
2018-02-12 17:31:29 +01:00
Lin Jen-Shin 31f1ec59a7 Release the entire env 2018-02-07 22:56:07 +08:00
Lin Jen-Shin bbfce29ba8 Use a controller to hold request values
So that we don't need to hold env after the request.
This makes it much harder to test, especially Rails session is
acting weirdly, so we need `dig('flash', 'flashes', 'alert')`
to dig the actual flash value.
2018-02-07 22:45:02 +08:00
Lin Jen-Shin d4d564c8e7 Try not to hold env and release the controller
after the request. This way, we could release the
project referred from the controller, which potentially
referred a repository which potentially allocated a lot of
memories.

Before this change, we could hold the last request data
and cannot release the memory. After this change, the
largest request data should be able to be collected from GC.

This might not impact the instances having heavy load,
as the last request should be changing all the time,
and GC won't kick in for each request anyway.

However it could still potentially allow us to free more
memories for each GC runs, because now we could free one
more request anyway.
2018-02-07 22:45:02 +08:00
digitalMoksha cba68d338b use `Gitlab::Routing.url_helpers` instead of `Rails.application.routes.url_helpers`
since `Rails.application.routes.url_helpers` creates a new anonymous module every time it's called
2017-11-21 13:29:57 +01:00
Stan Hu 3c52e2f06e Optimize read-only middleware so that it does not consume as much CPU
In !15082, we changed the behavior of the middleware to call
`Rails.application.routes.recognize_path` whenever a new route arrived.
However, this can be a CPU-intensive task because Rails needs to allocate
memory and compile 850+ different regular expressions, which are complicated
in GitLab.

As a short-term fix, we can do a lightweight string match before
we do the heavier comparison.

Closes #40185, gitlab-com/infrastructure#3240
2017-11-20 15:27:52 -08:00
Douwe Maan f767dd4a4d Fix go-import meta data when enabled_git_access_protocol is a blank string 2017-11-17 12:17:16 +01:00
Douwe Maan b579cc7620 Merge branch 'feature-change-signout-route' into 'master'
Change Sign Out route from a DELETE to a GET

Closes #39708

See merge request gitlab-org/gitlab-ce!15231
2017-11-08 09:28:50 +00:00
Joe Marty 4dea7944c4 Updates tests to reflect sign_out route change
- Also remove sign_out DELETE route from read-only whitelist routes
2017-11-07 11:42:25 -06:00
Pawel Chojnacki c9f0070b64 Make subscriber tests pass, after refactoring metrics 2017-11-02 18:18:16 +01:00
Pawel Chojnacki 534f6b1125 Tests for Web transaction and remove simple transacton 2017-11-02 18:11:44 +01:00
Pawel Chojnacki 95a23d246c Convert rails_queue_duration to metric_rails_queue_duration_seconds 2017-11-02 18:11:44 +01:00
Brett Walker 2fd5cc2bff Geo route whitelisting is too optimistic 2017-11-02 12:50:04 +00:00
Guilherme Vieira 1cc92dae77 Returns a ssh url for go-get=1 2017-10-31 19:22:40 -02:00
Toon Claes d13669716a Create idea of read-only database
In GitLab EE, a GitLab instance can be read-only (e.g. when it's a Geo
secondary node). But in GitLab CE it also might be useful to have the
"read-only" idea around. So port it back to GitLab CE.

Also having the principle of read-only in GitLab CE would hopefully
lead to less errors introduced, doing write operations when there
aren't allowed for read-only calls.

Closes gitlab-org/gitlab-ce#37534.
2017-10-06 22:37:40 +02:00
Robert Speicher bc10afb600 Merge branch 'dm-go-get-xss' into 'security-9-3'
Fix XSS issue in go-get handling

See merge request !2128
2017-09-07 20:22:16 -04:00
Robert Speicher 72a7b30c9f Change all `:empty_project` to `:project` 2017-08-02 17:47:31 -04:00
Robert Speicher 9513bd18c4 Ensure all project factories use `:repository` trait or `:empty_project` 2017-08-01 14:51:52 -04:00
Rémy Coutable ddccd24c13 Remove superfluous lib: true, type: redis, service: true, models: true, services: true, no_db: true, api: true
Signed-off-by: Rémy Coutable <remy@rymai.me>
2017-07-27 14:31:53 +02:00
Robert Speicher a6ec5121f0 Correct RSpec/SingleLineHook cop offenses 2017-06-14 13:18:56 -05:00
Douwe Maan 359f04e8a1 Fix go-get support for projects in nested groups 2017-03-07 19:40:19 -06:00
Jacob Vosmaer 4ec259fd36 Inject ::UploadedFile from Multipart middleware
I mistakenly concluded Rack::Multipart injects File instances into the
params. These should be UploadedFile instances. This reuses a mock
UploadedFile class we already had in GitLab.
2016-12-21 13:07:53 +01:00
Sean McGivern 8feba01708 Fix specs in Ruby 2.1
Ruby 2.1 requires a basename argument to `Tempfile.open`, so just call
it something that makes sense in context for the spec.
2016-12-16 11:29:16 +00:00
Jacob Vosmaer 6731ab5d76 Add Gitlab::Middleware::Multipart 2016-12-15 12:26:36 +01:00
Lin Jen-Shin 9c4e0d6445 Use `Gitlab.config.gitlab.host` over `'localhost'`
This would fix long standing failures running tests on
my development machine, which set `Gitlab.config.gitlab.host`
to another host because it's not my local computer. Now I
finally cannot withstand it and decided to fix them once and
for all.
2016-11-18 20:17:10 +08:00
Jacob Vosmaer 2bd0ed4a5c Fix typo in gitlab-workhorse header 2016-08-19 12:25:52 +02:00
Jacob Vosmaer 5771114f9b Rename metric to 'rails queue duration' 2016-05-26 17:53:21 +02:00
Jacob Vosmaer 6ec2730fb3 Test ProxyFlightTime middleware 2016-05-25 16:37:18 +02:00
Stan Hu 74d7de8196 Revert "Revert "Merge branch 'support-go-subpackages' into 'master' ""
This reverts commit 5a586f364c
2016-03-12 21:05:23 +00:00
Douwe Maan 5a586f364c Revert "Merge branch 'support-go-subpackages' into 'master' "
This reverts merge request !3191
2016-03-12 17:42:51 +00:00
Stan Hu b23a05d09b Add spec for go-import middleware 2016-03-12 08:10:38 -08:00