Skip to content

ci(lint): prevent integer overflows and improve code safety#4437

Merged
appleboy merged 1 commit into
masterfrom
lint3
Nov 15, 2025
Merged

ci(lint): prevent integer overflows and improve code safety#4437
appleboy merged 1 commit into
masterfrom
lint3

Conversation

@appleboy
Copy link
Copy Markdown
Member

@appleboy appleboy commented Nov 15, 2025

  • Change gosec linter to exclude G115 instead of including specific rules
  • Add safeInt8 function and use it in Context.Next to prevent int8 overflow
  • Group const and var declarations in gin.go for improved readability
  • Refactor server start methods to instantiate http.Server explicitly
  • Add safeUint16 function and use it in tree parameter/section counting functions to prevent uint16 overflow

Pull Request Checklist

Please ensure your pull request meets the following requirements:

  • Open your pull request against the master branch.
  • All tests pass in available continuous integration systems (e.g., GitHub Actions).
  • Tests are added or modified as needed to cover code changes.
  • If the pull request introduces a new feature, the feature is documented in the docs/doc.md.

Thank you for contributing!

@appleboy appleboy added this to the v1.12 milestone Nov 15, 2025
- Update linting configuration to exclude G115 gosec check instead of including specific checks
- Add the safeInt8 helper for safer type conversions and use it to prevent int8 overflow in middleware handler execution
- Group related constants and variables together for better organization in gin.go
- Refactor HTTP server instantiation to use a dedicated http.Server object for all Run methods
- Add the safeUint16 helper and use it to safely handle conversions in tree node functions to prevent uint16 overflow

Signed-off-by: appleboy <[email protected]>
@appleboy appleboy merged commit 93ff771 into master Nov 15, 2025
25 checks passed
@appleboy appleboy deleted the lint3 branch November 15, 2025 15:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant