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

aws/aws-app-mesh-controller-for-k8s: pkg/virtualservice/enqueue_requests_for_virtualnode_events.go; 3 LoC

Open
#15,810 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 [aws/aws-app-mesh-controller-for-k8s](https://www.github.com/aws/aws-app-mesh-controller-for-k8s) at [pkg/virtualservice/enqueue_requests_for_virtualnode_events.go](https://github.com/aws/aws-app-mesh-controller-for-k8s/blob/c94935b82442b7d4afccf3fc32ee12649fb549b6/pkg/virtualservice/enqueue_requests_for_virtualnode_events.go#L65-L67)

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.

> reference to vs was used in a composite literal at line 66

[Click here to see the code in its original context.](https://github.com/aws/aws-app-mesh-controller-for-k8s/blob/c94935b82442b7d4afccf3fc32ee12649fb549b6/pkg/virtualservice/enqueue_requests_for_virtualnode_events.go#L65-L67)

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

```go
for _, vs := range vsList.Items {
queue.Add(ctrl.Request{NamespacedName: k8s.NamespacedName(&vs)})
}

```

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: c94935b82442b7d4afccf3fc32ee12649fb549b6

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with pkg/virtualservice/enqueue_requests_for_virtualnode_events.go at lines 65-67 and read the surrounding enqueue logic. Check whether taking the address of the range variable vs causes incorrect NamespacedName values, then classify the finding using the requested reaction; no patch or test is named in the issue.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.