oracledb_exporter icon indicating copy to clipboard operation
oracledb_exporter copied to clipboard

DATA_SOURCE_NAME EnvVar unparseable if password contains hash/pound/# symbol

Open dmitrydonskih opened this issue 2 years ago • 2 comments

I'm submitting a ...

  • [x] bug report
  • [ ] feature request

What is the current behavior?

Binary starts and throws an error "invalid port \":XxXxX\" after host" if password in URI string contains # symbol.

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem

$ export DATA_SOURCE_NAME=oracle://user:PaSs#wOrd@testora:1521/TEST1
$ echo $DATA_SOURCE_NAME
oracle://user:PaSs#wOrd@testora:1521/TEST1
$ /usr/local/bin/oracledb_exporter-0.5.2 --default.metrics "/etc/oracledb_exporter/default-metrics.toml" --log.level debug --web.listen-address 0.0.0.0:9161
ts=2023-11-21T22:36:57.951Z caller=collector.go:327 level=debug launchingconnection:=***@testora:1521/TEST1
ts=2023-11-21T22:36:57.951Z caller=collector.go:333 level=debug setmaxidleconnectionsto=0
ts=2023-11-21T22:36:57.951Z caller=collector.go:335 level=debug setmaxopenconnectionsto=10
ts=2023-11-21T22:36:57.951Z caller=collector.go:337 level=debug successfullyconnectedto:=***@testora:1521/TEST1
ts=2023-11-21T22:36:57.951Z caller=collector.go:262 level=error errorpingingoracle:="parse \"oracle://user:PaSs\": invalid port \":PaSs\" after host"

What is the expected behavior?

Parse URI correctly: port=1521, password=PaSs#wOrd

What is the motivation / use case for changing the behavior?

Fix it

Please tell us about your environment:

Oracle Linux 8.8 5.4.17-2136.324.5.3.el7uek.x86_64 Version: 0.5.1, 0.5.2-rc

dmitrydonskih avatar Nov 21 '23 22:11 dmitrydonskih

Same problem ... i have problem with "#" in username as i'm connecting with a CDB User C## ...

ToMMy86 avatar Nov 22 '23 18:11 ToMMy86

The value is directly passed down to url.Parse (and treated as a URL).

Replacing "#" with its url encoded equivalent should fix the problem (i.e replace the # in your connection string with %23)

blast-o avatar Jan 09 '24 16:01 blast-o