Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/clients/mssql/mssql.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ func (c mssqlDB) GetConnectionDetails(username, password string) managed.Connect

// QuoteIdentifier for mssql queries
func QuoteIdentifier(id string) string {
return "[" + id + "]"
return "[" + strings.ReplaceAll(id, "]", "]]") + "]"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Security: No unit tests exist for QuoteIdentifier or QuoteValue

No unit tests exist for QuoteIdentifier or QuoteValue. Regressions to this SQL injection fix would go undetected. Add table-driven tests covering ], ]], empty string, and embedded [ inputs.

View Details

Location: pkg/clients/mssql/mssql.go (lines 124)

Analysis

No unit tests exist for QuoteIdentifier or QuoteValue

What fails There are no tests for QuoteIdentifier or QuoteValue in the mssql package, so regressions to this critical SQL injection fix would not be caught.
Result No test files found — zero coverage for quoting functions.
Expected Table-driven unit tests should cover edge cases: input containing ], input containing ]], empty string, embedded [ characters, and normal identifiers.
Impact Without tests, future changes could silently reintroduce the SQL injection vulnerability this PR fixes.
How to reproduce
ls pkg/clients/mssql/*_test.go  # No test files exist
AI Fix Prompt
Fix this issue: No unit tests exist for QuoteIdentifier or QuoteValue. Regressions to this SQL injection fix would go undetected. Add table-driven tests covering ], ]], empty string, and embedded [ inputs.

Location: pkg/clients/mssql/mssql.go (lines 124)
Problem: There are no tests for QuoteIdentifier or QuoteValue in the mssql package, so regressions to this critical SQL injection fix would not be caught.
Current behavior: No test files found — zero coverage for quoting functions.
Expected: Table-driven unit tests should cover edge cases: input containing ], input containing ]], empty string, embedded [ characters, and normal identifiers.
Steps to reproduce: ls pkg/clients/mssql/*_test.go  # No test files exist

Provide a code fix.

Tip: Reply with @paragon-run to automatically fix this issue

}

// QuoteValue for mssql queries
Expand Down