Skip to content

chore: suppress G602 for CPU to reserve#2640

Merged
fletcherw merged 1 commit intoawslabs:mainfrom
mselim00:fix-gosec
Feb 27, 2026
Merged

chore: suppress G602 for CPU to reserve#2640
fletcherw merged 1 commit intoawslabs:mainfrom
mselim00:fix-gosec

Conversation

@mselim00
Copy link
Copy Markdown
Contributor

Issue #, if available:

Description of changes:
This array index is flagged because there's no implicit guarantee that i + 1 exists in cpuRanges if i is based on the length of cpuPercentageReservedForRanges. This is informally guaranteed though by the nature of the function, so this just adds a suppression until this can be refactored in a way that avoids this.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

See this guide for recommended testing for PRs. Some tests may not apply. Completing tests and providing additional validation steps are not required, but it is recommended and may reduce review time and time to merge.

@mselim00 mselim00 added the changelog/exclude Exclude this PR from future changelog entries. label Feb 26, 2026
@mselim00 mselim00 requested a review from fletcherw February 26, 2026 18:55
@fletcherw
Copy link
Copy Markdown
Contributor

I think this is possibly a bug in gosec, assuming that a for range loop with indices is only indexing into the ranged container, but agree we should suppress.

@fletcherw fletcherw merged commit 6caf831 into awslabs:main Feb 27, 2026
12 checks passed
@mselim00
Copy link
Copy Markdown
Contributor Author

I think you're probably right, I just saw securego/gosec#1525 and securego/gosec#1531 - but I don't think the latter would fix this this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog/exclude Exclude this PR from future changelog entries.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants