<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/gitlab/gitlab-ce.git/lib/api, branch improve-diff-header</title>
<subtitle>gitlab.com: gitlab-org/gitlab-ce.git
</subtitle>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/gitlab/gitlab-ce.git/'/>
<entry>
<title>Merge branch 'fix-restricted-visibility' into 'master'</title>
<updated>2015-03-16T17:49:46+00:00</updated>
<author>
<name>Dmitriy Zaporozhets</name>
<email>dzaporozhets@gitlab.com</email>
</author>
<published>2015-03-16T17:49:46+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/gitlab/gitlab-ce.git/commit/?id=648f38cd98eed41ddf56613194f2d91c0e5b1fbb'/>
<id>648f38cd98eed41ddf56613194f2d91c0e5b1fbb</id>
<content type='text'>
Restricted visibility levels - bug fix and new feature

This allows admin users to override restricted visibility settings when creating and updating projects and snippets, and moves the restricted visibility configuration from gitlab.yml to the web UI.  See #1903.

## Move configuration location

I added a new section to the application settings page for restricted visibility levels.  Each level has a checkbox, styled with Bootstrap to look like a toggle button.  A checked box means that the level is restricted.  I added a glowing text shadow and changed the background color for checked buttons because the default styles made it hard to distinguish between checked and unchecked.  This image shows the new section with the "Public" box checked:

