Commit Graph
332 Commits
Author SHA1 Message Date
Rémy Coutable 8ea6c6d80c Merge branch 'issue_15044' into 'master'
Allow to close invalid merge request

fixes #15044

See merge request !3664
2016-04-13 09:10:57 +00:00
Felipe Artur a64f1c7636 Add changelog entry, improve specs and model code 2016-04-12 15:52:03 -03:00
Douglas Barbosa Alexandre 61a62e00e3 Fix specs for Projects::NotificationSettingsController 2016-04-12 12:57:39 -03:00
Douglas Barbosa Alexandre aabb466e5b Improve specs for group/project notification controller 2016-04-12 12:10:59 -03:00
Douglas Barbosa Alexandre bee28e1785 Requires user to be signed in when changing notification settings 2016-04-11 20:50:26 -03:00
Felipe Artur 476cf23fc3 Allow to close invalid merge request 2016-04-11 19:00:59 -03: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
Felipe Artur 0bef4b9764 Implement review suggestions 2016-04-07 10:59:24 -03: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
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 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 924e4b3700 Return status code 303 after a branch DELETE operation to avoid project deletion
Closes #14994
2016-04-06 21:11:10 -07: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
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
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
Stan Hu 934f1e9097 Fix Error 500 after renaming a project path
Closes #14885
2016-04-05 11:18:13 -07:00
Felipe Artur 32c7e42b61 Improve code 2016-04-05 11:53:39 -03:00
Felipe Artur 1ba9a91c6d Fix problem when creating milestones in groups without projects 2016-04-05 11:53:39 -03:00
Grzegorz Bizon bb9c194c23 Respond 404 when unauthorized user imports members 2016-04-05 14:37:06 +02:00
Grzegorz Bizon c52b5c92fb Do not leak project exists when importing members
When importing members, and user does not have permissions to read
members in a source project, do not leak information about source
project existence. Notifiy user that project has not been found instead.
2016-04-05 13:55:15 +02:00
Grzegorz Bizon b248ee9381 Check permissions when importing project members
Closes #14899
2016-04-05 13:32:28 +02:00
Zeger-Jan van de Weg 340f1fc976 Minor clean up on admin/users_controller_spec 2016-03-31 22:29:32 +02:00
Gabriel Mazetto 808bcf5bc6 Fixed MergeRequestController spec 2016-03-30 00:02:32 -03:00
Rémy Coutable 00726e4df9 Merge branch 'fix/nomethod-error-on-ci' into 'master'
Fix error when visiting CI root path

Closes #14528, closes #14687

See merge request !3377
2016-03-29 10:32:38 +00:00
Douwe Maan a7ca8689f7 Merge branch 'fix-14607' into 'master'
Ensure private project snippets are not viewable by unauthorized people

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

See merge request !1946
2016-03-29 08:21:48 +00:00
Grzegorz Bizon b7685b57d3 Redirect to root path when visiting /ci 2016-03-29 08:04:17 +02:00
Rémy Coutable f4bdefdff1 Ensure private project snippets are not viewable by unauthorized people
Fix https://gitlab.com/gitlab-org/gitlab-ce/issues/14607.
2016-03-25 12:33:42 +01:00
Grzegorz Bizon 6f894bec09 Add definition of before action that has been moved
Closes #14528
2016-03-25 10:42:00 +01:00
Elias Werberich c3a98d8fcc Implementing 'Groups View' and 'TODOs View' as options for dashboard preferences.
Fixes #14585.
2016-03-24 19:59:54 +01:00
Douwe Maan 703f7c5d57 Merge branch 'fix-sorting-by-votes-on-groups-page' into 'master'
Fix sorting issues/mrs by votes on the groups page

Closes #14394 

The `non_archived` scope applied here https://gitlab.com/gitlab-org/gitlab-ce/blob/master/app/controllers/concerns/issues_action.rb#L5 overrides the previous `ORDER BY` applied inside the IssuesFinder, with the default scope of the Project model, resulting in SQL errors.

