redpanda-data / redpanda-data/connect

URL encode username/password in sql_raw

Open
#1,853 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

configuration enhancement needs investigation ux
Dominant language
Go
Stars
8.8k
Forks
969
Avg merge
1d 13h
Merged PRs (30d)
64

Description

Hi, could we automatically URL-encode the DSN URI in sql_raw component? I think this could be handled transparently by Benthos, the client should not have to take care of that.

Here is my scenario:
I have a secrets manager storing a database password which is shared with other applications and that password is passed to Benthos as an environment variable, which is configured in sql_raw like:

- sql_raw:
    driver: postgres
    dsn: >-
      postgres://${DATABASE_USERNAME}@${DATABASE_HOST}:${DATABASE_PORT}/${DATABASE_NAME}?sslmode=disable&connect_timeout=10&password=${DATABASE_PASSWORD}
    query: |-
      SELECT blalbalba FROM popcorn

Since the field does not support interpolation, the current implementation forces me to have another environment variable like DATABASE_PASSWORD_URL_ENCODED and that is not really good to maintain.

As usual, any alternative ideas are appreciated.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names the sql_raw component and its dsn field; start by locating that component’s DSN handling and inspecting how PostgreSQL connection strings are passed through. Define and test the expected encoding behavior for credentials using the supplied environment-variable example, then verify existing sql_raw behavior remains intact.

Written by the indexing model from the issue text.

Assessment

Tech stack
postgres
Domain
databases
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.