Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Enable gosec and do some internal types modifications #16

Merged
merged 3 commits into from
Oct 4, 2024

Conversation

vitsalis
Copy link
Member

@vitsalis vitsalis commented Oct 4, 2024

Most of the errors from gosec stemmed from dangerous type conversions (e.g. from uint32 to uint16). Instead of doing checks everywhere inside the codebase on whether the type semantics are observed (e.g. checking that the uint32 is not larger than math.MaxUint16), I opted to handle this on the types definition and Babylon retrieval layer.

I made gosec exclude the testutil/ and itest/ directories as they are related to tests. Also, for the following gosec errors I put a flag to remove them from the linter:

  • Two conversions from uint32 to uint16. Even though I performed the check previously, the static analyzer could not identify it.
  • Go file inclusion. This file is not passed from the web, but the user's machine, so it doesn't need further checks.

@vitsalis vitsalis merged commit 02ca7fd into main Oct 4, 2024
11 checks passed
@vitsalis vitsalis deleted the types-and-gosec branch October 4, 2024 13:38
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.

2 participants