Commit Graph
3411 Commits
Author SHA1 Message Date
Douwe Maan 6ce25e7b4c Rename MergeRequest methods that return commits or shas to be more clear and consistent 2016-07-06 18:50:58 -04:00
Patricio Cano cb24650ab8 Rebasing caused enabled_git_access_protocol to become plural. Fixed here. 2016-07-05 16:54:22 -05:00
Patricio Cano 9397ce9137 Correct access control flow for Git HTTP requests. 2016-07-05 16:54:22 -05:00
Patricio Cano da15471bb1 Clarify protocol access check, and make Git HTTP access call more specific. 2016-07-05 16:54:22 -05:00
Patricio Cano 0f54e2ae6c Render the status message with plain: so that the message gets passed to the Git client. 2016-07-05 16:54:22 -05:00
Patricio Cano 08018b7a7a Render :forbidden *only* if HTTP is disabled. 2016-07-05 16:54:22 -05:00
Patricio Cano 41c87b9a23 Return :forbidden if HTTP protocol access is not allowed 2016-07-05 16:54:22 -05:00
Patricio Cano c98f89eac7 Simplify access checks 2016-07-05 16:54:22 -05:00
Patricio Cano 7735ef86f0 Only allow Git Access on the allowed protocol 2016-07-05 16:54:22 -05:00
Patricio Cano 512adc21fe Add setting that allows admins to choose which Git access protocols are enabled 2016-07-05 16:54:22 -05:00
Douwe Maan fc3402b7ea Merge branch 'git-http-kerberos-ce' into 'master'
Groundwork for Kerberos SPNEGO (EE feature)

Refactor Projecst::GitHttpController to allow Kerberos integration in GitLab EE.

Companion to https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/509

See merge request !5037
2016-07-01 22:24:49 +00:00
Douwe Maan d1c94f034b Merge branch 'explicit-requesters-scope' into 'master'
Exclude requesters from Project#members, Group#members and User#members

## What does this MR do?

It excludes requesters from the `Project#members`, `Group#members` and `User#members` associations, and adds new `Project#requesters` and `Group#requesters` associations.

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

No.

## Why was this MR needed?

Without this, if you call `project.members`, requesters are included in the results! This is at best misleading, and at worst can lead to security issues. By excluding requesters from the `#members` associations, we avoid introducing security inadvertently since you have to call the `#requesters` association explicitly to get requesters.

## What are the relevant issue numbers?

This is something I realized while fixing the security issue #19102.

## Does this MR meet the acceptance criteria?

- [x] I don't think this needs a CHANGELOG since this is an internal change
- Tests
  - [x] Added for this feature/bug
  - [ ] All builds are passing
- [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 you do - rebase it please)
- [x] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits)

See merge request !4946
2016-07-01 22:23:26 +00:00
Grzegorz Bizon 9e211091a8 Enable Style/EmptyLines cop, remove redundant ones 2016-07-01 21:56:17 +02:00
Rémy Coutable d71983f599 Fix snippets comments not displayed
The issue was that @notes were not passed to Banzai::NoteRenderer.render
in Projects::SnippetsController#show. This was forgotten in d470f3d1.

Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-07-01 18:39:19 +02:00
Rémy Coutable bd78f5733c Exclude requesters from Project#members, Group#members and User#members
And create new Project#requesters, Group#requesters scopes.

Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-07-01 17:44:46 +02:00
Rémy Coutable b569f842b3 Merge branch 'enable-shared-runners-with-admins' into 'master'
Admin should be able to turn shared runners into specific ones:

## What does this MR do?

Make sure admins could turn shared runners into specific runners.

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

Is this the desired behaviour?

## Why was this MR needed?

Closes #19039
Closes #19272

![Screen_Shot_2016-06-30_at_9.30.05_PM](/uploads/97eb3b4923fd4e498b1f8ca70b1345c8/Screen_Shot_2016-06-30_at_9.30.05_PM.png)

See merge request !4961
2016-07-01 10:10:46 +00:00
Yorick Peterse a647d55773 Merge branch 'avoid-instantiate-tree-for-projects-show-readme-view' into 'master'
Avoid instantiation of a Git::Tree

