Skip to content

Fix for code scanning alert no. 2: Incorrect conversion between integer types#400

Merged
josegonzalez merged 1 commit into
mainfrom
alert-autofix-2
Jul 18, 2026
Merged

Fix for code scanning alert no. 2: Incorrect conversion between integer types#400
josegonzalez merged 1 commit into
mainfrom
alert-autofix-2

Conversation

@josegonzalez

Copy link
Copy Markdown
Member

Potential fix for https://github.com/dokku/docket/security/code-scanning/2

The safest no-functional-change fix is to parse directly into a signed 32-bit integer and convert that to rune, instead of parsing unsigned then narrowing.
Specifically in tasks/json5_dup.go, inside readString() at the case 'u': block:

  • Replace strconv.ParseUint(..., 16, 32) with strconv.ParseInt(..., 16, 32).
  • Keep the existing if err == nil flow and character consumption logic unchanged.
  • Convert using rune(r) where r is now int64, which is a signed-to-signed narrowing to int32 under a 32-bit parse bound and satisfies the CodeQL concern raised for unsigned-to-int32 conversion.

No new imports or helper methods are needed; strconv is already imported.

Suggested fixes powered by Copilot Autofix. Review carefully before merging.

…ween integer types

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@josegonzalez
josegonzalez marked this pull request as ready for review July 18, 2026 12:30
@josegonzalez josegonzalez changed the title Potential fix for code scanning alert no. 2: Incorrect conversion between integer types Fix for code scanning alert no. 2: Incorrect conversion between integer types Jul 18, 2026
@josegonzalez
josegonzalez merged commit db77385 into main Jul 18, 2026
19 checks passed
@josegonzalez
josegonzalez deleted the alert-autofix-2 branch July 18, 2026 12:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant