Commit ac90c6b
fix(postgresql): guard accountProvision substitution against bash 5.2 patsub_replacement and escape SQL quotes
bash >= 5.2 enables patsub_replacement by default: in an unquoted pattern
substitution replacement, & expands to the matched pattern and backslash
escapes — a password containing either was silently rewritten (account
created with a wrong password; verified 5.3 vs 3.2). Disable the shopt
before substituting (no-op on older bash).
Also close the SQL-literal boundary in the same block: escape embedded
single quotes ('' escape, portable form via a quote variable — the
backslash-escaped replacement form itself misbehaves on bash 3.2) so a
quote in a user-supplied password can no longer break the statement, leak
through psql's error context, or inject SQL in the superuser session.
Per integrated-tree review: #3054 (comment)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>1 parent 765ea97 commit ac90c6b
1 file changed
Lines changed: 16 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
257 | 257 | | |
258 | 258 | | |
259 | 259 | | |
260 | | - | |
261 | | - | |
262 | | - | |
263 | | - | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
264 | 276 | | |
265 | 277 | | |
266 | 278 | | |
| |||
0 commit comments