Commit Graph

744 Commits

Author SHA1 Message Date
Ruben Davila b62e2bedbf Add new configuration setting to enable/disable HTML emails.
This new global setting will allow admins to specify if HTML emails should be sent or not,
this is basically useful when system administrators want to save some disk space by avoiding
emails in HTML format and using only the Plain Text version.
2016-11-28 17:00:03 -05:00
Brian Neel e14bb160ac Add logging for rack attack events 2016-11-18 15:05:22 -05:00
Rémy Coutable d1afb845b1 Merge branch 'fix-shibboleth-auth-with-no-uid' into 'master'
fix shibboleth misconfigurations resulting in authentication bypass

This merge request fixes #22267 where a misconfigured Shibboleth `HTTP_UID` or `HTTP_EPPN` could result in users being logged into an account that did not belong to them.

See merge request !7428
2016-11-16 17:28:56 +00:00
Brian Neel 067da6224e fix shibboleth misconfigurations resulting in authentication bypass 2016-11-14 17:10:20 -05:00
Alfredo Sumaran f4710ee83c Merge branch 'issue-13823' into 'master'
Issue #13823: random message when all Todos are Done

## What does this MR do?

Shows a random message every time the To Do list is empty: https://gitlab.com/gitlab-org/gitlab-ce/issues/13823

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

It's my first contribution to GitLab so I might need some help:

 - I'm loading a yaml file in the controller. I'm not sure where would be the best place to put it.
 - I'm also having the error below running the tests but it doesn't seem related to my changes. I think I might have some issue with my config. Could you double check if the tests pass for you?

/home/pep/.rvm/gems/ruby-2.3.1/gems/actionpack-4.2.7.1/lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call': No route matches [GET] "/autocomplete/users/sjobs@apple.com.json" (ActionController::RoutingError)

## Why was this MR needed?

https://gitlab.com/gitlab-org/gitlab-ce/issues/13823

## Screenshots (if relevant)

## 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
  - [ ] All builds are passing
- [x] Conform by the [merge request performance guides](http://docs.gitlab.com/ce/development/merge_request_performance_guidelines.html)
- [x] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides)
- [x] Branch has no merge conflicts with `master` (if it does - rebase it please)
- [x] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits)

## What are the relevant issue numbers?

https://gitlab.com/gitlab-org/gitlab-ce/issues/13823

See merge request !6818
2016-11-14 20:47:13 +00:00
Drew Blessing c50b98da72 Centralize LDAP config/filter logic
Centralize all LDAP config logic in `GitLab::LDAP::Config`. Previously,
some logic was in the Devise initializer and it was not honoring the
`user_filter`. If a user outside the configured `user_filter` signed
in, an account would be created but they would then be denied access.
Now that logic is centralized, the filter is honored and users outside
the filter are never created.
2016-11-11 15:58:33 -06:00
Josep Llaneras 0803a350b0 Issue #13823: random message when all Todos are Done 2016-11-11 20:59:54 +01:00
Patricio Cano 208530494e Refactored initializer code to its own class and added tests 2016-11-10 11:38:11 -06:00
Patricio Cano b95216aaba Allow the Sidekiq queues to throttle and the factor by which to throttle them to be configurable 2016-11-10 11:38:11 -06:00
Patricio Cano 9e2964c15a Allow certain Sidekiq jobs to be throttled 2016-11-10 11:38:10 -06:00
Dmitriy Zaporozhets 35142a0978 Merge branch 'dz-refactor-project-routes' into 'master'
Refactor project routing

## What does this MR do?

Refactor project routing: 

* split on multiple files
* improve routing order


## Why was this MR needed?

It makes it easier to maintain and modify project routing

## What are the relevant issue numbers?

Extracted from https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/7121

See merge request !7329
2016-11-08 13:04:02 +00:00
Dmitriy Zaporozhets 41990128a3
Refactor project routing
* split on multiple files
* improve routing order

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2016-11-07 17:14:34 +02:00
Drew Blessing d498ec98e0 Set default Sidekiq retries to 3
By default, Sidekiq will retry 25 times with an exponential backoff.
This may result in jobs retrying for up to 21 days. Most Sidekiq
failures occur when attempting to connect to external services -
Project service hooks, web hooks, mailers, mirror updates, etc.
We should set a default retry of 3, and if that's not sufficient
individual workers can override this in the worker class.
2016-11-04 14:58:02 -05:00
Robert Speicher b7d0cc5c32 Merge branch 'background-migrations' into 'master'
Support for post deployment migrations

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/22133

