Commit Graph

90 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
Mark Chao 9d046c8704 Fix git clone revealing private repo's presence
Ensure redirection to path with .git suffix regardless whether project
exists or not.
2019-02-19 13:59:24 +08:00
Stan Hu aff2b6e4eb Switch use of Rack::Request to ActionDispatch::Request
As mentioned in
https://gitlab.com/gitlab-org/gitlab-ee/issues/9035#note_129093444,
Rails 5 switched ActionDispatch::Request so that it no longer inherits
Rack::Request directly. A middleware that uses Rack::Request to
read the environment may see stale request parameters if
another middleware modifies the environment via ActionDispatch::Request.
To be safe, we should be using ActionDispatch::Request everywhere.
2019-01-07 00:35:53 -08:00
blackst0ne b44a2c801a Update specs to rails5 format
Updates specs to use new rails5 format.

The old format:
`get :show, { some: params }, { some: headers }`

The new format:
`get :show, params: { some: params }, headers: { some: headers }`
2018-12-19 10:04:31 +11:00
Francisco Javier López 6ed50b62e7 CE port Refactor Gitlab::Checks::ChangeAccess class 2018-12-04 11:55:49 +00:00
Tiago Botelho 0fd901bddd Disables Rack Attack by default 2018-07-25 09:43:44 +01:00
Imre Farkas c62fce9883
Delete UserActivities and related workers 2018-07-18 15:44:10 +02:00
Mark Chao a63bce1a4b Resolve "Rename the `Master` role to `Maintainer`" Backend 2018-07-11 14:36:08 +00:00
Bob Van Landuyt 698515313f Fixes rejected pushes from maintainers
Before the push git would make a call to
`/:namespace/:project/git-receive-pack`. This would perform an access
check without a ref. So the `Project#branch_allows_maintainer_push?`
would return false.

This adjusts `Project#branch_allows_maintainer_push?` to return true
when passing no branch name if there are merge requests open that
would allow the user to push.

The actual check then happens when a call to
`/api/v4/internal/allowed` is made from a git hook.
2018-06-11 17:35:13 +02:00
Bob Van Landuyt e0768a9bcb Allow triggered builds git access
Allow builds that have been triggered by a user before terms were
enforced access to git. That way the builds can complete as usual.
2018-05-11 15:20:11 +02:00
Bob Van Landuyt ce69419a60 Remove permanent redirects
Removes permanent redirects, this means that redirects will only be
possible as long as the old route isn't taken by a new project/group.
2018-03-28 14:12:08 +02:00
Jacob Vosmaer (GitLab) c43e18fc49 Remove some easy cases of 'path_to_repo' use 2018-03-28 09:21:32 +00: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
Michael Kozono 4be20ba923 Respond 404 when repo does not exist 2018-02-24 16:22:29 -08:00
Jacob Vosmaer (GitLab) ea18e1bf28 Fix repo existence check in GitAccessWiki 2018-02-22 00:20:30 +00:00
Nick Thomas 6b0c6e69e1
Use hashed storage in the specs 2018-02-07 13:40:46 +00:00
Tiago Botelho 8b4280cb25 Check ability ability before proceeding with project specific checks 2018-02-06 18:38:10 +00:00
Tiago Botelho dc229c076c Abstracts ProjectMoved and ProjectCreated into a BaseProject 2018-02-06 13:35:35 +00:00
Tiago Botelho bc78ae6985 Add specs 2018-02-06 13:35:35 +00:00
blackst0ne 27c95364b5 Replace '.team << [user, role]' with 'add_role(user)' in specs 2017-12-22 19:18:28 +11:00
Mayra Cabrera 562fb460b8 Allow git pull/push on project redirects 2017-12-08 17:42:43 +00:00
Markus Koller 257fd57134 Allow password authentication to be disabled entirely 2017-11-23 13:16:14 +00:00
Jacopo 2f40dac352 Refactor `have_http_status` into `have_gitlab_http_status` in the specs 2017-10-20 10:13:18 +02:00
Robert Speicher 72a7b30c9f Change all `:empty_project` to `:project` 2017-08-02 17:47:31 -04:00
Gabriel Mazetto fb06a4d8fe Rename more path_with_namespace -> full_path or disk_path 2017-08-01 07:28:13 +02:00
Rémy Coutable ddccd24c13 Remove superfluous lib: true, type: redis, service: true, models: true, services: true, no_db: true, api: true
Signed-off-by: Rémy Coutable <remy@rymai.me>
2017-07-27 14:31:53 +02:00
Sean McGivern 1afdbe320e Merge branch 'fixes-for-internal-auth-disabled' into 'master'
Fixes needed when GitLab sign-in is not enabled

