[pbs-devel] [PATCH v5 proxmox-backup 17/31] api: config: extend modify access check by sync direction

Christian Ebner c.ebner at proxmox.com
Fri Oct 25 15:24:38 CEST 2024


On 10/25/24 12:17, Fabian Grünbichler wrote:
> On October 18, 2024 10:42 am, Christian Ebner wrote:
>> -    if let Some(remote) = &job.remote {
>> -        let remote_privs = user_info.lookup_privs(auth_id, &["remote", remote, &job.remote_store]);
>> -        return remote_privs & PRIV_REMOTE_READ != 0;
>> +            if let Some(true) = job.remove_vanished {
>> +                // check user is allowed to prune backup snapshots on remote datastore
>> +                if target_privs & PRIV_REMOTE_DATASTORE_PRUNE == 0 {
>> +                    return false;
>> +                }
>> +            }
>> +
>> +            // check user is not the owner of the sync job, but has remote datastore modify permissions
>> +            if !is_correct_owner(auth_id, job) && target_privs & PRIV_REMOTE_DATASTORE_MODIFY == 0 {
>> +                return false;
>> +            }
>> +
>> +            // check user is allowed to read from (local) source datastore/namespace
>> +            let source_privs = user_info.lookup_privs(auth_id, &job.acl_path());
>> +            if source_privs & PRIV_DATASTORE_AUDIT == 0 {
>> +                return false;
>> +            }
>> +            source_privs & PRIV_DATASTORE_READ != 0
> 
> wouldn't PRIV_DATASTORE_BACKUP be enough here? the user doesn't need to
> be able to read the whole datastore, just their own backups? of course,
> READ implies BACKUP, so you could check for either here..

Acked, added the additional check.




More information about the pbs-devel mailing list