From 3cfc56f5c26875854353f0813c9b39e05f8ac69f Mon Sep 17 00:00:00 2001 From: Thomas Lamprecht Date: Wed, 15 Jul 2020 08:33:22 +0200 Subject: [PATCH] cached user info: check_privs: print privilege path in error message As else this is really user unfriendly, and it not printing it has no advantage. If one doesn't wants to leak resource existence they just need to *always* check permissions before checking if the requested resource exists, if that's not done one can leak information also without getting the path returned (as the system will either print "resource doesn't exists" or "no permissions" respectively) Signed-off-by: Thomas Lamprecht --- src/config/cached_user_info.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/config/cached_user_info.rs b/src/config/cached_user_info.rs index 1e22afe0..56a7c475 100644 --- a/src/config/cached_user_info.rs +++ b/src/config/cached_user_info.rs @@ -89,7 +89,9 @@ impl CachedUserInfo { (user_privs & required_privs) == required_privs }; if !allowed { - bail!("no permissions"); + // printing the path doesn't leaks any information as long as we + // always check privilege before resource existence + bail!("no permissions on '/{}'", path.join("/")); } Ok(()) }