Commit Graph

27 Commits

Author SHA1 Message Date
Paweł Chojnacki 26ac691a68 Instrument Unicorn with Ruby exporter 2017-07-04 15:28:34 +00:00
Sean McGivern 54c0c0cd17 Instrument MergeRequestDiff#load_commits
This instrumentation isn't needed strictly for performance measurements, but
just to see which controller actions call this method at all. See
<https://gitlab.com/gitlab-org/gitlab-ce/issues/30224#note_32306159> for more
details.
2017-06-14 12:01:38 +01:00
mhasbini 0a09925dce Enable Style/Proc cop for rubocop 2017-04-02 12:48:43 +03:00
Alejandro Rodríguez 46214d5e7b Improve storage validation after configuration structure update
Besides improving the error message to specify what exactly you
need to do to solve the error, we now don't skip all storage
validations on the test environment, so that you also get a nice error
message if you're running tests. Now if conditions are met to skip
valitaions (test env or env variable) we still make sure the settings
_look_ sane, we just skip verifying the paths exists and meet the given
conditions.
2017-03-08 15:51:30 -03:00
Sean McGivern a5db7f5425 Merge branch '28447-hybrid-repository-storages' into 'master'
Update storage settings to allow extra values per shard

See merge request !9597
2017-03-07 16:55:03 +00:00
Markus Koller b2ca28d24b Add specs for Doorkeeper resource_owner_authenticator 2017-03-07 15:08:15 +01:00
Markus Koller eefbc83730 Only use API scopes for personal access tokens 2017-03-07 15:00:29 +01:00
Markus Koller c498289048 Implement OpenID Connect identity provider 2017-03-07 14:54:35 +01:00
Alejandro Rodríguez 0b9d56f960 Update storage settings to allow extra values per shard
This will be necessary when adding gitaly settings. This version
doesn't make any functional changes, but allows us to include this
breaking change in 9.0 and add the needed extra settings in the future
with backwards compatibility
2017-03-03 12:13:30 -03:00
Adam Niedzielski ee31872777 Execute metrics initializer earlier
This makes sure that Gitlab::Metrics::RackMiddleware is added before
Gitlab::EtagCaching::Middleware.
2017-03-01 18:15:28 +01:00
Douwe Maan c10064aad5 Enable Style/SpaceInsideBrackets 2017-02-23 09:31:56 -06:00
Sean McGivern a96765e627 Add metric initializer spec
An empty file in one of the instrumented directories will cause the app
to fail to start when metrics are enabled. Metrics aren't enabled by
default in development or test.

We could handle the empty file case explicitly, but a file could still
not define the constant it is expected to, so instead run the
initializer manually in a spec and check that it succeeds.
2017-01-24 14:42:57 +00:00
Adam Niedzielski a8177e03e5 Introduce "stub_env" test helper for safely stubbing environment variables 2017-01-09 18:19:48 +01:00
Sean McGivern 90565b5f95 Give priority to environment variables
If an environment variable exists for secret_key_base, use that -
always. But don't save it to secrets.yml.

Also ensure that we never write to secrets.yml if there's a non-blank
value there.
2016-08-03 15:48:48 +01:00
Sean McGivern 379c2cbcbd Store all secret keys in secrets.yml
Move the last secret from .secret to config/secrets.yml, and delete
.secret if it exists.
2016-08-03 15:48:47 +01:00
Sean McGivern 405379bbfc Store OTP secret key in secrets.yml
.secret stores the secret token used for both encrypting login cookies
and for encrypting stored OTP secrets. We can't rotate this, because
that would invalidate all existing OTP secrets.

If the secret token is present in the .secret file or an environment
variable, save it as otp_key_base in secrets.yml. Now .secret can be
rotated without invalidating OTP secrets.

If the secret token isn't present (initial setup), then just generate a
separate otp_key_base and save in secrets.yml.

Update the docs to reflect that secrets.yml needs to be retained past
upgrades, but .secret doesn't.
2016-08-03 15:46:37 +01:00
lookatmike ae108ff703 Ignore invalid IPs in X-Forwarded-For when trusted proxies are configured. 2016-07-31 15:36:11 -04:00
Stan Hu 8d73c76131 Ignore invalid trusted proxies in X-Forwarded-For header
Certain reverse proxies can send invalid IP addresses in the X-Forwarded-For header
For example, Apache can send (null).

Closes #20194
2016-07-23 21:06:19 -07:00
Alejandro Rodríguez 89589007ae Skip repository storage path valitaions on test environment
Storage path are not created until `TestEnv.init`, so we must skip
their validation on initialization.
2016-07-21 18:33:51 -04:00
Alejandro Rodríguez 72f59ddf4c Use Pathname to make the repository storage path validations more robust 2016-07-21 18:29:56 -04:00
Grzegorz Bizon 9e211091a8 Enable Style/EmptyLines cop, remove redundant ones 2016-07-01 21:56:17 +02:00
Douwe Maan 8a245b80a5 Merge branch 'rack-request-trusted-proxies' into 'master'
Make Rack::Request use our trusted proxies when filtering IP addresses

## What does this MR do?

This allows us to control the trusted proxies while deployed in a private network.

## Are there points in the code the reviewer needs to double check?

If we want to limit what is impacted, we can do this specifically for the rack_attack request object.

## Why was this MR needed?

Normally Rack::Request will trust all private IPs as trusted proxies, which can cause problems if your users are connection on you network via private IP ranges.
    
Normally in a rails app this is handled by action_dispatch request, but rack_attack is specifically using the Rack::Request object instead.

## What are the relevant issue numbers?

Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/17550

## Does this MR meet the acceptance criteria?

- [x] [CHANGELOG](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CHANGELOG) entry added
- [ ] ~~[Documentation created/updated](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/development/doc_styleguide.md)~~
- [ ] ~~API support added~~
- Tests
  - [x] Added for this feature/bug
  - [x] All builds are passing
- [x] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides)
- [ ] Branch has no merge conflicts with `master` (if you do - rebase it please)
- [ ] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits)


\cc @stanhu

See merge request !4958
2016-06-30 15:37:16 +00:00
DJ Mountney 860785f007 Make Rack::Request use our trusted proxies when filtering IP addresses
This allows us to control the trusted proxies while deployed in a private network. Normally Rack::Request will trust all private IPs as trusted proxies, which can caue problems if your users are connection on you network via private IP ranges.

Normally in a rails app this is handled by action_dispatch request, but rack_attack is specifically using the Rack::Request object instead.
2016-06-29 21:19:55 -07:00
Alejandro Rodríguez 86359ec854 Refactor repository paths handling to allow multiple git mount points 2016-06-29 22:30:31 -04:00
Stan Hu 6ba627f7d6 Fix settings_spec so that it can that run by itself 2016-06-23 22:26:33 -07:00
DJ Mountney e37b314567 Add tests for setting trusted_proxies
Each test reloads the trusted_proxies initializer, which in turn will set Rails.application.config.action_dispatch.trusted_proxies to something new. This will leak into the other tests, but the middleware that it is used in has already been loaded for the whole test suite, so it should have no impact.
2016-05-04 15:49:39 -07:00
Rémy Coutable 2723dea667 Ensure Gravatar host looks like an actual host 2016-01-18 14:58:16 +01:00