From looking at the current code, there doesn’t appear to be any legit reason for this to be in environment/config in cleartext.
Seems like changing this:
fn _validate_token(token: &str) -> bool {
match CONFIG.admin_token().as_ref() {
None => false,
Some(t) => crate::crypto::ct_eq(t.trim(), token.trim()),
}
}
to something including something close to this: (at least as a first check - to support both):
crypto::verify_password_hash(
token.trim().as_bytes(),
t.trim(), # assuming the salt will handle passing in actual value like crypt() c lib function
t.trim(),
self.password_iterations as u32,
)
Intent would be that it would get the cleartext token out of the environment/config/etc. I’d even suggest that the container log - if presented with a cleartext token, should output a “you can change to this for more security”.
Certainly anyone with access to the host could directly access DB, but if properly configured, that wouldn’t be an externally accessible exposure.
The other side of this - I’d like to have the admin token usable, but only provide to certain people for remote access - that may not include all of the people with system admin permission.