Commit Graph

134 Commits

Author SHA1 Message Date
Horatiu Eugen Vlad 0aa56d895d Added write_repository scope for personal access token 2019-04-15 13:05:55 +00:00
GotenXiao 7a1c810dc9 Fix #44332 - Add support for profile and email 2019-02-06 16:48:36 +00:00
Ash McKenzie 8ce86bf9a0
Revert "Revert "LfsToken uses JSONWebToken::HMACToken by default""
This reverts commit 00acef4340.
2018-12-17 17:17:39 +11:00
🤖 GitLab Bot 🤖 00acef4340 Revert "LfsToken uses JSONWebToken::HMACToken by default"
This reverts commit 22954f2202
2018-12-05 07:03:28 +00:00
Ash McKenzie 22954f2202
LfsToken uses JSONWebToken::HMACToken by default
LfsToken::HMACToken#token_valid?() will be examined and if false, look
in redis via LfsToken::LegacyRedisDeviseToken#token_valid?().
2018-12-05 15:22:37 +11:00
Robert Speicher c847f172d2 Merge branch 'fix_pat_auth-11-4' into 'security-11-4'
[11.4] Fix Token lookup for Git over HTTP and registry authentication

See merge request gitlab/gitlabhq!2577
2018-10-29 17:20:53 +01:00
gfyoung c858f70d07 Enable frozen string for lib/gitlab/*.rb 2018-10-22 07:00:50 +00:00
Yorick Peterse 2039c8280d
Disable existing offenses for the CodeReuse cops
This whitelists all existing offenses for the various CodeReuse cops, of
which most are triggered by the CodeReuse/ActiveRecord cop.
2018-09-11 17:32:00 +02:00
Lin Jen-Shin d0afab482f Disable SAML if OmniAuth is disabled
We also try to unify the way we setup OmniAuth, and how we check
if it's enabled or not.
2018-07-20 18:54:46 +08:00
Kamil Trzciński 1e3cea1a0f Bring back the EE changes to CE to authentication of builds 2018-06-04 22:25:46 +02:00
Lin Jen-Shin 1e2b6cf514 Introduce Gitlab::Auth.omniauth_setup_providers
Which could extend from EE
2018-06-01 14:30:10 +08:00
Lin Jen-Shin 39b6f31c66 Eliminate constants warnings by:
* Replace `require` or `require_relative` with `require_dependency`
* Remove unneeded `autoload`
2018-06-01 13:46:46 +08:00
🙈 jacopo beschi 🙉 c6b1043e9d Resolve "Make a Rubocop that forbids returning from a block" 2018-04-18 09:19:40 +00:00
Kamil Trzciński b38439a3ae Use proper auth_scope for deploy token 2018-04-07 10:35:00 +02:00
Mayra Cabrera c4f56a8802 Increase test suite around deploy tokens behavior
Also, fixes broken specs
2018-04-06 21:20:17 -05:00
Mayra Cabrera a475411f43 Fixes broken schema and minor changes 2018-04-06 21:20:16 -05:00
Mayra Cabrera 8315861c9a Include ProjectDeployTokens
Also:
- Changes scopes from serializer to use boolean columns
- Fixes broken specs
2018-04-06 21:20:16 -05:00
Kamil Trzciński 72220a99d1 Support Deploy Tokens properly without hacking abilities 2018-04-06 21:20:16 -05:00
Mayra Cabrera 171b2625b1 Addreses backend review suggestions
- Remove extra method for authorize_admin_project
- Ensure project presence
- Rename 'read_repo' to 'read_repository' to be more verbose
2018-04-06 21:20:16 -05:00
Mayra Cabrera 7deab31722 Removes logic from Jwt and handle different scenarios on Gitlab::Auth
- When using 'read_repo' password and project are sent, so we used both
  of them to fetch for the token
- When using 'read_registry' only the password is sent, so we only use
  that for fetching the token
2018-04-06 21:20:16 -05:00
Mayra Cabrera 370fc05da7 Implement 'read_repo' for DeployTokens
This will allow to download a repo using the token from the DeployToken
2018-04-06 21:20:16 -05:00
Horatiu Eugen Vlad 7d01792614 Fix LDAP login without user in DB 2018-03-27 09:21:17 +02:00
Horatiu Eugen Vlad 6d3cb7e22e Make oauth provider login generic 2018-03-05 22:26:40 +00:00
Horatiu Eugen Vlad 1ad5df49b1 Moved o_auth/saml/ldap modules under gitlab/auth 2018-02-28 16:53:02 +01:00
Mario de la Ossa eaada9d706 use Gitlab::UserSettings directly as a singleton instead of including/extending it 2018-02-02 18:39:55 +00:00
Sean McGivern 89c9d2ad6b Merge branch 'dm-fix-registry-with-sudo-token' into 'master'
Fix pulling and pushing using a personal access token with the sudo scope

Closes #40466

See merge request gitlab-org/gitlab-ce!15571
2017-11-24 09:09:38 +00:00
Douwe Maan 453b178093 Fix pulling and pushing using a personal access token with the sudo scope 2017-11-23 16:32:08 +01:00
Markus Koller 257fd57134 Allow password authentication to be disabled entirely 2017-11-23 13:16:14 +00:00
Stan Hu 0232450c8a Fix Error 500 when pushing LFS objects with a write deploy key 2017-11-08 16:21:39 +00:00
Douwe Maan 3f24f9ed18 Add sudo API scope 2017-11-02 11:39:03 +01:00
Douwe Maan a1781a4941 Consistently use PersonalAccessToken instead of PersonalToken 2017-11-02 11:39:02 +01:00
Robin Bobbitt 0013e6c00d Clean up read_registry scope changes
Closes #37789
2017-09-18 08:39:01 -04:00
Kamil Trzciński 2602cc0c36 Merge branch 'hide-read-registry-scope-when-registry-disabled' into 'master'
Hide read_registry scope when registry is disabled on instance

See merge request !13314
2017-09-12 09:57:48 +00:00
Douwe Maan 7d3e888d06 Merge branch '37202-revert-changes-to-signing-enabled' into 'master'
Rollback changes made to signing_enabled.

Closes #37202

See merge request !13956
2017-09-01 11:49:22 +00:00
Tiago Botelho 37383d9a9d Rollsback changes made to signing_enabled. 2017-09-01 10:51:40 +01:00
Sean McGivern 5883ce95ef `current_application_settings` belongs on `Gitlab::CurrentSettings`
The initializers including this were doing so at the top level, so every object
loaded after them had a `current_application_settings` method. However, if
someone had rack-attack enabled (which was loaded before these initializers), it
would try to load the API, and fail, because `Gitlab::CurrentSettings` didn't
have that method.

To fix this:

1. Don't include `Gitlab::CurrentSettings` at the top level. We do not need
   `Object.new.current_application_settings` to work.
2. Make `Gitlab::CurrentSettings` explicitly `extend self`, as we already use it
   like that in several places.
3. Change the initializers to use that new form.
2017-08-31 13:38:33 +01:00
Robin Bobbitt 62ef67acc3 Hide read_registry scope when registry is disabled on instance 2017-08-21 18:13:32 -04:00
Robert Speicher 260c8da060 Whitelist or fix additional `Gitlab/PublicSend` cop violations
An upcoming update to rubocop-gitlab-security added additional
violations.
2017-08-14 12:14:11 -04:00
Lin Jen-Shin b3e058996c Cleanup tests and add admin_container_image to
full_authentication_abilities. This is fine because
we're going to check with can?(..) anyway
2017-08-02 17:51:29 +08:00
Robin Bobbitt 672a68d372 Fixes needed when GitLab sign-in is not enabled
When sign-in is disabled:
 - skip password expiration checks
 - prevent password reset requests
 - don’t show Password tab in User Settings
 - don’t allow login with username/password for Git over HTTP requests
 - render 404 on requests to Profiles::PasswordsController
2017-07-13 10:08:27 -04:00
Timothy Andrew afbc7520c2 `AccessTokenValidationService` accepts `String` or `API::Scope` scopes.
- There's no need to use `API::Scope` for scopes that don't have `if`
  conditions, such as in `lib/gitlab/auth.rb`.
2017-06-30 07:32:25 +00:00
Timothy Andrew b8ec1f4201 Extract a `Gitlab::Scope` class.
- To represent an authorization scope, such as `api` or `read_user`
- This is a better abstraction than the hash we were previously using.
2017-06-29 06:15:57 +00:00
Timothy Andrew c1fcd730cc Implement review comments from @DouweM for !12300.
- Use a struct for scopes, so we can call `scope.if` instead of `scope[:if]`

- Refactor the "remove scopes whose :if condition returns false" logic to use a
  `select` rather than a `reject`.
2017-06-28 07:17:13 +00:00
Timothy Andrew 1b8223dd51 Fix remaining spec failures for !12300.
1. Get the spec for `lib/gitlab/auth.rb` passing.

  - Make the `request` argument to `AccessTokenValidationService` optional -
  `auth.rb` doesn't need to pass in a request.

  - Pass in scopes in the format `[{ name: 'api' }]` rather than `['api']`, which
  is what `AccessTokenValidationService` now expects.

2. Get the spec for `API::V3::Users` passing

2. Get the spec for `AccessTokenValidationService` passing
2017-06-28 07:17:13 +00:00
Robin Bobbitt cb5a5eb892 Instruct user to use a personal access token for Git over HTTP
If internal auth is disabled and LDAP is not configured on the instance,
present the user with a message to create a personal access token if his
Git over HTTP auth attempt fails.
2017-06-07 21:12:51 -04:00
Z.J. van de Weg 9fcc3e5982 Fix test failures 2017-06-06 16:19:15 +02:00
Z.J. van de Weg 0b81b5ace0 Create read_registry scope with JWT auth
This is the first commit doing mainly 3 things:
1. create a new scope and allow users to use it
2. Have the JWTController respond correctly on this
3. Updates documentation to suggest usage of PATs

There is one gotcha, there will be no support for impersonation tokens, as this
seems not needed.

Fixes gitlab-org/gitlab-ce#19219
2017-06-05 12:26:49 +02:00
Horatiu Eugen Vlad 9735ce15de Avoid resource intensive login checks if password is not provided
Fixes #32598
2017-05-21 17:58:32 +02:00
Timothy Andrew bee780e8fd Allow OAuth clients to push code
- We currently support fetching code with username = 'oauth2' and
  password = <access_token>.
- Trying to _push_ code with the same credentials fails with an authentication
  error.
- There's no reason this shouldn't be enabled, especially since we allow the
  OAuth client to create deploy keys with push access:

  https://docs.gitlab.com/ce/api/deploy_keys.html#add-deploy-key
2017-04-13 13:13:22 +00:00
Sean McGivern de37dcee90 Merge branch 'siemens/gitlab-ce-feature/openid-connect' 2017-03-07 16:16:08 +00:00