Commit Graph
4650 Commits
Author SHA1 Message Date
Yorick Peterse c56f702ec3 Instrument Rails cache code
This allows us to track how much time of a transaction is spent in
dealing with cached data.
2016-04-08 17:54:52 +02:00
Rémy Coutable 074c239390 Merge branch 'issue_14012' into 'master'
Fix problem when creating milestones in groups without projects

Fixes #14012 

See merge request !3481
2016-04-07 15:19:56 +00:00
Douwe Maan 9cae14037a Merge branch 'regex-for-colons' into 'master'
Add optional colon.



See merge request !3591
2016-04-07 14:40:18 +00:00
Felipe Artur 0bef4b9764 Implement review suggestions 2016-04-07 10:59:24 -03:00
Jacob Schatz 0bbeebc8f9 Remove dumb debug statement and add many tests. 2016-04-07 08:47:29 -04:00
Grzegorz Bizon b30ebdaa1a Merge branch 'master' of dev.gitlab.org:gitlab/gitlabhq
* 'master' of dev.gitlab.org:gitlab/gitlabhq:
  Make sessions controller specs more explicit
  Fix 2FA authentication spoofing vulnerability
  Add specs for sessions controller  including 2FA
2016-04-07 14:10:28 +02:00
Rémy Coutable 237324cc17 Merge branch 'fix/2fa-authentication-spoofing' into 'master'
Fix 2FA authentication spoofing

## Summary

This is security fix for vulnerability described at 
https://gitlab.com/gitlab-org/gitlab-ce/issues/14900.

Attacker was able to bypass password authentication of users that have 2FA enabled, and consequently sign is as a different user, without knowing his password, if he managed to guess 2FA One Time Password for that user.

It was also possible to enumerate users and check if they have 2FA enabled, because GitLab responded with different error for each case.

## Fix

This MR attempts to change default user search scope if `otp_user_id` session variable has been set. If it is present, it means that user has 2FA enabled, and has already been verified with login and password. In this case we should look for user with `otp_user_id` first, before picking it up by `login`.

Both, 2FA authentication spoofing and 2FA discovery have been covered by specs.

## Further work

Current 2FA code is a bit tricky, so it probably needs some refactoring.



See merge request !1947
2016-04-07 11:56:44 +00:00
Grzegorz Bizon 33a8dfd04f Make sessions controller specs more explicit 2016-04-07 13:16:48 +02:00
Yorick Peterse a918e8bf27 Merge branch 'fix-project-404-cache-issue' into 'master'
Expire caches after project creation to ensure a consistent state

See merge request !3586
2016-04-07 10:31:04 +00:00
Rémy Coutable 144912851c Merge branch 'update_main_lang_if_unset' into 'master'
Only update main language if it is not already set

Related to gitlab-org/gitlab-ce#14937 (but does not fully fix) This is a temporary fix so performance isn't affected so much. 

cc @yorickpeterse @ayufan how does this look?

See merge request !3556
2016-04-07 09:41:51 +00:00
Grzegorz Bizon 00da609cfd Fix 2FA authentication spoofing vulnerability
This commit attempts to change default user search scope if otp_user_id
session variable has been set. If it is present, it means that user has
2FA enabled, and has already been verified with login and password. In
this case we should look for user with otp_user_id first, before picking
it up by login.
2016-04-07 11:19:29 +02:00
Rémy Coutable 92897d7683 Merge branch 'api-filter-milestone' into 'master'
API: Ability to filter milestones by state

Ability to filter milestones by `active` and `closed` state.

* Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/14931

See merge request !3566
2016-04-07 08:45:35 +00:00
Rémy Coutable 8eae7b1088 Merge branch 'feature/expose-builds-badge' into 'master'
Expose badges

This MR exposes badge somewhere in visible place.

![expose_badges](/uploads/d2e290d3013d1ef2b1bdeebbbe2c5d8b/expose_badges.png)

Closes #13801

See merge request !3326
2016-04-07 08:40:15 +00:00
Rémy Coutable d62a3decf9 Merge branch 'fix_14638' into 'master'
Fixes #14638.

The SQL query was ambiguous and in this case we want to filter projects.

See merge request !3462
2016-04-07 08:35:38 +00:00
Stan Hu 27b9f64efb Expire caches after project creation to ensure a consistent state
Closes #14961
2016-04-07 00:29:01 -07:00
Stan Hu 924e4b3700 Return status code 303 after a branch DELETE operation to avoid project deletion
Closes #14994
2016-04-06 21:11:10 -07:00
Robert Speicher 936be025cd Merge branch 'saml-external-groups' into 'master'
Allow SAML to identify external users and set them as such

Related to #4009

Fixes #14577

This allows SAML to retrieve group information form the `SAML Response`
and match that to a setting that will flag all matching users as external.

See merge request !3530
2016-04-07 00:35:08 +00:00
Robert Speicher 730625f022 Merge branch 'patch/fix-markdown-preview-wikis' into 'master'
Wiki preview URL converting problem [via Markdown]

Current implementation when rendering the preview, thinks relative links are for project repository files.

We are creating a new preview route that will define correct context data to render for wikis instead.

Fixes #2380, #1184

See merge request !3461
2016-04-07 00:17:21 +00:00
Patricio Cano 8110e75309 Implemented suggested fixes 2016-04-06 18:12:25 -05:00
Gabriel Mazetto 1575a95b65 little refactor and improvements on specs 2016-04-06 20:09:15 -03:00
Robert Speicher 5bdc18c5b3 Merge branch 'patch/fix-ldap-unblock-user-logic' into 'master'
Unblocks user when active_directory is disabled and it can be found

We implemented a specific block state to handle user blocking that originates from LDAP filtering rules / directory state in !2242. 

That introduced a regression in LDAP authentication when Active Directory support was disabled. You could have a scenario where the user would not be temporarily found (like a filtering rule), that would mark the user as `ldap_blocked`, but will never unblock it automatically when that state changed.

Fixes #14253, #13179, #13259, #13959

See merge request !3550
2016-04-06 21:50:40 +00:00
Douwe Maan fe132f52e8 Merge branch 'fix-markdown-rendering' into 'master'
Fix header link rendering when containing numbers

This fixes the problem where Markdown such as:

    ### 31st

Would get rendered as a link tag pointing to issue number 31 inside a
header tag.

See gitlab-org/gitlab-ce#14936 for more information.

cc @rspeicher 

See merge request !3568
2016-04-06 21:19:12 +00:00
Patricio Cano 3a36fa8957 Fix error that was causing only one group to be returned and corrected specs to use the proper attribute type 2016-04-06 16:03:35 -05:00
Drew Blessing 935bf7271d Only update main language if it is not already set 2016-04-06 14:56:40 -05:00
Robert Schilling dc3272dccb Revert "API: Ability to retrieve a single tag"
This reverts commit 7f287c9136.
2016-04-06 21:03:24 +02:00
Robert Schilling e6215a9a8e Improve coding and doc style 2016-04-06 20:53:17 +02:00
Robert Schilling 0728588c34 API: Ability to filter milestones by state 2016-04-06 20:39:43 +02:00
Grzegorz Bizon 7640b050c0 Add feature specs for list of badges page 2016-04-06 19:56:34 +02:00
Grzegorz Bizon b7fa7c4d59 Extend build status badge, add html/markdown methods 2016-04-06 19:56:34 +02:00
Jacob Schatz 77e178b5e1 Merge branch 'fix_missing_filters_on_status_tab_change' into 'master'
Fix missing filters on status tab when user swithches to another state

closes #14769 

![fixi](/uploads/7733ec714b70b2157104af4b039953c3/fixi.gif)

See merge request !3482
2016-04-06 17:21:25 +00:00
Robert Speicher 755edd8004 Merge branch 'metrics-measure-block' into 'master'
Support for measuring Ruby blocks using GitLab performance monitoring

This adds support for measuring timings of arbitrary Ruby blocks.

Fixes #14710 

See merge request !3515
2016-04-06 17:13:15 +00:00
PotHix 222e1dc59c Fixes #14638.
The SQL query was ambiguous and in this case we want to filter projects.
2016-04-06 13:56:28 -03:00
Rémy Coutable e79b867d2b Ensure empty recipients are rejected in BuildsEmailService
Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-04-06 16:14:51 +02:00
Yorick Peterse 1af6cf28c0 Measure Ruby blocks using Gitlab::Metrics
This allows measuring of timings of arbitrary Ruby blocks, this allows
for more fine grained performance monitoring. Custom values and tags can
also be attached to a block.
2016-04-06 14:31:52 +02:00
Yorick Peterse a3cf3d1982 Corrected some spec headers for Gitlab::Metrics 2016-04-06 14:31:52 +02:00
Yorick Peterse 507cbca339 Fix header link rendering when containing numbers
This fixes the problem where Markdown such as:

    ### 31st

Would get rendered as a link tag pointing to issue number 31 inside a
header tag.

