From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id 6C98B1FF14C for ; Fri, 15 May 2026 11:22:33 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 4FCBA1345A; Fri, 15 May 2026 11:22:33 +0200 (CEST) Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Fri, 15 May 2026 11:22:30 +0200 Message-Id: Subject: Re: [PATCH datacenter-manager 2/4] add api_cache as a specialized wrapper around the namespaced cache From: "Lukas Wagner" To: "Thomas Lamprecht" , "Lukas Wagner" X-Mailer: aerc 0.21.0-0-g5549850facc2-dirty References: <20260513135457.573414-1-l.wagner@proxmox.com> <20260513135457.573414-3-l.wagner@proxmox.com> <20260515090637.950992-2-t.lamprecht@proxmox.com> In-Reply-To: <20260515090637.950992-2-t.lamprecht@proxmox.com> X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1778836944339 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.054 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: IKCBWMFTYDPJFMSMGFGSJ3HLRGTZ3IZX X-Message-ID-Hash: IKCBWMFTYDPJFMSMGFGSJ3HLRGTZ3IZX X-MailFrom: l.wagner@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: pdm-devel@lists.proxmox.com X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox Datacenter Manager development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On Fri May 15, 2026 at 11:06 AM CEST, Thomas Lamprecht wrote: > On Wed, 13 May 2026 15:54:55 +0200, Lukas Wagner wrote: >> diff --git a/server/src/api_cache.rs b/server/src/api_cache.rs >> new file mode 100644 >> --- /dev/null >> +++ b/server/src/api_cache.rs >> @@ -0,0 +1,126 @@ > [...] >> +const GLOBAL_NAMESPACE: &str =3D "global"; >> +const LOCK_TIMEOUT: Duration =3D Duration::from_secs(10); >> + >> +static CACHE: LazyLock =3D LazyLock::new(|| { >> + let file_options =3D proxmox_product_config::default_create_options= (); >> + let dir_options =3D file_options.perm(Mode::from_bits_truncate(0o75= 0)); > > w.r.t. 0o750 mode for per-namespace subdirectories here and ... > >> + >> + NamespacedCache::new(PathBuf::from(PDM_API_CACHE_PATH), dir_options= , file_options) >> +}); > >> diff --git a/server/src/bin/proxmox-datacenter-privileged-api.rs b/serve= r/src/bin/proxmox-datacenter-privileged-api.rs >> --- a/server/src/bin/proxmox-datacenter-privileged-api.rs >> +++ b/server/src/bin/proxmox-datacenter-privileged-api.rs >> @@ -102,6 +102,13 @@ fn create_directories() -> Result<(), Error> { > [...] >> + pdm_config::setup::mkdir_perms( >> + api_cache::PDM_API_CACHE_PATH, >> + api_user.uid, >> + api_user.gid, >> + 0o755, >> + )?; > > .. the cache root is created with 0o755 here - is that on purpose? With > the current modes any local user can list the cache root and see which > remotes have cached data from the directory names, even though they > cannot read the cached contents. Either drop the root to 0o750 to match, > or add a short comment explaining why the two levels differ. Good catch! This was a copy-paste mistake, the mkdir_perms call was copied from from a section above. will be fixed for the next revision, I'll change it to 0o750. Thanks!