summaryrefslogtreecommitdiff
path: root/lib
Commit message (Collapse)AuthorAgeFilesLines
* Remove circular dependency between HTTPHelper and GitlabNetsh-fix-circular-dependency-errorsStan Hu2018-11-273-3/+5
| | | | | | | | | HttpHelper depended on exceptions defined in GitLabNet, but GitLabNet included HttpHelper. Specs in Ruby 2.5 were breaking as a result of Action::Custom not able to reference constants in GitLabNet: https://gitlab.com/gitlab-org/gitlab-shell/-/jobs/126362702. Closes https://gitlab.com/gitlab-org/gitlab-shell/issues/169
* Include LFS operation when making auth requestashmckenzie/8114-geo-push-ssh-lfs-http-auth-bugAsh McKenzie2018-11-082-18/+13
| | | | Operation is either upload or download
* Changes the HTTP error code from Gateway timeout to Service Unavailableadd-http-gateway-time-out-handlingTiago Botelho2018-10-241-1/+1
|
* Adds handling of Net::HTTPGatewayTimeOut exception to GitlabNetTiago Botelho2018-10-241-1/+1
|
* Display helpful feedback when proxying an SSH git push to secondary request ↵Ash McKenzie2018-09-255-36/+34
| | | | (v2)
* Merge branch 'ash.mckenzie/display-feedback' into 'master'Stan Hu2018-09-132-3/+10
|\ | | | | | | | | Display helpful feedback when proxying an SSH git push to secondary request See merge request gitlab-org/gitlab-shell!244
| * Print message to $stderr for custom actionAsh McKenzie2018-09-131-0/+6
| |
| * Make ordered expectations around results outputAsh McKenzie2018-09-131-2/+2
| | | | | | | | This also cleans up the output from the tests as previously, Base64 encoded output was printed.
| * Consider 300 a successful response alsoAsh McKenzie2018-09-131-1/+2
| |
* | Merge branch 'sh-fix-nonatomic-puts' into 'master'v8.3.2Nick Thomas2018-09-121-2/+3
|\ \ | |/ |/| | | | | | | | | Fix newlines not appearing between new log entries Closes gitlab-com/gl-infra/infrastructure#5017 See merge request gitlab-org/gitlab-shell!242
| * Fix newlines not appearing between new log entriessh-fix-nonatomic-putsStan Hu2018-09-111-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In https://gitlab.com/gitlab-com/gl-infra/infrastructure/issues/5017, we observed that lots of log messages were being dropped by Fluentd due to missing newlines. This occurs because there is a bug in Ruby where IO#puts calls write() twice: once to write the main text, and another to write the newline (https://bugs.ruby-lang.org/issues/14042). In a highly concurrent environment like GitLab.com, this can lead to interleaved newlines. A workaround is to use `IO#print` and append the newline ourselves. Closes https://gitlab.com/gitlab-com/gl-infra/infrastructure/issues/5017
* | Ensure text/plain & text/html content typs are handled and add missing specs ↵Ash McKenzie2018-09-113-6/+11
|/ | | | for handled HTTP status codes
* Only decode result body if it has content upon custom action failureStan Hu2018-09-071-1/+3
|
* Custom Action supportash.mckenzie/custom-action-supportAsh McKenzie2018-09-085-17/+175
|
* GitlabAccessStatus needs HTTP response status codeAsh McKenzie2018-09-071-2/+4
|
* Use constants for git commands in GitlabShellAsh McKenzie2018-09-071-6/+11
|
* New HTTPCodes moduleAsh McKenzie2018-09-071-0/+3
|
* GitAccessStatus initializer sensible defaultsAsh McKenzie2018-09-072-9/+2
|
* Move some GitlabNet requires into HTTPHelperAsh McKenzie2018-09-072-2/+2
|
* /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
* New HTTPCodes moduleAsh McKenzie2018-09-072-0/+9
|
* Fix handling non 200 response codeszj-fix-non-200-resp-codeZeger-Jan van de Weg2018-09-052-2/+1
| | | | | | | | | 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
* Clean up cmd_exec execution environmentZeger-Jan van de Weg2018-08-242-67/+16
| | | | | | | | | | | Given the gitaly-* now proxy the data from the client to the Gitaly server, the environment variables aren't used. Therefor we don't have to set them either. Only exception to the rule, is the GITALY_TOKEN. These changes also remove the `GIT_TRACE` options, introduced by 192e2bd367494bf66746c8971896a2d9cb84fc92. Part of: https://gitlab.com/gitlab-org/gitaly/issues/1300
* Remove non Gitaly code pathsZeger-Jan van de Weg2018-08-201-23/+23
| | | | | | | All shell access goes through Gitaly, so dead code paths exist to support the legacy way too. This change mostly removes the dead code from `#process_cmd`.
* Remove repo_path from GitlabShellzj-remove-repo-pathZeger-Jan van de Weg2018-08-162-13/+2
| | | | | | | | | | | | | | | The internal api returns '/' from gitlab, since `8fad07383ada021fc995294fd0fe0f77fe37da35` from GitLab CE. To clean up later, https://gitlab.com/gitlab-org/gitlab-shell/issues/135 was created. This change closes that issue, making it possible to remove the field from the response on GitLab-CE too. Given the Rails app always returns `/` as the repository_path, the associated checks are basically a noop too. The tests are updated and at times look a little fishy, but those are testing code that is to be removed in another MR. Closes https://gitlab.com/gitlab-org/gitlab-shell/issues/135
* Fix a RuboCop warningRobert Speicher2018-08-151-1/+1
|
* Override `ROOT_PATH` in specs in a less insane wayRobert Speicher2018-08-151-1/+1
|
* Merge remote-tracking branch 'upstream/8-1-stable' into ↵Nick Thomas2018-08-141-1/+1
|\ | | | | | | 148-merge-8-1-1-to-master
| * Guard discovery by username or key against bad API responsesNick Thomas2018-08-091-1/+1
| |
| * Fix two regressions in SSH certificate supportÆvar Arnfjörð Bjarmason2018-08-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix two regressions in my 2e8b670 ("Add support for SSH certificate authentication", 2018-06-14) merged in gitlab-org/gitlab-shell!207. This fixes the issue noted in gitlab-org/gitlab-shell#145 where the command-line contains things other than the key/user/username, and also a regression where SSH certificates are being used, and the username presented in the key is unknown to GitLab. In that case, we should log the user in as "Anonymous" (on an instance that allows public access), but because of how the error checking around api.discover() was implemented we ended up erroring out instead.
* | Restore "Pass custom git_config_options to Gitalyo"Nick Thomas2018-08-143-2/+7
| | | | | | | | This reverts commit 764f6f47fa6a8698ae033532ae49875a87030518.
* | Revert "Merge branch 'ash.mckenzie/srp-refactor' into 'master'"Nick Thomas2018-08-1419-564/+397
| | | | | | | | | | This reverts commit 3aaf4751e09262c53544a1987f59b1308af9b6c1, reversing changes made to c6577e0d75f51b017f2f332838b97c3ca5b497c0.
* | Revert "Pass custom git_config_options to Gitalyo"Nick Thomas2018-08-141-5/+2
| | | | | | | | This reverts commit f4ce4a3c31a9a7fb2fa0bb7daa185d34b8c03c00.
* | Merge branch 'rd-support-git-config-options' into 'master'Robert Speicher2018-08-081-2/+5
|\ \ | | | | | | | | | | | | Pass custom git_config_options to Gitaly See merge request gitlab-org/gitlab-shell!221
| * | Pass custom git_config_options to GitalyoRubén Dávila2018-08-071-2/+5
| | | | | | | | | | | | | | | The /api/internal/allowed endpoint on GitLab has been updated to return some custom git options that can be used with git commands, we need to pass these received options to Gitaly.
* | | Typo fixAsh McKenzie2018-08-081-1/+1
|/ /
* | Actor::Base audit_usernames? now an aliasAsh McKenzie2018-08-031-4/+2
| |
* | Merge remote-tracking branch 'origin/master' into ash.mckenzie/srp-refactorAsh McKenzie2018-08-023-4/+11
|\ \ | |/
| * use GIT_PROTOCOL env variable in gitlab_shell#execJames Lopez2018-08-011-1/+1
| |
| * update gitlab shell to remove git_protocol env varJames Lopez2018-08-011-1/+0
| |
| * Add Git protocol v2James Lopez2018-08-013-6/+12
| |
* | Added TODO to fixup whatever namingAsh McKenzie2018-08-011-0/+2
| |
* | GitlatNet#discover only parse JSON if a 200Ash McKenzie2018-08-011-1/+1
| |
* | Update Actor::Username, add specsAsh McKenzie2018-08-012-5/+11
| |
* | Actor::Base#label now describes the class nicelyAsh McKenzie2018-08-011-1/+5
| |
* | Merge remote-tracking branch 'origin/master' into ash.mckenzie/srp-refactorAsh McKenzie2018-08-019-38/+81
|\ \ | |/
| * Add support for SSH certificate authenticationÆvar Arnfjörð Bjarmason2018-07-264-33/+100
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 Struct::ParsedCommand to keep vars closeAsh McKenzie2018-08-011-13/+21
| |
* | Remove User as Actor::Key/User has replaced itAsh McKenzie2018-08-011-25/+0
| |
* | Use actor when we don't know if it's a Key or UserAsh McKenzie2018-08-018-68/+75
| | | | | | | | | | | | * 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