Commit Graph

65 Commits

Author SHA1 Message Date
GitLab Bot 3849f5bb99 Add latest changes from gitlab-org/gitlab@master 2023-08-08 18:10:59 +00:00
GitLab Bot 07f6ded1cb Add latest changes from gitlab-org/gitlab@master 2023-05-31 12:07:08 +00:00
GitLab Bot 50ea04b6c6 Add latest changes from gitlab-org/gitlab@master 2023-01-20 12:10:00 +00:00
GitLab Bot d588fa9e6e Add latest changes from gitlab-org/gitlab@master 2022-07-21 00:08:45 +00:00
GitLab Bot 099333e261 Add latest changes from gitlab-org/gitlab@master 2021-03-18 00:08:58 +00:00
GitLab Bot 6c3cbf7063 Add latest changes from gitlab-org/gitlab@master 2021-01-01 15:10:11 +00:00
GitLab Bot 3940f59a61 Add latest changes from gitlab-org/gitlab@master 2020-10-16 15:08:46 +00:00
GitLab Bot 0b4bb101ea Add latest changes from gitlab-org/gitlab@master 2020-10-01 18:10:20 +00:00
GitLab Bot 8e35232810 Add latest changes from gitlab-org/gitlab@master 2020-09-02 15:10:54 +00:00
GitLab Bot 85f7fa54f4 Add latest changes from gitlab-org/gitlab@master 2020-08-18 18:10:10 +00:00
GitLab Bot 778ea71394 Add latest changes from gitlab-org/gitlab@master 2020-07-13 09:09:29 +00:00
GitLab Bot 2c0e92d031 Add latest changes from gitlab-org/gitlab@master 2020-07-02 21:09:14 +00:00
GitLab Bot 777f6da99a Add latest changes from gitlab-org/gitlab@master 2020-06-29 21:09:07 +00:00
GitLab Bot 0e65189f85 Add latest changes from gitlab-org/gitlab@master 2020-05-13 09:08:37 +00:00
GitLab Bot 2e4d8b3449 Add latest changes from gitlab-org/gitlab@master 2020-04-28 03:09:53 +00:00
GitLab Bot f569792df8 Add latest changes from gitlab-org/gitlab@master 2020-04-27 18:09:41 +00:00
GitLab Bot 1a0d6dbdc2 Add latest changes from gitlab-org/gitlab@master 2020-04-01 12:08:00 +00:00
GitLab Bot 988b28ec1a Add latest changes from gitlab-org/gitlab@master 2020-03-02 12:07:57 +00:00
GitLab Bot b86f474bf5 Add latest changes from gitlab-org/gitlab@master 2019-12-11 12:08:10 +00:00
GitLab Bot 115c8ea7af Add latest changes from gitlab-org/gitlab@master 2019-12-10 18:08:04 +00:00
GitLab Bot 5707f305f4 Add latest changes from gitlab-org/gitlab@master 2019-09-26 12:06:00 +00:00
GitLab Bot b7dfe2ae40 Add latest changes from gitlab-org/gitlab@master 2019-09-13 13:26:31 +00:00
Imre Farkas bd3a484032
Add config to disable impersonation
Adds gitlab.impersonation_enabled config option defaulting to true to
keep the current default behaviour.

Only the act of impersonation is modified, impersonation token
management is not affected.
2018-11-29 09:37:16 +01:00
gfyoung 3836d69119 Enable frozen string in lib/api and lib/backup
Partially addresses #47424.

Had to make changes to spec files because
stubbing methods on frozen objects is a mess
in RSpec and leads to failures:

https://github.com/rspec/rspec-mocks/issues/1190
2018-09-29 21:04:50 -07:00
Jacopo c6bddeacf4 Updates code using class_methods over module ClassMethods 2018-08-29 16:56:34 +02:00
Bob Van Landuyt f7f13f9db0 Block access to API & git when terms are enforced
When terms are enforced, but the user has not accepted the terms
access to the API & git is rejected with a message directing the user
to the web app to accept the terms.
2018-05-10 17:02:27 +02:00
Lin Jen-Shin bd132dfe72 Make find_user_from_sources extensible for EE 2018-02-05 17:44:23 +08:00
Francisco Lopez 7f0317917a Changes after rebase 2017-11-17 10:09:56 +01:00
Francisco Lopez 1436598e49 Moved Exceptions to Gitlab::Auth 2017-11-17 10:02:11 +01:00
Francisco Lopez aa84ef1e1a Moving exceptions to UserAuthFinders 2017-11-17 10:02:11 +01:00
Francisco Lopez f189657523 Added some more comments 2017-11-17 10:02:11 +01:00
Francisco Lopez 21153a4f47 Homogenising the type of the request handled by UserAuthFinder. Also tests fixed 2017-11-17 10:02:11 +01:00
Francisco Lopez aecc3eb080 Applied some code review comments 2017-11-17 10:02:10 +01:00
Francisco Lopez 374179a970 Removing private token 2017-11-17 10:01:21 +01:00
Francisco Lopez 41ebd06ddc Some fixes after rebase 2017-11-17 10:01:20 +01:00
Francisco Lopez 470b5dc326 Updated refactor and pushing to see if test fails 2017-11-17 10:00:48 +01:00
Francisco Lopez d948e67913 First refactor 2017-11-17 10:00:08 +01:00
Lin Jen-Shin (godfat) 258bf3e187 Add Gitlab::Utils::StrongMemoize 2017-11-13 15:27:30 +00:00
Douwe Maan 3f24f9ed18 Add sudo API scope 2017-11-02 11:39:03 +01:00
Douwe Maan 294fa6fcdc Remove authentication using user.private_token 2017-11-02 11:39:02 +01:00
Douwe Maan 025c6eeaa1 Move all API authentication code to APIGuard 2017-10-12 11:13:37 +02:00
Douwe Maan b6c5a73c0b Make sure API responds with 401 when invalid authentication info is provided 2017-09-28 14:17:52 +02: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
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 4dbfa14e16 Implement review comments from @dbalexandre for !12300. 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
Timothy Andrew d774825f98 When verifying scopes, manually include scopes from `API::API`.
- They are not included automatically since `API::Users` does not inherit from
  `API::API`, as I initially assumed.

- Scopes declared in `API::API` are considered global (to the API), and need to
  be included in all cases.
2017-06-28 07:17:13 +00:00
Timothy Andrew 80c1ebaa83 Allow API scope declarations to be applied conditionally.
- Scope declarations of the form:

    allow_access_with_scope :read_user, if: -> (request) { request.get? }

  will only apply for `GET` requests

- Add a negative test to a `POST` endpoint in the `users` API to test this. Also
  test for this case in the `AccessTokenValidationService` unit tests.
2017-06-28 07:17:13 +00:00
Timothy Andrew 6f1922500b Initial attempt at refactoring API scope declarations.
- Declaring an endpoint's scopes in a `before` block has proved to be
  unreliable. For example, if we're accessing the `API::Users` endpoint - code
  in a `before` block in `API::API` wouldn't be able to see the scopes set in
  `API::Users` since the `API::API` `before` block runs first.

- This commit moves these declarations to the class level, since they don't need
  to change once set.
2017-06-28 07:17:13 +00:00