Improve SQL parameter binding and escaping#965
Merged
Conversation
7ee759a to
a0ad65d
Compare
tsg
approved these changes
Jul 6, 2026
kvch
added a commit
that referenced
this pull request
Jul 6, 2026
|
Backport failed for Please cherry-pick the changes locally and resolve any conflicts. git fetch origin v0.9.x
git worktree add -d .worktree/backport-965-to-v0.9.x origin/v0.9.x
cd .worktree/backport-965-to-v0.9.x
git switch --create backport-965-to-v0.9.x
git cherry-pick -x 96da911d02464df77d6994ea18233bc20ca04bcb |
Merging this branch will not change overall coverage
Coverage by fileChanged files (no unit tests)
Please note that the "Total", "Covered", and "Missed" counts above refer to code statements instead of lines of code. The value in brackets refers to the test coverage of that file in the old version of the code. Changed unit test files
|
kvch
added a commit
that referenced
this pull request
Jul 6, 2026
…#968) Backport of #965 to `v0.9.x`. #### Description This addresses several SQL escaping issues, adapted for the v0.9.x branch: - Bind parameters where possible: the snapshot-request status query and the replication slot create/drop statements now use `$1` placeholders instead of `fmt.Sprintf`. - Validate the replication slot name (`IsValidReplicationSlotName`) before use. - `IsQuotedIdentifier` now validates the whole token rather than just checking the surrounding quotes, so malicious lookalikes (e.g. `"a" ; DROP TABLE users; --"`) are escaped rather than trusted as already-quoted. - Quote the role name when granting `rds_replication` during pg_dump/restore. #### Adaptations for v0.9.x Parts of #965 target functionality that doesn't exist on v0.9.x and were intentionally skipped: - **add-tables/filter-tables plugin argument escaping** — configurable plugin arguments don't exist on v0.9.x. - **`cleanupV09xState` event-trigger quoting** — that helper is v1.x-only. - **`UnquoteIdentifier` tests** — the function is v1.x-only. Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
This PR addresses multiple SQL issues in pgstream.
source.postgresql.replication.replication_slotis escaped correctlyIsQuotedIdentifiernot only checks if the quotes but validates the whole tokenType of Change
Please select the relevant option(s):
Testing
Checklist