See gitlab-org/gitlab-ce#14936 for more information.
2016-04-06 14:24:30 +02:00
Robert Schilling 7f287c9136 API: Ability to retrieve a single tag 2016-04-06 13:59:50 +02:00
Grzegorz Bizon 301f4074aa Add specs for sessions controller including 2FA
This also contains specs for a bug described in #14900
2016-04-06 12:26:10 +02:00
Gabriel Mazetto 207b7218aa Ensure correct filter order to validate with our markdown spec 2016-04-06 03:30:56 -03:00
Gabriel Mazetto 22055e1058 Fix a few edited references from WikiLinkFilter and specs 2016-04-06 03:13:46 -03:00
Gabriel Mazetto 61fe0a2397 Fixed WikiPipeline and specs 2016-04-06 03:12:39 -03:00
Arinde Eniola 1e87679702 complete the tests 2016-04-06 03:42:27 +01:00
Arinde Eniola 55b2fae327 set up test for preventing this issue from reoccuring 2016-04-06 02:50:01 +01:00
Patricio Cano 7efaf22bcc Removed extra LDAP tests and added tests for the external groups feature 2016-04-05 19:22:58 -05:00
Stan Hu 779b9eac57 Merge branch 'fix-project-path-rename' into 'master'
Fix Error 500 after renaming a project path

Renaming the path of a project would result in an Error 500 due to `@repository` being memoized with the old path. An Error 500 would result:

```
Started GET "/testing2/test1" for 127.0.0.1 at 2016-04-04 12:42:30 +0000
Processing by ProjectsController#show as HTML
  Parameters: {"namespace_id"=>"testing2", "id"=>"test1"}
Completed 200 OK in 637ms (Views: 194.2ms | ActiveRecord: 111.8ms)
Started GET "/testing2/test1/edit" for 127.0.0.1 at 2016-04-04 12:42:33 +0000
Processing by ProjectsController#edit as HTML
  Parameters: {"namespace_id"=>"testing2", "id"=>"test1"}
Completed 200 OK in 594ms (Views: 183.8ms | ActiveRecord: 87.4ms)
Started PATCH "/testing2/test1" for 127.0.0.1 at 2016-04-04 12:42:41 +0000
Processing by ProjectsController#update as HTML
  Parameters: {"utf8"=>"✓", "authenticity_token"=>"[FILTERED]", "project"=>{"nam
e"=>"test123", "path"=>"test123"}, "namespace_id"=>"testing2", "id"=>"test1"}
Completed 500 Internal Server Error in 1852ms (ActiveRecord: 124.0ms)

ActionView::Template::Error (no repository for such path):
    2:   %legend
    3:     Builds:
    4:
    5:   - unless @repository.gitlab_ci_yml
    6:     .form-group
    7:       .col-sm-offset-2.col-sm-10
    8:         %p Builds need to be configured before you can begin using Contin
uous Integration.
  app/models/repository.rb:59:in `block in empty?'
  lib/repository_cache.rb:19:in `fetch'
  app/models/repository.rb:59:in `empty?'
  app/models/repository.rb:471:in `gitlab_ci_yml'
  app/views/projects/_builds_settings.html.haml:5:in `_app_views_projects__build
s_settings_html_haml__782034335636359229_73397600'
  app/views/projects/edit.html.haml:87:in `block in _app_views_projects_edit_htm
l_haml___2388082585934859365_47390860'
  app/views/projects/edit.html.haml:8:in `_app_views_projects_edit_html_haml___2
388082585934859365_47390860'
  app/controllers/projects_controller.rb:54:in `block (2 levels) in update'
  app/controllers/projects_controller.rb:43:in `update'
  lib/gitlab/middleware/go.rb:16:in `call'
```

Closes #14885

See merge request !3528
2016-04-05 22:16:15 +00:00
Robert Speicher 74313988ac Merge branch 'rs-fix-gmail-actions' into 'master'
Premailer shouldn't remove script tags from our emails

Closes #14943.

See merge request !3552
2016-04-05 21:47:08 +00:00
Robert Speicher ee1de011d1 Premailer shouldn't remove script tags from our emails
Closes #14943.
2016-04-05 17:03:34 -04:00
Jacob Schatz 2446f853bd Merge branch 'close-issue-bug' into 'master'
Fix data check in update issue response



See merge request !3548
2016-04-05 20:48:00 +00:00
Annabel Dunstone 1eeec7c63e Update issue_spec test 2016-04-05 13:13:49 -07:00
Gabriel Mazetto 5ee6badade Unblocks user when active_directory is disabled and it can be found 2016-04-05 16:34:31 -03:00