Skip to content

Commit 53e8217

Browse files
authored
Merge pull request #621 from v3io/development
[IG-19529] clear session token and paswword so it won't get logged (#…
2 parents 7e94bf4 + 54e048e commit 53e8217

File tree

2 files changed

+4
-15
lines changed

2 files changed

+4
-15
lines changed

backends/kv/backend.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,6 @@ func (b *Backend) updateItem(request *frames.ExecRequest) error {
119119

120120
func (b *Backend) newConnection(session *frames.Session, password string, token string, path string, addSlash bool) (v3io.Container, string, error) {
121121

122-
// Copy the session to avoid populating the session we received with credentials that may get logged later.
123-
newSession := *session
124-
session = &newSession
125-
126122
session = frames.InitSessionDefaults(session, b.framesConfig)
127123
containerName, newPath, err := v3ioutils.ProcessPaths(session, path, addSlash)
128124
if err != nil {
@@ -137,6 +133,10 @@ func (b *Backend) newConnection(session *frames.Session, password string, token
137133
token,
138134
b.logger)
139135

136+
// clear token and password so we won't accidentally log it in the future
137+
session.Token = ""
138+
session.Password = ""
139+
140140
if err == nil && b.numWorkers == 0 {
141141
resp, err := container.GetClusterMDSync(&v3io.GetClusterMDInput{})
142142
if err != nil {

backends/kv/reader.go

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -76,17 +76,6 @@ func (kv *Backend) Read(request *frames.ReadRequest) (frames.FrameIterator, erro
7676
return nil, err
7777
}
7878

79-
// Create a new platform (v3io) connection with specific RequestChannel length
80-
container, tablePath, err = kv.newConnection(request.Proto.Session,
81-
request.Password.Get(),
82-
request.Token.Get(),
83-
request.Proto.Table,
84-
true)
85-
86-
if err != nil {
87-
return nil, err
88-
}
89-
9079
input := v3io.GetItemsInput{Filter: request.Proto.Filter, AttributeNames: columns, SortKeyRangeStart: request.Proto.SortKeyRangeStart, SortKeyRangeEnd: request.Proto.SortKeyRangeEnd}
9180
kv.logger.DebugWith("read input", "input", input, "request", request)
9281

0 commit comments

Comments
 (0)