See merge request !4997
2016-07-01 09:51:50 +00:00
Jacob Vosmaer 4bcad1cbdd Groundwork for Kerberos SPNEGO (EE feature) 2016-07-01 11:46:56 +02:00
Lin Jen-Shin 08070c7695 Merge remote-tracking branch 'upstream/master' into enable-shared-runners-with-admins
* upstream/master: (120 commits)
  Update CHANGELOG for 8.9.4, 8.8.7, and 8.7.9.
  Remove additional entries from CHANGELOG
  Catch permission denied errors and ignore the disk
  Remove coveralls lines
  Make GH one-off auth the default again for importing GH projects
  Import from Github using Personal Access Tokens.
  Remove hardcoded gitlab-shell version in test env now that the required tag is published
  Updated breakpoint for sidebar pinning
  Expire branch/tag git data when needed.
  Remove unnecessary parens
  Enable Style/UnneededCapitalW Rubocop cop
  Expiry date on pinned nav cookie
  Fix broken spec in git_push_service_spec by stubbing an external issue tracker
  Handle external issues in IssueReferenceFilter
  Move Changelog entry for build retry fix to 8.9.4
  Add Changelog entry for build sidebar retry link fix
  Improve method that tells if build is retryable
  Do not show build retry link when build is active
  Remove coveralls as its unused
  Move changelot item "Add sub nav to file page view" to 8.9.4
  ...
2016-07-01 17:34:00 +08:00
Josh Frye 7dbc3d97d1 Catch permission denied errors and ignore the disk 2016-06-30 13:53:35 -04:00
Rémy Coutable ce6635406c Make GH one-off auth the default again for importing GH projects
Advertise the PAT as an alternative unless GH import is not configured.

Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-06-30 18:48:17 +02:00
Eric K IdemaandRémy Coutable 12aa1f898d Import from Github using Personal Access Tokens.
This stands as an alternative to using OAuth to access a user's Github
repositories.  This is setup in such a way that it can be used without OAuth
configuration.

From a UI perspective, the how to import modal has been replaced by a full
page, which includes a form for posting a personal access token back to the
Import::GithubController.

If the user has logged in via GitHub, skip the Personal Access Token and go
directly to Github for an access token via OAuth.
2016-06-30 18:48:17 +02:00
Dmitriy Zaporozhets 1c2e7af6af Merge branch 'issue-18886' into 'master'
Loop all disks when displaying system info. Closes #18886



See merge request !4983
2016-06-30 12:56:59 +00:00
Alejandro Rodríguez 4a8a69837a Add Application Setting to configure default Repository Path for new projects 2016-06-29 23:35:00 -04:00
Josh Frye 98238a27c7 Loop all disks when displaying system info 2016-06-29 16:02:12 -04:00
Robert Speicher 84113d7e72 Merge branch 'rubocop/enable-space-after-cops' into 'master'
Enable Style/SpaceAfterComma and Colon Rubocop cops

See #17478

See merge request !4991
2016-06-29 19:50:08 +00:00
Paco Guzman 0601ce1871 Avoid instantiation of a Git::Tree
Only needed when the project view is ‘Files view’
2016-06-29 17:56:15 +02:00
Felipe Artur d2971315ab Merge branch 'master' into issue_3359_3 2016-06-29 11:32:38 -03:00
Felipe Artur 36d48120f6 merge master into issue_3359_3 2016-06-29 11:04:18 -03:00
Grzegorz Bizon 9798ac77ed Enable Style/SpaceAfterColon Rubocop cops 2016-06-29 15:16:04 +02:00
Lin Jen-Shin 23a3ce946a Use Ability to check pre-requisite. Change back to 403 because:
If we're using `can?` it would look weird to use 409
2016-06-29 19:04:06 +08:00
Robert Speicher 5423e6e2d5 Merge branch 'zj-workhorse-format-patch' into 'master'
Workhorse to serve email diffs

See merge request !4590
2016-06-29 02:26:38 +00:00
Josh Frye 0aa0ace9bc Change load average to cpu/cores on system info. 2016-06-28 21:35:42 -04:00
Josh Frye 13ba3bd4fd Use number_to_human_size for system info and remove dependency on Filesize gem. 2016-06-28 21:35:42 -04:00
Josh Frye 242aa5bd66 Round figures for system info 2016-06-28 21:35:42 -04:00
Josh Frye 82edef9414 Show basic system info on admin panel. Closes #18886 2016-06-28 21:35:42 -04:00
Z.J. van de Weg c31f876a27 Workhorse to serve email diffs
Depends on the changes in Workhorse (gitlab-org/gitlab-workhorse!48).
2016-06-28 14:26:38 +02:00
Lin Jen-Shin 397a69f834 Allow admins to assign locked runners:
And show information about locked status.

Help! This looks bad :o
2016-06-28 19:55:12 +08:00
Lin Jen-Shin b5c8d58afb Use 409 to indicate that interface might be outdated
Because invalid actions shouldn't be shown on the page.
2016-06-28 19:54:18 +08:00
Lin Jen-Shin 95c99cd4fd Admin should be able to turn shared runners into specific ones:
The regression was introduced by:

https://gitlab.com/gitlab-org/gitlab-ce/commit/1b8f52d9206bdf19c0dde04505c4c0b1cf46cfbe

I did that because there's a test specifying that a shared runner cannot
be enabled, in the API. So I assume that is the case for non-admin, but
admins should be able to do so anyway.

Also added a test to make sure this won't regress again.

Closes #19039
2016-06-28 13:46:47 +08:00
Robert Speicher c9a4626333 Merge remote-tracking branch 'dev/master' 2016-06-27 18:39:42 -04:00
Robert Speicher 7d8b3a0314 Merge branch '19102-fix' into 'master'
Fix an information disclosure when requesting access to a group containing private projects

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

The commit speaks for itself:

    Fix an information disclosure when requesting access to a group containing private projects
    
    The issue was with the `User#groups` and `User#projects` associations
    which goes through the `User#group_members` and `User#project_members`.
    
    Initially I chose to use a secure approach by storing the requester's
    user ID in `Member#created_by_id` instead of `Member#user_id` because I
    was aware that there was a security risk since I didn't know the
    codebase well enough.
    
    Then during the review, we decided to change that and directly store the
    requester's user ID into `Member#user_id` (for the sake of simplifying
    the code I believe), meaning that every `group_members` / `project_members`
    association would include the requesters by default...
    
    My bad for not checking that all the `group_members` / `project_members`
    associations and the ones that go through them (e.g. `Group#users` and
    `Project#users`) were made safe with the `where(requested_at: nil)` /
    `where(members: { requested_at: nil })` scopes.
    
    Now they are all secure.

See merge request !1973
2016-06-27 18:41:31 +00:00
Douwe MaanandDouwe Maan c2223efe84 Fix rendering of commit notes 2016-06-27 18:00:18 +00:00
Stan Hu 4c767bab58 Merge branch 'issue_19096' into 'master'
Validate presence of essential params for diff rendering

## What does this MR do?

Check the presence of essential params before rendering diff content.
## Are there points in the code the reviewer needs to double check?

No
## Why was this MR needed?

To avoid the generated application error
## What are the relevant issue numbers?

#19096

## Screenshots (if relevant)

## Does this MR meet the acceptance criteria?

- [ ] [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
- [ ] 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 you do - rebase it please)
- [ ] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits)

See merge request !4917
2016-06-25 03:38:13 +00:00
Ruben Davila 7627cc1989 Validate presence of essential params for diff rendering
This will avoid application errors generated by the assumption of the
presence of these params.
2016-06-24 16:20:53 -05:00
Felipe Artur bade71ba5a Add specs and improve coffescript sortable binding function 2016-06-24 15:24:59 -03:00
Felipe Artur c391a72c18 Fix issue being ordered twice and callback when moving between states 2016-06-24 15:23:33 -03:00
Rémy Coutable e3d464d82a Fix a wrong MR status when merge_when_build_succeeds & project.only_allow_merge_if_build_succeeds are true
The issue was that `MergeRequest#mergeable?` returns false when the CI
state is not success and project.only_allow_merge_if_build_succeeds is
true. In this case `Projects::MergeRequestsController#merge` would
return the `:failed` status when enabling `merge_when_build_succeeds`,
thus leading to a weird state and the MR never automatically merged.

The fix is to disable the CI state check in the controller safeguard
that early return the `:failed` status.

Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-06-24 18:33:02 +02:00
Rémy Coutable 07ea22e52b Merge branch 'fix/gitlab-import-project-file-fix' into 'master'
Fix temp file being deleted after the request while importing a GitLab project

Fixes https://gitlab.com/gitlab-com/infrastructure/issues/151

In production, the temporary uploaded file is getting deleted straight after the request so the Sidekiq worker is unable to find it in `/tmp`

Also, improved erroring/logging of this situation.

See merge request !4894
2016-06-24 10:22:44 +00:00
Rémy Coutable aec3475df9 Fix an information disclosure when requesting access to a group containing private projects
The issue was with the `User#groups` and `User#projects` associations
which goes through the `User#group_members` and `User#project_members`.

Initially I chose to use a secure approach by storing the requester's
user ID in `Member#created_by_id` instead of `Member#user_id` because I
was aware that there was a security risk since I didn't know the
codebase well enough.

Then during the review, we decided to change that and directly store the
requester's user ID into `Member#user_id` (for the sake of simplifying
the code I believe), meaning that every `group_members` / `project_members`
association would include the requesters by default...

My bad for not checking that all the `group_members` / `project_members`
associations and the ones that go through them (e.g. `Group#users` and
`Project#users`) were made safe with the `where(requested_at: nil)` /
`where(members: { requested_at: nil })` scopes.

Now they are all secure.

Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-06-24 12:01:48 +02:00