See merge request !6572
2016-11-01 19:22:33 +00:00
Stan Hu cde3963dae Initialize Sidekiq with the list of queues used by GitLab
The Sidekiq client API adds an entry to the Sidekiq "queues" list,
but mail_room and gitlab-shell use redis-rb directly to insert jobs
into Redis and thus do not make an extra "sadd" call to Redis
each time a job is inserted. To make it possible to monitor
these queues via the API, add an initialization step to
set up the list at startup.

Closes gitlab-com/infrastructure#682
2016-11-01 07:03:25 -07:00
Yorick Peterse 83c8241160
Support for post deployment migrations
These are regular Rails migrations that are executed by default. A user
can opt-out of these migrations by setting an environment variable
during the deployment process.

Fixes gitlab-org/gitlab-ce#22133
2016-10-31 12:54:48 +01:00
Frank Groeneveld 17a97ef2fa Remove unreferenced LFS objects from DB and fs 2016-10-28 19:39:20 +02:00
Sean McGivern 5c5259335f Add instrumentation to conflict classes 2016-10-13 14:16:34 -05:00
Yorick Peterse 237c8f66e6
Precalculate trending projects
This commit introduces a Sidekiq worker that precalculates the list of
trending projects on a daily basis. The resulting set is stored in a
database table that is then queried by Project.trending.

This setup means that Unicorn workers no longer _may_ have to calculate
the list of trending projects. Furthermore it supports filtering without
any complex caching mechanisms.

The data in the "trending_projects" table is inserted in the same order
as the project ranking. This means that getting the projects in the
correct order is simply a matter of:

    SELECT projects.*
    FROM projects
    INNER JOIN trending_projects ON trending_projects.project_id = projects.id
    ORDER BY trending_projects.id ASC;

Such a query will only take a few milliseconds at most (as measured on
GitLab.com), opposed to a few seconds for the query used for calculating
the project ranks.

The migration in this commit does not require downtime and takes care of
populating an initial list of trending projects.
2016-10-10 12:27:08 +02:00
Rémy Coutable 0876b46024 Merge branch 'memoize_shell_secret_token' into 'master'
Memoize Github::Shell's secret token

## What does this MR do?

`API::Helpers#secret_token` was reading the secret file on every invocation. This MR reads the file in the `gitlab_shell_secret_token.rb` initializer and saves it as a class variable at `Gitlab::Shell.secret_token`

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

 - I'm not sure if the use of `cattr_accessor` is the best approach, or if should be moved into the `class << self` block?
 - Should `API::Helpers#secret_token` be removed in favor of using `Gitlab::Shell.secret_token`?

## Why was this MR needed?

Performance optimization.

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

See merge request !6599
2016-10-07 10:35:03 +00:00
Nick Thomas e94cd6fdfe Add markdown cache columns to the database, but don't use them yet
This commit adds a number of _html columns and, with the exception of Note,
starts updating them whenever the content of their partner fields changes.

Note has a collision with the note_html attr_accessor; that will be fixed later

A background worker for clearing these cache columns is also introduced - use
`rake cache:clear` to set it off. You can clear the database or Redis caches
separately by running `rake cache:clear:db` or `rake cache:clear:redis`,
respectively.
2016-10-07 02:54:25 +01:00
Nick Thomas 5766e0661d Memoize ActiveRecord::Migrator.migrations in tests 2016-10-06 19:14:57 +01:00
Justin DiPierro fe46e4eb35 Load Github::Shell's secret token from file on initialization instead of every request. 2016-10-06 11:22:37 -04:00
Rémy Coutable d51bb99a7e
Merge commit 'dev/security' into 'master'
Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-10-06 08:33:11 +02:00
Jacob Vosmaer 437bebb0ff Don't send Private-Token headers to Sentry
Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/22537
2016-10-04 16:57:01 +02:00
Fu Xu 74c8e091f4 add configurable email subject suffix 2016-10-03 18:07:28 +08:00
Yorick Peterse b9daced7a2 Merge branch 'initialize-redis' into 'master'
Initialize Redis pool in single-threaded context

See merge request !6613
2016-09-30 12:32:18 +00:00
Jacob Vosmaer 52ee85e7bf Initialize Redis pool in single-threaded context
This side-steps the need for mutexes and whatnot.
2016-09-30 12:27:43 +02:00
Andre Guedes 5dbf1f4871 Use `Module#prepend` instead of `alias_method_chain` 2016-09-30 07:08:25 -03:00
Chris Wilson 9469666623 Update warn message for MySQL fix 2016-09-28 23:48:32 +00:00
Paco Guzman 41c08c93bc Gitlab::Checks is now instrumented
So we have a detailed view of what checks perform bad
2016-09-13 11:58:08 +02:00
Robert Speicher 0a250cf9eb Merge branch 'rails-5-backports' into 'master'
Fix two problematic bits of code that will be deprecated or broken in Rails 5.

Found in the Rails 5 MR: !5555

These are safe to use in Rails 4.2.7 as well as Rails 5.0.0, so I figured I'd backport them for the sake of making that merge request smaller.

The explanation for the mime_types.rb code is here: https://github.com/rails-api/active_model_serializers/issues/1027#issuecomment-126543577

See merge request !6214
2016-09-12 21:02:57 +00:00
Connor Shea 8b6bbc866d No need for this variable. 2016-09-12 14:23:32 -06:00
Connor Shea b12b724378 Remove x-json mime_type, rename to json_mime_types. 2016-09-11 16:03:17 -06:00
Jacob Vosmaer (GitLab) b7e6da5a4b Merge branch 'gitlab-workhorse-safeties' into 'master'
Security and safety improvements for gitlab-workhorse integration

Companion to https://gitlab.com/gitlab-org/gitlab-workhorse/merge_requests/60

- Use a custom content type when sending data to gitlab-workhorse
- Verify (using JWT and a shared secret on disk) that internal API requests came from gitlab-workhorse

This will allow us to build features in gitlab-workhorse that require
more trust, and protect us against programming mistakes in the future.

This is designed so that no action is required for installations from
source. For omnibus-gitlab we need to add code that manages the shared
secret.

See merge request !5907
2016-09-09 11:33:08 +00:00
Olaf Tomalka c0a92cb801 Limited amount of pruned Event rows per run
Old deployments of Gitlab might have a big number of old events to be
deleted. Such numbers cause the worker to timeout.
I've limited the amount of rows that should be destroyed at once to
10000, and increased how often pruning shall take place to 4 times a
day.
2016-09-07 19:41:25 +02:00
Olaf Tomalka e25b48ffcf Added cron to prune events older than 12 months.
Since contribution calendar shows only 12 months of activity,
events older than that time are not visible anywhere and can be
safely pruned saving big amount of database storage.

Fixes #21164
2016-09-07 19:41:25 +02:00
Connor Shea c7d717cf6a Fix two problematic bits of code that will be deprecated or broken in Rails 5. 2016-09-05 20:58:27 -06:00
Jacob Vosmaer c87540ed46 Verify JWT messages from gitlab-workhorse 2016-09-05 15:05:31 +02:00
Stan Hu 0fe4cf2b0f Fix Sentry not reporting right program for Sidekiq workers
Moves program tag into the global configuration since this doesn't
change and since Sidekiq workers get a unique context for each event.

Closes #21410
2016-08-25 19:42:52 -07:00
Z.J. van de Weg 4c8e9a8d27 Remove gitorious 2016-08-25 10:10:10 +01:00
Valery Sizov 8f9a7ca854 Revert the revert of Optimistic Locking 2016-08-22 18:43:13 +03:00
Douwe Maan 1e00e4369d Fix cron job key 2016-08-19 10:09:38 -05:00
Douwe Maan 41529b9254 Merge branch 'master' into expiration-date-on-memberships 2016-08-18 19:04:31 -05:00
Patricio Cano a4137411c6 Small refactor and syntax fixes. 2016-08-18 16:47:26 -05:00
Patricio Cano c297800862 Removed unnecessary service for user retrieval and improved API error message. 2016-08-18 16:47:26 -05:00
Patricio Cano e2f9c87600 Added checks for 2FA to the API `/sessions` endpoint and the Resource Owner Password Credentials flow. 2016-08-18 16:47:26 -05:00
Sean McGivern 883b96ab6a Allow project group links to be expired 2016-08-18 22:45:41 +01:00
Sean McGivern 8b1656282b Merge branch 'master' into expiration-date-on-memberships 2016-08-18 15:54:07 +01:00
Yorick Peterse e0fc43ebe2
Instrument Project.visible_to_user
Because this method is a Rails scope we have to instrument it manually
as regular the instrumentation methods only instrument methods defined
directly on a Class or Module.
2016-08-12 16:43:10 +02:00