-
Notifications
You must be signed in to change notification settings - Fork 0
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
[SingleStore] Add SingleStore connector #32
Conversation
console.log(wrapParam('host', options.host)); | ||
console.log(wrapParam('port', options.port, true)); | ||
console.log(wrapParam('user', options.user, true)); | ||
console.log(wrapParam('password', options.password, true, 'secret')); |
Check failure
Code scanning / CodeQL
Clear-text logging of sensitive information
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI 4 months ago
To fix the problem, we should ensure that sensitive information such as passwords is not logged in clear text. One way to achieve this is to mask the password before logging it. This can be done by replacing the actual password with a placeholder (e.g., "****") or by not logging the password at all.
In this case, we will modify the code to mask the password before passing it to the wrapParam
function. This ensures that even if wrapParam
does not handle the 'secret' flag correctly, the sensitive information will not be exposed.
-
Copy modified lines R57-R58
@@ -56,3 +56,4 @@ | ||
console.log(wrapParam('user', options.user, true)); | ||
console.log(wrapParam('password', options.password, true, 'secret')); | ||
const maskedPassword = options.password ? '****' : undefined; | ||
console.log(wrapParam('password', maskedPassword, true, 'secret')); | ||
console.log(wrapParam('database', options.database)); |
console.log(wrapParam('host', options.host)); | ||
console.log(wrapParam('port', options.port, true)); | ||
console.log(wrapParam('user', options.user, true)); | ||
console.log(wrapParam('password', options.password, true, 'secret')); |
Check failure
Code scanning / CodeQL
Clear-text logging of sensitive information
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI 4 months ago
To fix the problem, we should ensure that sensitive information such as passwords is not logged in clear text. One way to achieve this is to mask or obfuscate the sensitive data before logging it. We can modify the wrapParam
function call to replace the actual password with a placeholder (e.g., "****") when logging.
- Modify the call to
wrapParam
for thepassword
field to replace the actual password with a placeholder. - Ensure that the placeholder is used consistently to avoid exposing the actual password.
-
Copy modified line R71
@@ -70,3 +70,3 @@ | ||
console.log(wrapParam('user', options.user, true)); | ||
console.log(wrapParam('password', options.password, true, 'secret')); | ||
console.log(wrapParam('password', '****', true, 'secret')); | ||
console.log(wrapParam('database', options.database)); |
console.log(wrapParam('host', options.host)); | ||
console.log(wrapParam('port', options.port, true)); | ||
console.log(wrapParam('user', options.user, true)); | ||
console.log(wrapParam('password', options.password, true, 'secret')); |
Check failure
Code scanning / CodeQL
Clear-text logging of sensitive information
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI 4 months ago
To fix the problem, we should ensure that sensitive information such as passwords is not logged in clear text. One way to achieve this is to mask or obfuscate the password before logging it. We can modify the wrapParam
function call to handle the password securely by replacing the actual password with a placeholder like '<hidden>'
.
-
Copy modified line R57
@@ -56,3 +56,3 @@ | ||
console.log(wrapParam('user', options.user, true)); | ||
console.log(wrapParam('password', options.password, true, 'secret')); | ||
console.log(wrapParam('password', '<hidden>', true, 'secret')); | ||
console.log(wrapParam('database', options.database)); |
drizzle-kit/src/introspect-mysql.ts
Outdated
|
||
statement += it.generated | ||
? `.generatedAlwaysAs(sql\`${ | ||
it.generated.as.replace( |
Check failure
Code scanning / CodeQL
Incomplete string escaping or encoding
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI 4 months ago
To fix the problem, we need to ensure that backslashes are properly escaped in addition to backticks. This can be achieved by using a regular expression with the global flag to replace all occurrences of backslashes with double backslashes, and then replace backticks with escaped backticks. This ensures that all instances of these characters are properly sanitized.
- Modify the
replace
method to first escape backslashes and then escape backticks. - Ensure that the changes are made in the relevant part of the code without altering the existing functionality.
-
Copy modified lines R721-R723
@@ -720,6 +720,5 @@ | ||
? `.generatedAlwaysAs(sql\`${ | ||
it.generated.as.replace( | ||
/`/g, | ||
'\\`', | ||
) | ||
it.generated.as | ||
.replace(/\\/g, '\\\\') | ||
.replace(/`/g, '\\`') | ||
}\`, { mode: "${it.generated.type}" })` |
|
||
statement += it.generated | ||
? `.generatedAlwaysAs(sql\`${ | ||
it.generated.as.replace( |
Check failure
Code scanning / CodeQL
Incomplete string escaping or encoding
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI 4 months ago
To fix the problem, we need to ensure that backslashes in the input string are properly escaped before any other characters are escaped. This can be achieved by adding an additional replace
call to escape backslashes before escaping backticks.
- We will modify the
createTableColumns
function to include an additionalreplace
call for backslashes. - Specifically, we will add
it.generated.as.replace(/\\/g, '\\\\')
before the existingreplace
call for backticks. - This change will be made in the file
drizzle-kit/src/introspect-singlestore.ts
on line 687.
-
Copy modified lines R687-R689
@@ -686,6 +686,5 @@ | ||
? `.generatedAlwaysAs(sql\`${ | ||
it.generated.as.replace( | ||
/`/g, | ||
'\\`', | ||
) | ||
it.generated.as | ||
.replace(/\\/g, '\\\\') | ||
.replace(/`/g, '\\`') | ||
}\`, { mode: "${it.generated.type}" })` |
drizzle-kit/src/introspect-sqlite.ts
Outdated
it.generated.as | ||
.replace(/`/g, '\\`') |
Check failure
Code scanning / CodeQL
Incomplete string escaping or encoding
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI 4 months ago
To fix the problem, we need to ensure that all backslashes in the input string are properly escaped. This can be achieved by using a regular expression with the global flag to replace all occurrences of backslashes with double backslashes. Additionally, we should ensure that backticks are also escaped correctly.
- We will modify the string replacement on line 306 to first escape backslashes and then escape backticks.
- This change will be made in the
createTableColumns
function within the filedrizzle-kit/src/introspect-sqlite.ts
.
-
Copy modified line R307
@@ -306,2 +306,3 @@ | ||
it.generated.as | ||
.replace(/\\/g, '\\\\') | ||
.replace(/`/g, '\\`') |
c352c09
to
b72a139
Compare
Squash all commits into one commit
Tests results for SingleStore
Drizzle-kit
tests resultDrizzle-orm
tests resultDrizzle-orm
type tests resultIntegration-tests
results