Skip to content

fix(sources/postgres): apply URL encoding to query string params#3020

Open
sjvanrossum wants to merge 2 commits intogoogleapis:mainfrom
sjvanrossum:main
Open

fix(sources/postgres): apply URL encoding to query string params#3020
sjvanrossum wants to merge 2 commits intogoogleapis:mainfrom
sjvanrossum:main

Conversation

@sjvanrossum
Copy link
Copy Markdown

@sjvanrossum sjvanrossum commented Apr 10, 2026

Description

Fixes an URL encoding issue in PostgreSQL connection strings. Keys and values of query parameter maps are currently not escaped during encoding, which could result in misconfiguration and poses a minor security risk if the specification of query parameter maps were to be restricted by the application or deployment tooling.

PR Checklist

Thank you for opening a Pull Request! Before submitting your PR, there are a
few things you can do to make sure it goes smoothly:

  • Make sure you reviewed
    CONTRIBUTING.md
  • Make sure to open an issue as a
    bug/issue
    before writing your code! That way we can discuss the change, evaluate
    designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)
  • Make sure to add ! if this involve a breaking change

🛠️ Fixes #<issue_number_goes_here>

@sjvanrossum sjvanrossum requested a review from a team as a code owner April 10, 2026 08:57
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the ConvertParamMapToRawQuery function in the Postgres source to utilize url.Values for building query strings, which improves reliability and allows for the removal of the strings import. A review comment suggests optimizing performance by pre-allocating the url.Values map with the size of the input parameters.

Comment thread internal/sources/postgres/postgres.go Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants