Commit b1333cd
fix(oracle): normalize encoded proxy usernames in go-ora DSN (googleapis#2469)
## Summary
Fix Oracle go-ora DSN construction so proxy usernames with brackets
(`user[client]`) are handled correctly and pre-encoded usernames are not
double-encoded.
Fixes googleapis#2454.
## Root cause
`buildGoOraConnString` built DSNs using `url.URL{Host:
connectStringBase, User: url.UserPassword(...)}`.
For Oracle connect strings like `host:1521/SERVICE`, putting the full
value in `Host` is lossy for URL formatting and brittle for userinfo
handling.
Also, when a username is already percent-encoded (`user%5Bclient%5D`),
passing it directly to `url.UserPassword` can double-encode `%` without
normalization.
## Fix
- Normalize user/password with `url.PathUnescape` before URL userinfo
encoding.
- Construct DSN as:
- encoded userinfo (`url.UserPassword(...).String()`)
- raw Oracle connect string appended after `@` (preserves
`host:port/service` shape)
- Preserve wallet query args behavior (`ssl=true&wallet=...`).
## Tests
Added regression coverage in
`internal/sources/oracle/oracle_connstring_test.go`:
- bracketed proxy username is encoded correctly.
- already percent-encoded proxy username is not double-encoded.
- existing wallet/non-wallet DSN cases remain correct.
## Validation
- `go test ./internal/sources/oracle -run
'TestBuildGoOraConnString|TestParseFromYamlOracle|TestFailParseFromYaml'`
---------
Co-authored-by: DEVELOPER-DEEVEN <144827577+DEVELOPER-DEEVEN@users.noreply.github.com>
Co-authored-by: Wenxin Du <117315983+duwenxin99@users.noreply.github.com>1 parent 9590821 commit b1333cd
2 files changed
+110
-18
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
253 | 254 | | |
254 | 255 | | |
255 | 256 | | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
256 | 292 | | |
257 | 293 | | |
258 | 294 | | |
| |||
305 | 341 | | |
306 | 342 | | |
307 | 343 | | |
308 | | - | |
309 | | - | |
| 344 | + | |
310 | 345 | | |
311 | 346 | | |
312 | | - | |
313 | | - | |
| 347 | + | |
314 | 348 | | |
315 | | - | |
316 | | - | |
317 | | - | |
318 | 349 | | |
319 | 350 | | |
320 | 351 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
15 | 14 | | |
16 | 15 | | |
17 | 16 | | |
| |||
33 | 32 | | |
34 | 33 | | |
35 | 34 | | |
36 | | - | |
| 35 | + | |
37 | 36 | | |
38 | | - | |
| 37 | + | |
39 | 38 | | |
40 | 39 | | |
41 | 40 | | |
| |||
56 | 55 | | |
57 | 56 | | |
58 | 57 | | |
59 | | - | |
| 58 | + | |
60 | 59 | | |
61 | | - | |
| 60 | + | |
62 | 61 | | |
63 | 62 | | |
64 | 63 | | |
| |||
81 | 80 | | |
82 | 81 | | |
83 | 82 | | |
84 | | - | |
| 83 | + | |
85 | 84 | | |
86 | | - | |
| 85 | + | |
87 | 86 | | |
88 | 87 | | |
89 | 88 | | |
| |||
106 | 105 | | |
107 | 106 | | |
108 | 107 | | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
109 | 170 | | |
110 | 171 | | |
111 | 172 | | |
| |||
205 | 266 | | |
206 | 267 | | |
207 | 268 | | |
208 | | - | |
209 | | - | |
| 269 | + | |
| 270 | + | |
210 | 271 | | |
211 | | - | |
| 272 | + | |
212 | 273 | | |
213 | 274 | | |
214 | 275 | | |
| |||
0 commit comments