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

False positives in gorm-hardcoded-secret and gorm-empty-password #3316

Open
1 of 3 tasks
lfama opened this issue Mar 4, 2024 · 0 comments
Open
1 of 3 tasks

False positives in gorm-hardcoded-secret and gorm-empty-password #3316

lfama opened this issue Mar 4, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@lfama
Copy link
Contributor

lfama commented Mar 4, 2024

Describe the bug
Both rules gorm-empty-password and gorm-hardcoded-secret produce false positives when the password is coming from a variable and it's not actually hardcoded in the source code.

I couldn't find these rules in the semgrep-rules repository (maybe because they are "pro" rules?) so I'm not sure it's the right place to open a bug. In case let me know.

To Reproduce
Run the rules against this snippet of code and notice that both produce a finding.

import (
  "gorm.io/driver/postgres"
  "gorm.io/gorm/schema"	
)

func InitDatabase(configuration *config.Configuration) (*gorm.DB, error) {
	gormConfig := gorm.Config{
		PrepareStmt: true,
	}

	return gorm.Open(postgres.New(postgres.Config{
		DSN: "host=" + configuration.Database.DBAddr +
			" port=" + configuration.Database.DBPort +
			" dbname=" + configuration.Database.DBName +
			" user=" + configuration.Database.DBUser +
			" password=" + configuration.Database.DBPass +
			" sslmode=" + configuration.Database.DBType,
	}), &gormConfig)
}

Expected behavior
Do not report findings.

Priority
How important is this to you?

  • P0: blocking me from making progress
  • P1: this will block me in the near future
  • P2: annoying but not blocking me

Additional Context
N/A

@lfama lfama added the bug Something isn't working label Mar 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

No branches or pull requests

1 participant