Skip to content

Tighten storage pool permissions (from Incus)#16904

Merged
tomponline merged 5 commits into
canonical:mainfrom
tomponline:tp-perms
Nov 10, 2025
Merged

Tighten storage pool permissions (from Incus)#16904
tomponline merged 5 commits into
canonical:mainfrom
tomponline:tp-perms

Conversation

@tomponline

@tomponline tomponline commented Nov 10, 2025

Copy link
Copy Markdown
Member

Pulls in fix from lxc/incus#2642

Related to lxc/incus#2641

Fix for GHSA-56mx-8g9f-5crf CVE-2025-64507

Related to lxc/incus#2641

Signed-off-by: Stéphane Graber <stgraber@stgraber.org>
(cherry picked from commit b0c6c0bac42c6ac27d536984cc043a6ec02b9e7c)
Signed-off-by: Thomas Parrott <thomas.parrott@canonical.com>
License: Apache-2.0

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enhances the storage pool directory structure by introducing configurable file mode permissions for different volume types. It replaces the simple string slice mapping with a structured approach that includes both directory paths and their associated permissions.

Key Changes

  • Introduced baseDirectory struct to store both directory paths and file mode permissions
  • Updated BaseDirectories map to use the new struct, with 0o711 for containers/VMs/buckets and 0o700 for custom volumes/images
  • Added a patch to retroactively apply correct permissions to existing storage pools

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
lxd/storage/drivers/volume.go Defines new baseDirectory struct and updates BaseDirectories map with mode permissions
lxd/storage/drivers/generic_vfs.go Updates volume listing to access BaseDirectories[volType].Paths
lxd/storage/drivers/driver_zfs_utils.go Updates initial dataset creation to access BaseDirectories[volType].Paths
lxd/storage/drivers/driver_btrfs.go Updates subvolume deletion to access BaseDirectories[volType].Paths
lxd/storage/backend_lxd.go Updates storage structure creation to use both .Paths and .Mode from new struct, improves error checking with errors.Is(err, fs.ErrExist)
lxd/patches.go Adds patch to apply correct permissions to existing storage pool directories

Comment thread lxd/patches.go

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Comment thread test/suites/storage.sh
tomponline and others added 3 commits November 10, 2025 10:58
…seDirectories permissions

Signed-off-by: Thomas Parrott <thomas.parrott@canonical.com>
Signed-off-by: Thomas Parrott <thomas.parrott@canonical.com>
Related to lxc/incus#2641

Signed-off-by: Stéphane Graber <stgraber@stgraber.org>
(cherry picked from commit 3abdc12cf6a8dce391d28d340a32c137125357dd)
Signed-off-by: Thomas Parrott <thomas.parrott@canonical.com>
License: Apache-2.0
@tomponline tomponline force-pushed the tp-perms branch 2 times, most recently from 973a3f5 to 2fc60bd Compare November 10, 2025 11:02
Signed-off-by: Thomas Parrott <thomas.parrott@canonical.com>

@simondeziel simondeziel left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks

@tomponline tomponline merged commit 698854d into canonical:main Nov 10, 2025
71 of 72 checks passed
@tomponline tomponline deleted the tp-perms branch November 10, 2025 14:40
@gibmat

gibmat commented Nov 11, 2025

Copy link
Copy Markdown
Contributor

Is there a timeline for getting this fix into the stable-5.21 and stable-5.0 branches?

@tomponline

tomponline commented Nov 11, 2025

Copy link
Copy Markdown
Member Author

Is there a timeline for getting this fix into the stable-5.21 and stable-5.0 branches?

Hi @gibmat

I'm working on the backports now:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants