summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Wiedler <iwiedler@gitlab.com>2020-11-17 15:22:51 +0100
committerIgor Wiedler <iwiedler@gitlab.com>2020-11-17 15:22:51 +0100
commitf9384a90497bedc0002633b21076336c29a2c406 (patch)
treef9b5f76ac1ecd7ac959527665e81e6024ae07eed
parent3f9890ef73dced430d86801a1efc0e93ec50890e (diff)
downloadgitlab-shell-f9384a90497bedc0002633b21076336c29a2c406.tar.gz
Propagate client identity to gitaly
-rw-r--r--internal/handler/exec.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/internal/handler/exec.go b/internal/handler/exec.go
index 3688336..fdf3810 100644
--- a/internal/handler/exec.go
+++ b/internal/handler/exec.go
@@ -69,6 +69,15 @@ 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("user_id", response.UserId)
+ md.Append("username", response.Username)
+ md.Append("remote_ip", sshenv.LocalAddr())
+ ctx = metadata.NewOutgoingContext(ctx, md)
+
return ctx, cancel
}