From: Dominik Csapak <d.csapak@proxmox.com>
To: Proxmox Backup Server development discussion
<pbs-devel@lists.proxmox.com>,
Hannes Laimer <h.laimer@proxmox.com>
Subject: Re: [pbs-devel] [PATCH proxmox-backup 1/2] pull: fix permission checks for local syncs
Date: Tue, 28 Nov 2023 15:39:18 +0100 [thread overview]
Message-ID: <d141964b-333f-4c6a-9317-f3c876342ca2@proxmox.com> (raw)
In-Reply-To: <20231128141654.323631-1-h.laimer@proxmox.com>
with that i can now sync snapshots that can be read from the local user
code seems fine to me but i'm not sure about the PRIV_DATASTORE_READ and
PRIV_DATASTORE_BACKUP use in the last hunk (i don't have a deep understanding
of the code but i couldn't find an issue by testing), so it's only:
Tested-by: Dominik Csapak <d.csapak@proxmox.com>
On 11/28/23 15:16, Hannes Laimer wrote:
> Reported-by: Dominik Csapak <d.csapak@proxmox.com>
> Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
> ---
> src/api2/config/sync.rs | 10 ++++------
> src/server/pull.rs | 6 +++---
> 2 files changed, 7 insertions(+), 9 deletions(-)
>
> diff --git a/src/api2/config/sync.rs b/src/api2/config/sync.rs
> index ea0e08f1..8809465c 100644
> --- a/src/api2/config/sync.rs
> +++ b/src/api2/config/sync.rs
> @@ -8,8 +8,8 @@ use proxmox_schema::{api, param_bail};
>
> use pbs_api_types::{
> Authid, SyncJobConfig, SyncJobConfigUpdater, JOB_ID_SCHEMA, PRIV_DATASTORE_AUDIT,
> - PRIV_DATASTORE_BACKUP, PRIV_DATASTORE_MODIFY, PRIV_DATASTORE_PRUNE, PRIV_DATASTORE_READ,
> - PRIV_REMOTE_AUDIT, PRIV_REMOTE_READ, PROXMOX_CONFIG_DIGEST_SCHEMA,
> + PRIV_DATASTORE_BACKUP, PRIV_DATASTORE_MODIFY, PRIV_DATASTORE_PRUNE, PRIV_REMOTE_AUDIT,
> + PRIV_REMOTE_READ, PROXMOX_CONFIG_DIGEST_SCHEMA,
> };
> use pbs_config::sync;
>
> @@ -70,11 +70,9 @@ pub fn check_sync_job_modify_access(
>
> if let Some(remote) = &job.remote {
> let remote_privs = user_info.lookup_privs(auth_id, &["remote", remote, &job.remote_store]);
> - remote_privs & PRIV_REMOTE_READ != 0
> - } else {
> - let source_ds_privs = user_info.lookup_privs(auth_id, &["datastore", &job.remote_store]);
> - source_ds_privs & PRIV_DATASTORE_READ != 0
> + return remote_privs & PRIV_REMOTE_READ != 0;
> }
> + true
> }
>
> #[api(
> diff --git a/src/server/pull.rs b/src/server/pull.rs
> index 1403c7a7..66ef333a 100644
> --- a/src/server/pull.rs
> +++ b/src/server/pull.rs
> @@ -17,7 +17,7 @@ use serde_json::json;
> use pbs_api_types::{
> print_store_and_ns, Authid, BackupDir, BackupGroup, BackupNamespace, CryptMode, GroupFilter,
> GroupListItem, Operation, RateLimitConfig, Remote, SnapshotListItem, MAX_NAMESPACE_DEPTH,
> - PRIV_DATASTORE_AUDIT, PRIV_DATASTORE_BACKUP,
> + PRIV_DATASTORE_AUDIT, PRIV_DATASTORE_BACKUP, PRIV_DATASTORE_READ,
> };
> use pbs_client::{BackupReader, BackupRepository, HttpClient, RemoteChunkReader};
> use pbs_config::CachedUserInfo;
> @@ -271,8 +271,8 @@ impl PullSource for LocalSource {
> &self.store,
> namespace.clone(),
> 0,
> - None,
> - None,
> + Some(PRIV_DATASTORE_READ),
> + Some(PRIV_DATASTORE_BACKUP),
> Some(owner),
> )?
> .filter_map(Result::ok)
next prev parent reply other threads:[~2023-11-28 14:39 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-28 14:16 Hannes Laimer
2023-11-28 14:16 ` [pbs-devel] [PATCH proxmox-backup 2/2] ui: fix changing remote to local sync job Hannes Laimer
2023-11-28 14:40 ` Dominik Csapak
2023-11-28 14:39 ` Dominik Csapak [this message]
2023-11-28 16:38 ` [pbs-devel] applied: [PATCH proxmox-backup 1/2] pull: fix permission checks for local syncs Thomas Lamprecht
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d141964b-333f-4c6a-9317-f3c876342ca2@proxmox.com \
--to=d.csapak@proxmox.com \
--cc=h.laimer@proxmox.com \
--cc=pbs-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox