diff options
| author | Stan Hu <stanhu@gmail.com> | 2020-07-19 23:24:32 -0700 |
|---|---|---|
| committer | Stan Hu <stanhu@gmail.com> | 2020-07-21 15:24:24 -0700 |
| commit | 35c1f6cf6436a95eeeb59b6b0d9d6f71dcbf59a2 (patch) | |
| tree | 44d6b8ac6a75adc162589a14349396dc86e6f075 /internal/testhelper | |
| parent | b3f6fcdb77a3d047ce8b02e9a0faf32e5a244c92 (diff) | |
| download | gitlab-shell-sh-log-ssh-key-details.tar.gz | |
Log SSH key detailssh-log-ssh-key-details
Right now when a client such as gitlab-shell calls the
`/api/v4/internal/allowed` API, the response only tells the client what
user has been granted access, and it's impossible to tell which deploy
key/token was used in the authentication request.
This commit adds logs for the following when available:
1. `gl_key_type` (e.g. `deploy_key` or `key`)
2. `gl_key_id`
These fields make it possible for admins to identify the exact record
that was used to authenticate the user.
API changes in the `/internal/allowed` endpoint in
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/37289 are needed
to support this.
Relates to https://gitlab.com/gitlab-org/gitlab-shell/-/issues/203
Diffstat (limited to 'internal/testhelper')
| -rw-r--r-- | internal/testhelper/requesthandlers/requesthandlers.go | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/internal/testhelper/requesthandlers/requesthandlers.go b/internal/testhelper/requesthandlers/requesthandlers.go index 73acc26..6d501d0 100644 --- a/internal/testhelper/requesthandlers/requesthandlers.go +++ b/internal/testhelper/requesthandlers/requesthandlers.go @@ -34,8 +34,10 @@ func BuildAllowedWithGitalyHandlers(t *testing.T, gitalyAddress string) []testse Path: "/api/v4/internal/allowed", Handler: func(w http.ResponseWriter, r *http.Request) { body := map[string]interface{}{ - "status": true, - "gl_id": "1", + "status": true, + "gl_id": "1", + "gl_key_type": "key", + "gl_key_id": 123, "gitaly": map[string]interface{}{ "repository": map[string]interface{}{ "storage_name": "storage_name", |