See merge request !12491
2017-07-14 08:49:36 +00: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
Paul Charlton cb3b4a15e6 Support multiple Redis instances based on queue type 2017-07-11 03:35:47 +00:00
Grzegorz Bizon 0430b76441 Enable Style/DotPosition Rubocop 👮 2017-06-21 13:48:12 +00:00
Michael Kozono 32b3d09ae5 Add specific test case
This test and its context exist only to ensure this behavior is fixed: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/11259#note_29262426
2017-06-16 14:14:19 -07:00
Michael Kozono 8ef3bc5d75 Add “Project moved” error to Git-over-HTTP 2017-06-16 14:14:19 -07:00
Robert Speicher a6ec5121f0 Correct RSpec/SingleLineHook cop offenses 2017-06-14 13:18:56 -05:00
Rémy Coutable ce37a209c6 Merge branch 'pat-msg-on-auth-failure' into 'master'
Prompt user to create personal access token for Git over HTTP

See merge request !11986
2017-06-09 14:34:10 +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
Douwe Maan dbffaaa97e Blob#load_all_data! doesn’t need an argument 2017-06-07 14:28:33 -05:00
Michael Kozono e8972c1190 Clarify error messages
And refactor to self-document a little better.
2017-06-05 05:32:26 -07:00
Michael Kozono bad08fbea2 Move CI access logic into GitAccess 2017-06-05 05:32:26 -07:00
Michael Kozono ff8a053d5d Fix Git over HTTP spec
* The spec has 7 failures at this point
* Specify rendered error messages
* Render the GitAccess message rather than “Access denied”
* Render the Not Found message provided by GitAccess, instead of a custom one
* Expect GitAccess to check the config for whether Git-over-HTTP pull or push is disabled, rather than doing it in the controller
* Add more thorough testing for authentication
* Dried up a lot of tests
* Fixed some broken tests
2017-06-05 05:32:26 -07:00
Rémy Coutable df65e4376e Merge branch '30305-oauth-token-push-code' into 'master'
Allow OAuth clients to push code

Closes #30305

See merge request !10677
2017-04-24 16:31:32 +00:00
Sean McGivern ae833a8b83 Fix user activities HTTP clone spec 2017-04-17 14:23:39 +01:00
Rémy Coutable 9bb9cbfd93
Use a proper matcher
Signed-off-by: Rémy Coutable <remy@rymai.me>
2017-04-14 17:32:09 +02:00
Rémy Coutable 41b71efd51 Fix `last_activity_at` to `last_activity_on`
Signed-off-by: Rémy Coutable <remy@rymai.me>
2017-04-14 15:20:55 +02:00
Sean McGivern 4b1e25faae Fix git HTTP spec 2017-04-14 15:20:55 +02:00
James Lopez 2951a8543e Add user activity service and spec. Also added relevant - NOT offline - migration
It uses a user activity table instead of a column in users.
Tested with mySQL and postgreSQL
2017-04-14 15:20:55 +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
Markus Koller 93daeee164 Don't allow blocked users to authenticate through other means
Gitlab::Auth.find_with_user_password is currently used in these places:

- resource_owner_from_credentials in config/initializers/doorkeeper.rb,
  which is used for the OAuth Resource Owner Password Credentials flow

- the /session API call in lib/api/session.rb, which is used to reveal
  the user's current authentication_token

In both cases users should only be authenticated if they're in the
active state.
2017-03-07 15:00:29 +01:00
Semyon Pupkov 3deb66ea56 Add traits for ProjectFeatures to Project factory
https://gitlab.com/gitlab-org/gitlab-ce/issues/24007
2017-02-05 13:11:45 +05:00
Robert Speicher 9a31ecbef2 Use `:empty_project` where possible in request specs 2017-01-26 18:52:10 -05:00