fix: fix parse_postgres_uri not decoding password (#7157)

* nit overscroll auto

* decode password in parse_postgres_url

* don't encode host in pg_executor

* nit
This commit is contained in:
Diego Imbert
2025-11-17 11:29:44 +00:00
committed by GitHub
parent 767940c6fa
commit 2cae72c9db
5 changed files with 11 additions and 6 deletions
+1
View File
@@ -15452,6 +15452,7 @@ dependencies = [
"tracing-opentelemetry",
"tracing-subscriber",
"url",
"urlencoding",
"uuid",
"windmill-macros",
"windmill-parser",
+1
View File
@@ -86,6 +86,7 @@ openidconnect = { workspace = true, optional = true }
strum.workspace = true
strum_macros.workspace = true
url.workspace = true
urlencoding.workspace = true
async-recursion.workspace = true
semver.workspace = true
+6 -3
View File
@@ -341,7 +341,12 @@ pub fn parse_postgres_url(url: &str) -> Result<PostgresUrlComponents, Error> {
let scheme = parsed_url.scheme().to_string();
let username = parsed_url.username().to_string();
let username = urlencoding::decode(&username).map_err(to_anyhow)?.to_string();
let password = parsed_url.password().map(|p| p.to_string());
let password = match password {
Some(p) => Some(urlencoding::decode(&p).map_err(to_anyhow)?.to_string()),
None => None,
};
let host = parsed_url
.host_str()
.ok_or_else(|| Error::BadConfig("Missing host in PostgreSQL URL".to_string()))?
@@ -490,9 +495,7 @@ type Tag = String;
pub use db::DB;
use crate::{
auth::{PermsCache, FLOW_PERMS_CACHE, HASH_PERMS_CACHE},
db::{AuthedRef, UserDbWithAuthed},
scripts::ScriptHash,
auth::{FLOW_PERMS_CACHE, HASH_PERMS_CACHE, PermsCache}, db::{AuthedRef, UserDbWithAuthed}, error::to_anyhow, scripts::ScriptHash
};
#[derive(Clone)]
+1 -1
View File
@@ -241,7 +241,7 @@ pub async fn do_postgresql(
"postgres://{user}:{password}@{host}:{port}/{dbname}?sslmode={sslmode}",
user = encode(&database.user.unwrap_or("postgres".to_string())),
password = encode(&database.password.unwrap_or("".to_string())),
host = encode(&database.host),
host = database.host,
port = database.port.unwrap_or(5432),
dbname = database.dbname,
sslmode = sslmode
@@ -295,7 +295,7 @@
<Popover
class="absolute right-1.5"
enableFlyTransition
contentClasses="py-5 px-6 w-[34rem] bg-surface-secondary -translate-y-2"
contentClasses="py-5 px-6 w-[34rem] bg-surface-secondary -translate-y-2 overflow-y-auto"
closeOnOtherPopoverOpen
closeOnOutsideClick
bind:this={instanceCatalogPopover}
@@ -503,7 +503,7 @@
await instanceCatalogStatuses.refresh()
if (result.success) {
if (!wasAlreadySuccessful) sendUserToast('Setup successful')
else sendUserToast('Everything OK')
else sendUserToast('Check successful')
} else {
sendUserToast(result.error ?? 'An error occured', true)
}