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

--sql and gosec = G115 (CWE-190): integer overflow conversion uint -> int (Confidence: MEDIUM, Severity: HIGH) #252

Open
OlivierMary opened this issue Sep 7, 2024 · 0 comments

Comments

@OlivierMary
Copy link

Hi,

Just to notify you when generate enum with --sql on func (x *Example) Scan(value interface{}) (err error) {

I got this gosec error:

Autofix:

[.....\enumsExample_enum.go:173] - G115 (CWE-190): integer overflow conversion uint -> int (Confidence: MEDIUM, Severity: HIGH)
    172:                }
  > 173:                *x = Example(*v)
    174:        case *uint64:

Autofix:

[....\enumsExample_enum.go:149] - G115 (CWE-190): integer overflow conversion uint -> int (Confidence: MEDIUM, Severity: HIGH)
    148:        case uint:
  > 149:                *x = Example(v)
    150:        case uint64:


enum file:

//go:generate go run github.com/abice/[email protected] --marshal --names --noprefix --sql --lower  --values --mustparse --flag --nocamel --prefix=EXAMPLE_
package models

// ENUM(SUCCESS, FAIL, TIMEOUT, SKIPPED)
type Example int

gosec command:

go install github.com/securego/gosec/v2/cmd/gosec@latest
gosec ./...

I didn't see any way to dont generate this case (uint -> int) . Or with a full custom template...

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

No branches or pull requests

1 participant