![restricted_visibility_settings](https://dev.gitlab.org/Okada/gitlabhq/uploads/629562e4313f89b795e81c3bb0f95893/restricted_visibility_settings.png)

## Allow admins to override

To allow admin users to override the restricted visibility levels, I had to remove the `visibility_level` validation from the `Project` class.  The model doesn't know about the `current_user`, which should determine whether the restrictions can be overridden.  We could use the creator in the validation, but that wouldn't work correctly for projects where a non-admin user is the creator and an admin tries to change the project to a restricted visibility level.

The `Project::UpdateService` and `Project::CreateService` classes already had code to determine whether the current user is allowed to use a given visibility level; now all visibility level validation is done in those classes.  Currently, when a non-admin tries to create or update a project using a restricted level, these classes silently set the visibility level to the global default (create) or the project's existing value (update).  I changed this behavior to be more like an Active Model validation, where using a restricted level causes the entire request to be rejected.

Project and personal snippets didn't have service classes, and restricted visibility levels weren't being enforced in the model or the controllers.  The UI disabled radio buttons for restricted levels, but that wouldn't be difficult to circumvent.  I created the `CreateSnippetService` and `UpdateSnippetService` classes to do the same restricted visibility check that the project classes do.  And since I was dealing with snippet visibility levels, I updated the API endpoints for project snippets to allow users to set and update the visibility level.

## TODO

* [x] Add more tests for restricted visibility functionality

cc @sytse @dzaporozhets

See merge request !1655
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Restricted visibility levels - bug fix and new feature

This allows admin users to override restricted visibility settings when creating and updating projects and snippets, and moves the restricted visibility configuration from gitlab.yml to the web UI.  See #1903.

## Move configuration location

I added a new section to the application settings page for restricted visibility levels.  Each level has a checkbox, styled with Bootstrap to look like a toggle button.  A checked box means that the level is restricted.  I added a glowing text shadow and changed the background color for checked buttons because the default styles made it hard to distinguish between checked and unchecked.  This image shows the new section with the "Public" box checked:

![restricted_visibility_settings](https://dev.gitlab.org/Okada/gitlabhq/uploads/629562e4313f89b795e81c3bb0f95893/restricted_visibility_settings.png)

## Allow admins to override

To allow admin users to override the restricted visibility levels, I had to remove the `visibility_level` validation from the `Project` class.  The model doesn't know about the `current_user`, which should determine whether the restrictions can be overridden.  We could use the creator in the validation, but that wouldn't work correctly for projects where a non-admin user is the creator and an admin tries to change the project to a restricted visibility level.

The `Project::UpdateService` and `Project::CreateService` classes already had code to determine whether the current user is allowed to use a given visibility level; now all visibility level validation is done in those classes.  Currently, when a non-admin tries to create or update a project using a restricted level, these classes silently set the visibility level to the global default (create) or the project's existing value (update).  I changed this behavior to be more like an Active Model validation, where using a restricted level causes the entire request to be rejected.

Project and personal snippets didn't have service classes, and restricted visibility levels weren't being enforced in the model or the controllers.  The UI disabled radio buttons for restricted levels, but that wouldn't be difficult to circumvent.  I created the `CreateSnippetService` and `UpdateSnippetService` classes to do the same restricted visibility check that the project classes do.  And since I was dealing with snippet visibility levels, I updated the API endpoints for project snippets to allow users to set and update the visibility level.

## TODO

* [x] Add more tests for restricted visibility functionality

cc @sytse @dzaporozhets

See merge request !1655
</pre>
</div>
</content>
</entry>
<entry>
<title>Use `project_member` instead of `team_member`.</title>
<updated>2015-03-15T12:50:38+00:00</updated>
<author>
<name>Douwe Maan</name>
<email>douwe@gitlab.com</email>
</author>
<published>2015-03-13T15:22:03+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/gitlab/gitlab-ce.git/commit/?id=31fc73f0a9b9225ba3737b9525fcf7a1695a45f2'/>
<id>31fc73f0a9b9225ba3737b9525fcf7a1695a45f2</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Use `group_member` instead of `users_group` or `membership`.</title>
<updated>2015-03-15T12:49:41+00:00</updated>
<author>
<name>Douwe Maan</name>
<email>douwe@gitlab.com</email>
</author>
<published>2015-03-13T15:16:51+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/gitlab/gitlab-ce.git/commit/?id=99f995755ef4b445216dd7baae35f5a4846ef30c'/>
<id>99f995755ef4b445216dd7baae35f5a4846ef30c</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Merge branch 'master' into fix-restricted-visibility</title>
<updated>2015-03-14T16:49:11+00:00</updated>
<author>
<name>Vinnie Okada</name>
<email>vokada@mrvinn.com</email>
</author>
<published>2015-03-14T16:49:11+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/gitlab/gitlab-ce.git/commit/?id=ad0ca0499ac81c68e9e8011d2e194b16c759c1d6'/>
<id>ad0ca0499ac81c68e9e8011d2e194b16c759c1d6</id>
<content type='text'>
Conflicts:
	db/schema.rb
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Conflicts:
	db/schema.rb
</pre>
</div>
</content>
</entry>
<entry>
<title>More restricted visibility changes</title>
<updated>2015-03-11T00:36:43+00:00</updated>
<author>
<name>Vinnie Okada</name>
<email>vokada@mrvinn.com</email>
</author>
<published>2015-03-11T00:21:09+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/gitlab/gitlab-ce.git/commit/?id=9623b71a3975bb442b85aa57146b788f96de6320'/>
<id>9623b71a3975bb442b85aa57146b788f96de6320</id>
<content type='text'>
Bug fixes and new tests for the restricted visibility changes.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Bug fixes and new tests for the restricted visibility changes.
</pre>
</div>
</content>
</entry>
<entry>
<title>Enforce restricted visibilities for snippets</title>
<updated>2015-03-08T23:57:08+00:00</updated>
<author>
<name>Vinnie Okada</name>
<email>vokada@mrvinn.com</email>
</author>
<published>2015-03-07T19:47:06+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/gitlab/gitlab-ce.git/commit/?id=928fc94c3d900069902b097d6464acee712a886c'/>
<id>928fc94c3d900069902b097d6464acee712a886c</id>
<content type='text'>
Add new service classes to create and update project and personal
snippets.  These classes are responsible for enforcing restricted
visibility settings for non-admin users.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Add new service classes to create and update project and personal
snippets.  These classes are responsible for enforcing restricted
visibility settings for non-admin users.
</pre>
</div>
</content>
</entry>
<entry>
<title>Allow admins to override restricted visibility</title>
<updated>2015-03-08T22:10:05+00:00</updated>
<author>
<name>Vinnie Okada</name>
<email>vokada@mrvinn.com</email>
</author>
<published>2015-03-07T18:23:43+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/gitlab/gitlab-ce.git/commit/?id=285c5341855f8af6cbea5e964e3104a4698fa450'/>
<id>285c5341855f8af6cbea5e964e3104a4698fa450</id>
<content type='text'>
Allow admins to use restricted visibility levels when creating or
updating projects.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Allow admins to use restricted visibility levels when creating or
updating projects.
</pre>
</div>
</content>
</entry>
<entry>
<title>use constant-time string compare for internal api authentication</title>
<updated>2015-03-06T19:06:26+00:00</updated>
<author>
<name>Jörg Thalheim</name>
<email>joerg@higgsboson.tk</email>
</author>
<published>2015-03-06T18:49:38+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/gitlab/gitlab-ce.git/commit/?id=9f089ac48c22b2f7cfbc7dd0ca29da924c566363'/>
<id>9f089ac48c22b2f7cfbc7dd0ca29da924c566363</id>
<content type='text'>
Ruby str_equal uses memcmp internally to compare String.
Memcmp is vunerable to timing attacks because it returns early
on mismatch (on most x32 platforms memcmp uses a bytewise comparision).
Devise.secure_compare implements a constant time comparision instead.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Ruby str_equal uses memcmp internally to compare String.
Memcmp is vunerable to timing attacks because it returns early
on mismatch (on most x32 platforms memcmp uses a bytewise comparision).
Devise.secure_compare implements a constant time comparision instead.
</pre>
</div>
</content>
</entry>
<entry>
<title>Merge branch 'project-existence-leak' into 'master'</title>
<updated>2015-03-03T20:05:12+00:00</updated>
<author>
<name>Dmitriy Zaporozhets</name>
<email>dzaporozhets@gitlab.com</email>
</author>
<published>2015-03-03T20:05:12+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/gitlab/gitlab-ce.git/commit/?id=8c47a72a4ed3df2327104e029307b5d804525886'/>
<id>8c47a72a4ed3df2327104e029307b5d804525886</id>
<content type='text'>
Don't leak information about private project existence via Git-over-SSH/HTTP.

Fixes #2040 and https://gitlab.com/gitlab-org/gitlab-ce/issues/343.

Both `Grack::Auth` (used by Git-over-HTTP) and `Api::Internal /allowed` (used by gitlab-shell/Git-over-SSH) now return a generic "Not Found" error when the project exists but the user doesn't have access to it.

See merge request !1578
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Don't leak information about private project existence via Git-over-SSH/HTTP.

Fixes #2040 and https://gitlab.com/gitlab-org/gitlab-ce/issues/343.

Both `Grack::Auth` (used by Git-over-HTTP) and `Api::Internal /allowed` (used by gitlab-shell/Git-over-SSH) now return a generic "Not Found" error when the project exists but the user doesn't have access to it.

See merge request !1578
</pre>
</div>
</content>
</entry>
<entry>
<title>Enable ParenthesesAsGroupedExpression rule</title>
<updated>2015-03-03T02:45:28+00:00</updated>
<author>
<name>Dmitriy Zaporozhets</name>
<email>dmitriy.zaporozhets@gmail.com</email>
</author>
<published>2015-03-03T02:45:28+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/gitlab/gitlab-ce.git/commit/?id=8348e1a9b57b042e97f14d3b4f7682806902efa1'/>
<id>8348e1a9b57b042e97f14d3b4f7682806902efa1</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
</feed>
