github-vet / github-vet/rangeloop-pointer-findings

conductorlabs/wrapper: tsuru/tsuru/vendor/github.com/tsuru/gandalf/user/key.go; 3 LoC

Open
#12,927 0 comments 0 reactions 0 assignees View on GitHub
fresh tiny
Dominant language
No language data
Stars
0
Forks
0
PR merge metrics
PR metrics pending

Description

Found a possible issue in [conductorlabs/wrapper](https://www.github.com/conductorlabs/wrapper) at [tsuru/tsuru/vendor/github.com/tsuru/gandalf/user/key.go](https://github.com/conductorlabs/wrapper/blob/5e1c2e9dca1241b8d3cb0f0d6652ab7e64408c92/tsuru/tsuru/vendor/github.com/tsuru/gandalf/user/key.go#L252-L254)

Below is the message reported by the analyzer for this snippet of code. Beware that the analyzer only reports the first issue it finds, so please do not limit your consideration to the contents of the below message.

> function call which takes a reference to k at line 253 may start a goroutine

[Click here to see the code in its original context.](https://github.com/conductorlabs/wrapper/blob/5e1c2e9dca1241b8d3cb0f0d6652ab7e64408c92/tsuru/tsuru/vendor/github.com/tsuru/gandalf/user/key.go#L252-L254)

Click here to show the 3 line(s) of Go which triggered the analyzer.

```go
for _, k := range keys {
remove(&k)
}

```

Click here to show extra information the analyzer produced.

```
The following graphviz dot graph describes paths through the callgraph that could lead to a function calling a goroutine:
digraph G {
"(NewClient, 3)" -> {"(Login, 2)";}
"(RoundTrip, 1)" -> {"(Dial, 1)";"(ConnectWithRedirects, 5)";}
"(newClientTransport, 6)" -> {}
"(Remove, 2)" -> {"(Start, 1)";"(Do, 2)";"(Stop, 2)";}
"(Stop, 2)" -> {"(Start, 1)";}
"(WaitDocker, 1)" -> {}
"(Update, 2)" -> {"(Update, 1)";}
"(createToken, 2)" -> {}
"(remove, 1)" -> {"(delete, 2)";"(Remove, 2)";}
"(Do, 2)" -> {"(do, 2)";"(New, 1)";"(Add, 1)";"(RoundTrip, 1)";}
"(do, 2)" -> {}
"(Update, 1)" -> {"(update, 1)";}
"(SetTransportDefaults, 1)" -> {"(ConfigureTransport, 1)";}
"(addConnIfNeeded, 3)" -> {}
"(NewClientConn, 3)" -> {"(clientHandshake, 2)";}
"(Run, 1)" -> {"(WaitDocker, 1)";"(NewClient, 3)";"(Run, 2)";}
"(samlLogin, 2)" -> {}
"(Login, 2)" -> {"(Login, 1)";}
"(Run, 2)" -> {"(oauthLogin, 2)";"(samlLogin, 2)";"(forExpanded, 2)";}
"(Add, 1)" -> {"(New, 1)";}
"(oauthLogin, 2)" -> {}
"(ConfigureTransport, 1)" -> {"(configureTransport, 1)";}
"(delete, 2)" -> {"(Do, 2)";}
"(New, 1)" -> {"(newClient, 1)";"(get, 1)";}
"(newClient, 1)" -> {"(NewMaintenance, 1)";}
"(Do, 3)" -> {}
"(Login, 1)" -> {"(createToken, 2)";"(createToken, 1)";}
"(createToken, 1)" -> {}
"(Dial, 1)" -> {"(dial, 1)";}
"(Dial, 3)" -> {"(NewClientConn, 3)";}
"(NewMaintenance, 1)" -> {"(dial, 1)";}
"(Start, 1)" -> {"(Run, 1)";"(New, 1)";"(SendRequest, 3)";"(Update, 2)";}
"(forExpanded, 2)" -> {}
"(update, 1)" -> {}
"(ConnectWithRedirects, 5)" -> {"(Dial, 1)";}
"(dial, 1)" -> {"(dialWithoutProxy, 1)";}
"(dialWithoutProxy, 1)" -> {"(Dial, 3)";}
"(clientHandshake, 2)" -> {"(newClientTransport, 6)";}
"(SendRequest, 3)" -> {"(Do, 3)";}
"(get, 1)" -> {"(SetTransportDefaults, 1)";}
"(configureTransport, 1)" -> {"(addConnIfNeeded, 3)";}
}

```

Leave a reaction on this issue to contribute to the project by classifying this instance as a **Bug** :-1:, **Mitigated** :+1:, or **Desirable Behavior** :rocket:
See the descriptions of the classifications [here](https://github.com/github-vet/rangeclosure-findings#how-can-i-help) for more information.

commit ID: 5e1c2e9dca1241b8d3cb0f0d6652ab7e64408c92

Contributor guide

No contributing guide indexed for this repository

Research direction

Read tsuru/tsuru/vendor/github.com/tsuru/gandalf/user/key.go around lines 252-254, then trace remove and the analyzer's reported call path. Decide whether passing the range variable address can cause an actual problem, and classify the finding with the requested Bug, Mitigated, or Desirable Behavior reaction.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.