-
Notifications
You must be signed in to change notification settings - Fork 317
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: bol load: additinal metric release #5257
base: master
Are you sure you want to change the base?
Conversation
…into chore.bol-load-r5
… chore.bol-load-r7
dbURL := fmt.Sprintf("postgres://postgres:%s@localhost:%d/testdb?sslmode=disable", randomPassword, freePort) | ||
|
||
// Print the database URL | ||
fmt.Printf("Database URL: %s\n", dbURL) |
Check failure
Code scanning / CodeQL
Clear-text logging of sensitive information High
Sensitive data returned by an access to randomPassword
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI 13 days ago
To fix the problem, we need to ensure that the sensitive information (i.e., the password) is not logged in clear text. The best way to do this is to remove the password from the dbURL
string before logging it. We can log the dbURL
without the password, and if necessary, log a placeholder or a masked version of the password.
- Remove the password from the
dbURL
string before logging it. - Log the
dbURL
without the password. - Ensure that the functionality of connecting to the database remains unchanged.
-
Copy modified lines R146-R147 -
Copy modified line R149 -
Copy modified line R156
@@ -145,5 +145,6 @@ | ||
// Construct the database URL | ||
dbURL := fmt.Sprintf("postgres://postgres:%s@localhost:%d/testdb?sslmode=disable", randomPassword, freePort) | ||
dbURL := fmt.Sprintf("postgres://postgres:****@localhost:%d/testdb?sslmode=disable", freePort) | ||
fullDbURL := fmt.Sprintf("postgres://postgres:%s@localhost:%d/testdb?sslmode=disable", randomPassword, freePort) | ||
|
||
// Print the database URL | ||
// Print the database URL without the password | ||
fmt.Printf("Database URL: %s\n", dbURL) | ||
@@ -154,3 +155,3 @@ | ||
var err error | ||
db, err = sql.Open("postgres", dbURL) | ||
db, err = sql.Open("postgres", fullDbURL) | ||
if err != nil { |
fmt.Printf("\nFinal results:\n") | ||
fmt.Printf("Processed %d events in %v\n", totalEvents, elapsed) | ||
fmt.Printf("Average rate: %.2f events/second\n", float64(totalEvents)/elapsed.Seconds()) | ||
fmt.Printf("Database URL: %s\n", dbURL) |
Check failure
Code scanning / CodeQL
Clear-text logging of sensitive information High
Sensitive data returned by an access to randomPassword
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI 13 days ago
To fix the problem, we should avoid logging the dbURL
that contains the sensitive randomPassword
. Instead, we can log a version of the URL with the password obfuscated or simply omit the password from the log. This ensures that sensitive information is not exposed in the logs.
The best way to fix this without changing existing functionality is to modify the log statement on line 261 to exclude the password. We can achieve this by constructing a new version of the dbURL
without the password for logging purposes.
-
Copy modified lines R147-R148 -
Copy modified line R263
@@ -146,2 +146,4 @@ | ||
dbURL := fmt.Sprintf("postgres://postgres:%s@localhost:%d/testdb?sslmode=disable", randomPassword, freePort) | ||
// Create a version of the dbURL without the password for logging | ||
dbURLForLog := fmt.Sprintf("postgres://postgres:****@localhost:%d/testdb?sslmode=disable", freePort) | ||
|
||
@@ -260,3 +262,3 @@ | ||
fmt.Printf("Average rate: %.2f events/second\n", float64(totalEvents)/elapsed.Seconds()) | ||
fmt.Printf("Database URL: %s\n", dbURL) | ||
fmt.Printf("Database URL: %s\n", dbURLForLog) | ||
|
No description provided.