github-vet / github-vet/rangeloop-pointer-findings
hashicorp/packer: builder/amazon/ebssurrogate/step_snapshot_volumes.go; 6 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [hashicorp/packer](https://www.github.com/hashicorp/packer) at [builder/amazon/ebssurrogate/step_snapshot_volumes.go](https://github.com/hashicorp/packer/blob/28245ec1434dbbcde312633b4dd9c46a800f306d/builder/amazon/ebssurrogate/step_snapshot_volumes.go#L138-L143)
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 snapshotId was used in a composite literal at line 139
[Click here to see the code in its original context.](https://github.com/hashicorp/packer/blob/28245ec1434dbbcde312633b4dd9c46a800f306d/builder/amazon/ebssurrogate/step_snapshot_volumes.go#L138-L143)
Click here to show the 6 line(s) of Go which triggered the analyzer.
```go
for _, snapshotId := range s.snapshotIds {
_, err := ec2conn.DeleteSnapshot(&ec2.DeleteSnapshotInput{SnapshotId: &snapshotId})
if err != nil {
ui.Error(fmt.Sprintf("Error: %s", err))
}
}
```
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: 28245ec1434dbbcde312633b4dd9c46a800f306d
Contributor guide
No contributing guide indexed for this repository
Research direction
Read builder/amazon/ebssurrogate/step_snapshot_volumes.go around lines 138-143 and inspect the snapshot deletion flow. Check whether the analyzer's range-variable warning affects the DeleteSnapshot call, then validate the intended behavior with the relevant Packer tests. Done means the finding is resolved or justified and snapshot deletion remains correct.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, go
- Domain
- cloud
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 38/100