summaryrefslogtreecommitdiff
path: root/lib/gitlab_net.rb
Commit message (Collapse)AuthorAgeFilesLines
* Custom Action supportash.mckenzie/custom-action-supportAsh McKenzie2018-09-081-3/+3
|
* GitAccessStatus initializer sensible defaultsAsh McKenzie2018-09-071-8/+1
|
* Move some GitlabNet requires into HTTPHelperAsh McKenzie2018-09-071-2/+0
|
* /api/v4/allowed returns proper HTTP status codesAsh McKenzie2018-09-071-1/+2
| | | | | * Previously, a 200 (OK) was sent when the user was unauthorised or the project was not found (or the user didn't have access) * We still treat 401 and 404 as 'success' but we need to explicitly handle them
* Fix handling non 200 response codeszj-fix-non-200-resp-codeZeger-Jan van de Weg2018-09-051-1/+0
| | | | | | | | | After the cleanup in https://gitlab.com/gitlab-org/gitlab-shell/merge_requests/231 gitlab-shell mishandled the non 200 response codes. This commit removes another few lines of codes, which fixes this. Also now we test against this case through mocking. Fixes https://gitlab.com/gitlab-org/gitlab-shell/issues/152
* Restore "Pass custom git_config_options to Gitalyo"Nick Thomas2018-08-141-0/+1
| | | | This reverts commit 764f6f47fa6a8698ae033532ae49875a87030518.
* Revert "Merge branch 'ash.mckenzie/srp-refactor' into 'master'"Nick Thomas2018-08-141-55/+94
| | | | | This reverts commit 3aaf4751e09262c53544a1987f59b1308af9b6c1, reversing changes made to c6577e0d75f51b017f2f332838b97c3ca5b497c0.
* GitlatNet#discover only parse JSON if a 200Ash McKenzie2018-08-011-1/+1
|
* Merge remote-tracking branch 'origin/master' into ash.mckenzie/srp-refactorAsh McKenzie2018-08-011-7/+10
|\
| * Add support for SSH certificate authenticationÆvar Arnfjörð Bjarmason2018-07-261-17/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This along with the code submitted to gitlab-ce in the gitlab-org/gitlab-ce! MR implements SSH certificate authentication. See the docs added to gitlab-ce for why and how to enable this. This, along with that MR, closes gitlab-org/gitlab-ce#3457 Implementation notes: - Because it's easy to do, and because an earlier nascent version of this would pass user-ID to gitlab-shell, that's now supported, even though the SSH certificate authentication uses username-USERNAME. - The astute reader will notice that not all the API calls in gitlab-ce's lib/api/internal.rb support a "username" argument, some only support "user_id". There's a few reasons for this: a) For this to be efficient, I am bending over backwards to avoid extra API calls when using SSH certificates. Therefore the /allowed API call will now return a "user id" to us if we're allowed to proceed further. This is then fed to existing APIs that would only be called after a successful call to /allowed. b) Not all of the git-shell codepaths go through /internal/allowed, or ever deal with a repository, e.g. the argument-less "Welcome to GitLab", and /internal/2fa_recovery_codes. These need to use /internal/discover to figure out details about the user, so support looking that up by username. c) Once we have the "user id", the GL_ID gets passed down to e.g. user-authored hooks. I don't want to have those all break by having to handle a third GL_ID mode of "username" in addition to the current "key id" and "user id".
* | Use actor when we don't know if it's a Key or UserAsh McKenzie2018-08-011-15/+14
| | | | | | | | | | | | * Use gl_id when we don't know if it's a key-X or user-X * Use Actor.new_from(gl_id) which will figure out if it's a Key or User * Use key_str when we're referring to key-X as key_id is confusing
* | Rename NotFound -> NotFoundErrorAsh McKenzie2018-08-011-2/+2
| |
* | Utilise new ActionsAsh McKenzie2018-08-011-17/+30
| | | | | | | | | | | | | | | | | | | | * Move gitaly, git-lfs and 2FA logic out from gitlab_shell.rb * Streamline parsing of origin_cmd in GitlabShell * Utilise proper HTTP status codes sent from the API * Also support 200 OK with status of true/false (ideally get rid of this) * Use HTTP status constants * Use attr_reader definitions (var over @var) * Rspec deprecation fixes
* | Tidy up GitlabNetAsh McKenzie2018-08-011-7/+2
| | | | | | | | | | * Remove HTTP related requires * Make protocol = GL_PROTOCOL the default
* | actor is always key_id in GitlabNetAsh McKenzie2018-08-011-7/+2
| |
* | Use HTTP status constants in GitLabNetAsh McKenzie2018-08-011-24/+11
| |
* | Move HTTP related exceptions into HTTPHelperAsh McKenzie2018-08-011-3/+0
| |
* | Move GL_PROTOCOL into GitlabNetAsh McKenzie2018-07-301-0/+1
|/
* Support HTTP headers and sending JSONAsh McKenzie2018-07-201-1/+1
|
* Rename HTTPHelper#host to #internal_api_endpointAsh McKenzie2018-07-201-11/+11
|
* Move HTTP logic out into HTTPHelperAsh McKenzie2018-07-201-104/+3
|
* Switch to structured loggingJacob Vosmaer (GitLab)2018-03-191-7/+5
|
* Update files to pass modern rubocop checks. Disable some of themdz-update-depsDmitriy Zaporozhets2018-02-221-13/+11
| | | | Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
* Update rubocop and code to pass itDmitriy Zaporozhets2018-02-221-8/+8
| | | | Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
* Remove special case treatment of Geo nodes for SSHStan Hu2018-01-121-2/+1
| | | | | | | We removed SSH support in https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/3553, so we no longer need the ability to show all refs for Geo nodes. Closes #115
* Remove direct redis integrationNick Thomas2018-01-121-25/+0
|
* pass gl_username through to hooksDavid Turner2017-09-281-1/+7
|
* Support new /internal/pre-receive API endpoint for post-receivegitaly-redis-refactorAlejandro Rodríguez2017-09-051-0/+8
|
* Support new /internal/post-receive API endpointAlejandro Rodríguez2017-08-301-0/+14
|
* Make geo_node a default parametersh-show-all-refsStan Hu2017-07-241-1/+1
|
* Support unhiding of all refs for Geo NodesStan Hu2017-07-211-1/+1
| | | | | | By default, we hide certain refs (e.g. keep-around/XXX) to save user download time. We need to preserve these references on secondary Geo nodes to have a true copy.
* Handle internal API errors when getting merge request URLsonly-parse-mr-urls-on-successSean McGivern2017-07-121-1/+8
|
* Revert "Merge branch ↵revert-gl-repositoryAlejandro Rodríguez2017-07-031-7/+6
| | | | | | | '86-follow-up-from-use-gl_repository-if-present-when-enqueing-sidekiq-postreceive-jobs' into 'master'" This reverts commit fa6343515ba65423e9de4c98c6005facc6059938, reversing changes made to 62af7f6af72728cecb98c5275d8b7aeb3953e564.
* Merge branch 'master' into remove-references-to-v3-internal-apiDmitriy Zaporozhets2017-06-211-6/+7
|\ | | | | | | Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
| * Remove old `project` parameter, use `gl_repository` instead86-follow-up-from-use-gl_repository-if-present-when-enqueing-sidekiq-postreceive-jobsAlejandro Rodríguez2017-06-201-6/+7
| |
* | Remove references to V3 internal APIremove-references-to-v3-internal-apiAdam Niedzielski2017-06-161-12/+8
|/ | | | | | | In the main Rails app we use exactly the same code for /api/v3/internal and /api/v4/internal This means that we can move gitlab-shell to V4 in preparation for sunsetting V3
* Setup use of gl-repository to enqueue PostReceive sidekiq jobsAlejandro Rodríguez2017-05-111-1/+0
|
* Handle GL_REPOSITORY env variable and use it in api callsAlejandro Rodríguez2017-05-111-6/+11
|
* Use api/v4 for gitaly notification and add testsgitaly-post-receive-2Alejandro Rodríguez2017-02-101-9/+13
|
* Add gitaly notification on post-receive hookAlejandro Rodríguez2017-02-071-0/+8
|
* Set a 'Host' header on unix socketsJacob Vosmaer2017-01-031-0/+6
| | | | Workaround for a bug in the HTTPUNIX client.
* Pass relevant git environment variables while calling `/allowed`Timothy Andrew2016-12-161-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | 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 calls the `/allowed` endpoint on the rails server. This `/allowed` endpoint 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 passing the relevant environment variables (GIT_ALTERNATE_OBJECT_DIRECTORIES, GIT_OBJECT_DIRECTORY, and GIT_QUARANTINE_PATH) to the `/allowed` endpoint, which will then include these environment variables while calling out to git.
* Use full repository path for API calls instead of extracting namedz-support-nested-namespacesDmitriy Zaporozhets2016-10-271-8/+6
| | | | Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
* Refactored LFS auth logic to use its own API endpoint.Patricio Cano2016-09-061-5/+22
|
* Added LFS support to SSHPatricio Cano2016-09-061-1/+1
| | | | - Required changes to GitLab Shell include the actual handling of the `git-lfs-authenticate` command and the retrieval of the correct credentials.
* Add option to recover 2FA via SSHDrew Blessing2016-08-261-0/+9
|
* Sentinel connection parameters in `config.yml` fileGabriel Mazetto2016-08-181-0/+6
|
* print new merge request urls after push receivedScott Le2016-08-121-0/+7
| | | | | | | | | | | | | | | | update spec different text for new and existing merge request update spec fix style switch order of messages enhance message appearance remove extra spaces
* Rename ENV['PROTOCOL'] to ENV['GL_PROTOCOL'] and make it mandatory with no ↵Patricio Cano2016-07-051-1/+1
| | | | fallback value
* Allow GitLab Shell to check for allowed access based on the used Git protocol.Patricio Cano2016-07-051-1/+2
|