do not validate passwords, just forward them onto postgres

dont get access controls

add a new cleartext authsecret instead
This commit is contained in:
Conrad Ludgate
2025-06-27 16:38:23 +01:00
committed by Conrad Ludgate
parent da6419a45a
commit 56cc55d24a
7 changed files with 21 additions and 6 deletions

View File

@@ -45,6 +45,10 @@ pub(super) async fn authenticate(
server_key: secret.server_key.as_bytes(),
}
}
AuthSecret::Cleartext => {
ctx.set_auth_method(crate::context::AuthMethod::Cleartext);
return super::hacks::authenticate_cleartext(ctx, creds, client, secret, config).await;
}
};
Ok(ComputeCredentials {

View File

@@ -174,6 +174,8 @@ impl ComputeUserInfo {
#[cfg_attr(test, derive(Debug))]
pub(crate) enum ComputeCredentialKeys {
/// We don't convert passwords into auth keys, we just pass passwords onto postgres.
Password(Vec<u8>),
AuthKeys(AuthKeys),
JwtPayload(Vec<u8>),
}
@@ -244,11 +246,13 @@ async fn auth_quirks(
let secret = if let Some(secret) = role_access.secret {
secret
} else {
// If we don't have an authentication secret, we mock one to
// prevent malicious probing (possible due to missing protocol steps).
// This mocked secret will never lead to successful authentication.
info!("authentication info not found, mocking it");
AuthSecret::Scram(scram::ServerSecret::mock(rand::random()))
// // If we don't have an authentication secret, we mock one to
// // prevent malicious probing (possible due to missing protocol steps).
// // This mocked secret will never lead to successful authentication.
// info!("authentication info not found, mocking it");
// AuthSecret::Scram(scram::ServerSecret::mock(rand::random()))
AuthSecret::Cleartext
};
match authenticate_with_secret(

View File

@@ -187,5 +187,8 @@ pub(crate) async fn validate_password_and_exchange(
postgres_client::config::AuthKeys::ScramSha256(keys),
)))
}
AuthSecret::Cleartext => Ok(sasl::Outcome::Success(ComputeCredentialKeys::Password(
password.to_vec(),
))),
}
}

View File

@@ -177,6 +177,7 @@ impl AuthInfo {
ComputeCredentialKeys::AuthKeys(AuthKeys::ScramSha256(auth_keys)) => {
Some(Auth::Scram(Box::new(auth_keys)))
}
ComputeCredentialKeys::Password(pw) => Some(Auth::Password(pw)),
ComputeCredentialKeys::JwtPayload(_) => None,
},
server_params: StartupMessageParams::default(),

View File

@@ -43,6 +43,8 @@ pub mod mgmt;
pub(crate) enum AuthSecret {
/// [SCRAM](crate::scram) authentication info.
Scram(scram::ServerSecret),
/// Do not authenticate, just take the cleartext password and give it to postgres.
Cleartext,
}
#[derive(Default)]

View File

@@ -76,6 +76,7 @@
// List of temporarily allowed lints to unblock beta/nightly.
#![allow(unknown_lints)]
#![expect(
unused_imports,
dead_code,
reason = "
We are making minimal changes to proxy for lakebase-v2 integration.

View File

@@ -800,7 +800,7 @@ async fn handle_rest_inner(
.map_err(|e| RestError::SubzeroCore(JsonDeserialize { source: e }))?;
Some(payload)
}
ComputeCredentialKeys::AuthKeys(_) => None,
ComputeCredentialKeys::AuthKeys(_) | ComputeCredentialKeys::Password(_) => None,
};
// read the role from the jwt claims (and set it to the "anon" role if not present)