This repository was archived by the owner on Oct 31, 2025. It is now read-only.
Potential fix for code scanning alert no. 2: Potentially unsafe quoting #16
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Potential fix for https://github.com/cloudquery/databricks-sql-go/security/code-scanning/2
To fix the problem in
internal/rows/arrowbased/columnValues.go, we must ensure that when constructing a quoted string literal containing the output oft.String(), any embedded quotes or backslashes are escaped appropriately to avoid breaking the surrounding string. The best practice in Go, as discussed in the background, is to usejson.Marshal()to quote and escape the value, since it produces a properly-quoted and escaped JSON string.So, in the function
marshal(val any) ([]byte, error), instead of manually concatenating quotes aroundt.String(), we should serialize it usingjson.Marshal(t.String()). This will add double quotes and escape any embedded characters according to JSON rules. Change line 546 froms := "\"" + t.String() + "\"", to usejson.Marshal(t.String()), returning its bytes.No additional imports are required since
jsonis already imported.Change only the code within the
marshalfunction where atime.Timeis detected. No other changes are required.Suggested fixes powered by Copilot Autofix. Review carefully before merging.