Conversation
…ween integer types Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> Signed-off-by: Michael <MichaelSp@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Potential fix for https://github.com/openmcp-project/controller-utils/security/code-scanning/2
Use fixed-width parsing at the source so the parsed value is guaranteed to fit the downstream narrower type.
Best fix here: replace
strconv.Atoiwithstrconv.ParseInt(s, 10, 32)forwebhooks-service-port, then convert tointfor the existingWithWebhookServicePortcall. This preserves behavior (still accepts decimal text input) while preventing out-of-range values from being accepted.ParseIntwith bit size32returns an error for values outside signed 32-bit range, which addresses the CodeQL concern without requiring assumptions aboutWithWebhookServicePort.Edits are confined to
pkg/init/webhooks/flags.go, inside thewebhooks-service-portflag handler (lines 41–45 region). No new imports are required sincestrconvis already imported.Suggested fixes powered by Copilot Autofix. Review carefully before merging.