Commit Graph

100 Commits

Author SHA1 Message Date
Ahmad Sherif 52bfd06462 Use relative git object paths to construct absolute ones before setting Env 2017-11-14 20:26:39 +01:00
David Turner 01ce58bde4 add username to authorized result, so that gitlab-shell can pass it to hooks 2017-09-29 18:16:55 -04:00
James Lopez 67d06dee30 refactor users update service 2017-09-28 08:46:39 +02:00
James Lopez 9621dd0c9d refactor services to match EE signature 2017-09-28 08:46:39 +02:00
Alejandro Rodríguez ff3eeffa08 Implement /internal/pre-receive for shell operations 2017-09-05 20:12:25 -03:00
Alejandro Rodríguez 8323e55b6c Return a value to check if redis is available on /internal/check 2017-09-05 20:12:18 -03:00
Alejandro Rodríguez eaf60bb544 Implement /internal/post_receive unified endpoint for PostReceive tasks 2017-08-31 11:31:45 -03:00
Andrew Newdigate a89f18bf2c Renamed Gitaly services 2017-07-18 07:59:36 +00:00
Stan Hu 0e23d1a74f Handle case when BroadcastMessage.current is nil
Somehow Rails.cache.fetch occasionally returns `nil` values, which causes
this endpoint to crash.

Closes #35094
2017-07-13 21:38:26 -07:00
Kim "BKC" Carlbäcker 8b074b4e78 Send Gitaly Repository with /api/internal/allowed
- Make single gitaly payload
- Add feature-flag specs to verify payload
2017-07-07 22:24:16 +02:00
James Lopez b33c638483 update code based on feedback 2017-06-23 17:11:31 +02:00
James Lopez b804db2648 refactor update user service not to do auth checks 2017-06-23 11:41:43 +02:00
James Lopez c9fd3dc42c more refactoring based on feedback 2017-06-23 11:41:42 +02:00
James Lopez 158550cf37 added service in the rest of controllers and classes 2017-06-23 11:41:42 +02:00
Matt Walsh 02ad2841d8 Allow discover by userid - issue 28517 2017-06-20 08:53:28 -06:00
Michael Kozono af784cc6e2 Add “Project moved” error to Git-over-SSH 2017-06-16 14:14:19 -07:00
Mike Ricketts 03b2ac659e #13336 - display multiple messages in both the UI and git output 2017-06-15 13:47:33 +00:00
Michael Kozono ef4e913597 Remove unnecessary variable 2017-06-05 10:39:32 -07:00
Michael Kozono b50a22894d Refactor construction of response 2017-06-05 05:32:26 -07:00
Michael Kozono 23d37382da Refactor to let GitAccess errors bubble up
No external behavior change.

This allows `GitHttpController` to set the HTTP status based on the type of error. Alternatively, we could have added an attribute to GitAccessStatus, but this pattern seemed appropriate.
2017-06-05 05:32:26 -07:00
Alejandro Rodríguez de33a5bd53 Prevent errors from non-functional notify_post_receive endpoint 2017-05-18 15:33:43 -04:00
Rémy Coutable d40e1f547e Enable the Style/TrailingCommaInLiteral cop
Use the EnforcedStyleForMultiline: no_comma option.

Signed-off-by: Rémy Coutable <remy@rymai.me>
2017-05-10 18:25:45 +02:00
Alejandro Rodríguez 8bc381db90 Pass GL_REPOSITORY in Workhorse responses 2017-05-05 10:52:06 -03:00
Alejandro Rodríguez c45341c816 Generate and handle a gl_repository param to pass around components
This new param allows us to share project information between components
that don't share or don't have access to the same filesystem
mountpoints, for example between Gitaly and Rails or between Rails and
Gitlab-Shell hooks. The previous parameters are still supported, but if
found, gl_repository is prefered. The old parameters should be deprecated
once all components support the new format.
2017-05-03 17:37:30 -03:00
Luigi Leoni 615a77df83 Wrong method call on notify_post_receive. 2017-04-27 09:33:48 +02:00
Sean McGivern 380e40fee3 Remove unused user activities code 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
Rémy Coutable 710cd82cc1 Set Git-specific env in /api/internal/allowed
Signed-off-by: Rémy Coutable <remy@rymai.me>
2017-04-10 16:10:18 +02:00
Jacob Vosmaer 20d415a676 Use Gitlab::Git::Repository#gitaly_... more 2017-04-07 12:53:30 +02:00
Alejandro Rodríguez 267cd3e359 Incorporate Gitaly client for refs service 2017-04-04 16:53:44 +02:00
Jacob Vosmaer 8f50ef5e75 Separate GRPC channels per repository storage 2017-03-29 14:48:05 +02:00
Alejandro Rodríguez f8fa6e6f47 Add internal endpoint to notify post-receive to Gitaly 2017-03-01 18:46:59 -03:00
Vincent Wong b6df93a51f Record and show last used date of SSH Keys
Addresses: Issue #13810

1. Adds a last_used_at attribute to the Key table/model
2. Update a key's last_used_at whenever it gets used
3. Display how long ago an ssh key was last used
2017-01-09 04:15:39 +11:00
Timothy Andrew f82d549d26 Accept environment variables from the `pre-receive` script.
1. Starting version 2.11, git changed the way the pre-receive flow works.

  - Previously, the new potential objects would be added to the main repo. If the
    pre-receive passes, the new objects stay in the repo but are linked up. If
    the pre-receive fails, the new objects stay orphaned in the repo, and are
    cleaned up during the next `git gc`.

  - In 2.11, the new potential objects are added to a temporary "alternate object
    directory", that git creates for this purpose. If the pre-receive passes, the
    objects from the alternate object directory are migrated to the main repo. If
    the pre-receive fails the alternate object directory is simply deleted.

2. In our workflow, the pre-recieve script (in `gitlab-shell) calls the
   `/allowed` endpoint, which calls out directly to git to perform
   various checks. These direct calls to git do _not_ have the necessary
   environment variables set which allow access to the "alternate object
   directory" (explained above). Therefore these calls to git are not able to
   access any of the new potential objects to be added during this push.

3. We fix this by accepting the relevant environment variables
   (GIT_ALTERNATE_OBJECT_DIRECTORIES, GIT_OBJECT_DIRECTORY) on the
   `/allowed` endpoint, and then include these environment variables while
   calling out to git.

4. This commit includes (whitelisted) these environment variables while making
   the "force push" check. A `Gitlab::Git::RevList` module is extracted to
   prevent `ForcePush` from being littered with these checks.
2016-12-16 23:32:25 +05:30
Nick Thomas 1c994dbc05 Fix POST /internal/allowed to cope with gitlab-shell v4.0.0 project paths
gitlab-shell v3.6.6 would give project paths like so:

* namespace/project

gitlab-shell v4.0.0 can give project paths like so:

* /namespace1/namespace2/project
* /namespace/project
* /path/to/repository/storage/namespace1/namespace2/project
* /path/to/repository/storage/namespace/project
2016-11-16 14:30:56 +00:00
Dmitriy Zaporozhets 440604ad1b
Refactor storage path extraction from full repo path
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2016-10-28 15:55:55 +03:00
Dmitriy Zaporozhets 3095ac0ca4 Make internal api work with full repo path instead of name
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2016-10-27 16:54:48 +03:00
Patricio Cano 2772109ac1 Handle LFS token creation and retrieval in the same method, and in the same Redis connection.
Reset expiry time of token, if token is retrieved again before it expires.
2016-09-28 12:13:48 -05:00
Kamil Trzcinski 3c1bb3432b Revert "Revert all changes introduced by https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/6043"
This reverts commit 6d43c95b70.
2016-09-19 16:34:32 +02:00
Kamil Trzcinski 6d43c95b70 Revert all changes introduced by https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/6043 2016-09-19 13:45:28 +02:00
Kamil Trzcinski e941365f3b Rename capabilities to authentication_abilities 2016-09-16 11:12:21 +02:00
Kamil Trzcinski 83b643a014 Merge remote-tracking branch 'origin/lfs-support-for-ssh' into per-build-token
# Conflicts:
#	app/controllers/projects/git_http_client_controller.rb
#	app/helpers/lfs_helper.rb
#	lib/gitlab/auth.rb
#	spec/requests/lfs_http_spec.rb
2016-09-15 21:16:38 +02:00
Patricio Cano c144db2935 Better authentication handling, syntax fixes and better actor handling for LFS Tokens 2016-09-15 12:21:00 -05:00
Patricio Cano c25630ee2c Refactored handling of the `LfsToken` and added functionality to it to simplify external code. 2016-09-15 12:21:00 -05:00
Patricio Cano 48f1a61fd5 Refactored LFS auth logic when using SSH to use its own API endpoint `/lfs_authenticate` and added tests. 2016-09-15 12:21:00 -05:00
Patricio Cano cb85cf1f0a Refactor LFS token logic to use a Redis key instead of a DB field, making it a 1 use only token. 2016-09-15 12:21:00 -05:00
Patricio Cano e40e3fdc82 Added LFS support to SSH
- Required on the GitLab Rails side is mostly authentication and API related.
2016-09-15 12:21:00 -05:00
Kamil Trzcinski 9d1ccd2ad3 Fix existing authorization specs 2016-09-15 13:49:11 +02:00
Kamil Trzcinski 11f87700e8 Add access specs 2016-09-15 11:57:09 +02:00
Drew Blessing 8b6154c145 Minor edits to two_factor_recovery_codes API error catching 2016-08-31 19:41:55 -05:00