```ruby
Issue.reorder(created_at: :desc).joins(:project).to_sql
=> "SELECT issues.* 
    FROM issues INNER JOIN projects ON projects.id = issues.project_id
    ORDER BY issues.created_at DESC"

Issue.reorder(created_at: :desc).joins(:project).merge(Project.non_archived).to_sql
=> "SELECT issues.* 
    FROM issues INNER JOIN projects ON projects.id = issues.project_id 
    WHERE projects.archived = 'f'
    ORDER BY projects.id DESC"

Issue.reorder(created_at: :desc).joins(:project).merge(Project.non_archived.only(:where)).to_sql
=> "SELECT issues.* 
    FROM issues INNER JOIN projects ON projects.id = issues.project_id 
    WHERE projects.archived = 'f'
    ORDER BY issues.created_at DESC"
```

/cc @yorickpeterse 

See merge request !3333
2016-03-23 10:35:54 +00:00
Douwe Maan ae7b2ef62c Merge branch 'master' into issue_12658
# Conflicts:
#	app/models/issue.rb
#	app/views/projects/_home_panel.html.haml
#	app/views/shared/projects/_project.html.haml
#	db/schema.rb
#	spec/models/project_spec.rb
2016-03-21 23:22:21 +01:00
Douglas Barbosa Alexandre 100e3e7601 Fix sorting issues/mrs by votes on the groups page
The `non_archived` scope applied here
https://gitlab.com/gitlab-org/gitlab-ce/blob/master/app/controllers/conc
erns/issues_action.rb#L5 overrides the previous `ORDER BY` applied
inside the IssuesFinder, with the default scope of the Project model,
resulting in SQL errors.
2016-03-21 17:01:38 -03:00
Zeger-Jan van de Weg 6e5461c6ee Merge branch 'master' into 2489-soft-delete-issues 2016-03-21 19:32:37 +01:00
Zeger-Jan van de Weg d28a587e82 Fix typos and denting 2016-03-21 19:30:45 +01:00
Zeger-Jan van de Weg 3b088fc5b5 Minor improvements on IssuableActions 2016-03-21 16:59:35 +01:00
Douwe Maan 261569b246 Fix specs 2016-03-21 09:09:59 +01:00
Douwe Maan 19aa20d528 Fix more specs 2016-03-20 23:09:33 +01:00
Douwe Maan 7c51d5efec Fix some specs 2016-03-20 22:55:08 +01:00
Douwe Maan 8db1292139 Tweaks, refactoring, and specs 2016-03-20 21:04:07 +01:00
Douwe Maan 2eb19ea3ea Merge branch 'master' into issue_12658 2016-03-20 14:57:25 +01:00
Yorick Peterse 295fdf720a Create repositories in IssuesController specs
In the real world a project always has a repository. This fact allows
code such as Issue#related_branches to work without explicitly checking
if a repository exists.
2016-03-19 21:54:08 +01:00
Zeger-Jan van de Weg 1d77822816 minor improvements and fixed specs 2016-03-19 21:24:05 +01:00
Zeger-Jan van de Weg 7342a4566c Dry destroy action on issuables 2016-03-19 21:24:05 +01:00
Zeger-Jan van de Weg 212e83bab3 Soft delete issuables 2016-03-19 21:23:03 +01:00
Felipe Artur 8b830b8c3b Fix specs 2016-03-18 21:04:53 -03:00
Douglas Barbosa Alexandre 34ee75379c Restrict access to confidential issues 2016-03-17 20:55:38 -03:00
Felipe Artur 44c127447b Merge 4009-external-users into issue_12658 2016-03-16 20:16:42 -03:00
Zeger-Jan van de Weg 2b97c92119 Incorporate review 2016-03-15 20:21:11 +01:00
Zeger-Jan van de WegandZeger-Jan van de Weg ad97bebfed Enhance new branch button on an issue 2016-03-15 20:21:11 +01:00