summaryrefslogtreecommitdiff
path: root/internal/handler/exec.go
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2020-11-20 00:25:55 +0000
committerStan Hu <stanhu@gmail.com>2020-11-20 00:25:55 +0000
commit38d3ac0404c75f18e6e265bc9da53776aefb828a (patch)
treea8c92cedcf9d9c68a55eede33668144a67899c5a /internal/handler/exec.go
parentd35ec21259b30a266393f86d57ba88fe71ed67fe (diff)
parent97bb3321f711a21a33d1b9e1f3975654e23660b4 (diff)
downloadgitlab-shell-38d3ac0404c75f18e6e265bc9da53776aefb828a.tar.gz
Merge branch 'client-identity' into 'master'
Propagate client identity to gitaly See merge request gitlab-org/gitlab-shell!436
Diffstat (limited to 'internal/handler/exec.go')
-rw-r--r--internal/handler/exec.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/internal/handler/exec.go b/internal/handler/exec.go
index 3688336..5ead63e 100644
--- a/internal/handler/exec.go
+++ b/internal/handler/exec.go
@@ -4,6 +4,7 @@ import (
"context"
"fmt"
"os"
+ "strconv"
"strings"
log "github.com/sirupsen/logrus"
@@ -69,6 +70,17 @@ func (gc *GitalyCommand) PrepareContext(ctx context.Context, repository *pb.Repo
ctx = correlation.ContextWithCorrelation(ctx, response.CorrelationID)
}
+ md, ok := metadata.FromOutgoingContext(ctx)
+ if !ok {
+ md = metadata.New(nil)
+ }
+ md.Append("key_id", strconv.Itoa(response.KeyId))
+ md.Append("key_type", response.KeyType)
+ md.Append("user_id", response.UserId)
+ md.Append("username", response.Username)
+ md.Append("remote_ip", sshenv.LocalAddr())
+ ctx = metadata.NewOutgoingContext(ctx, md)
+
return ctx, cancel
}