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

fix: always use a sql safe table name in failed events manager #2664

Merged
merged 1 commit into from
Nov 7, 2022

Conversation

atzoum
Copy link
Contributor

@atzoum atzoum commented Nov 7, 2022

Description

Extracted a common function for escaping the table name and including a scenario missed by #2663

Security

  • The code changed/added as part of this pull request won't create any security issues with how the software is being used.

@codecov
Copy link

codecov bot commented Nov 7, 2022

Codecov Report

Base: 45.45% // Head: 45.44% // Decreases project coverage by -0.01% ⚠️

Coverage data is based on head (9266b48) compared to base (0964e83).
Patch coverage: 58.33% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2664      +/-   ##
==========================================
- Coverage   45.45%   45.44%   -0.02%     
==========================================
  Files         287      287              
  Lines       47785    47790       +5     
==========================================
- Hits        21721    21716       -5     
- Misses      24689    24696       +7     
- Partials     1375     1378       +3     
Impacted Files Coverage Δ
router/failed-events-manager.go 12.71% <0.00%> (-0.22%) ⬇️
services/fileuploader/fileuploader.go 97.05% <100.00%> (+0.08%) ⬆️
config/backend-config/namespace_config.go 70.83% <0.00%> (-3.13%) ⬇️
services/rsources/handler.go 70.83% <0.00%> (-1.39%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@@ -188,3 +188,7 @@ func CleanFailedRecordsTableProcess(ctx context.Context) {
func (fem *FailedEventsManagerT) GetDBHandle() *sql.DB {
return fem.dbHandle
}

func getSqlSafeTablename(taskRunID string) string {
return `"` + strings.ReplaceAll(fmt.Sprintf(`%s_%s`, failedKeysTablePrefix, taskRunID), `"`, `""`) + `"`
Copy link
Member

Choose a reason for hiding this comment

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

pq.QuoteIdentifier can be used as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants