Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

Relax mounted storage-root hardening semantics

rcourtmanf2746960d6e2
diff --git a/docs/release-control/v6/internal/subsystems/cloud-paid.md b/docs/release-control/v6/internal/subsystems/cloud-paid.md
index e0d845b7d0..cf1c077926 100644
--- a/docs/release-control/v6/internal/subsystems/cloud-paid.md
+++ b/docs/release-control/v6/internal/subsystems/cloud-paid.md
@@ -446,8 +446,9 @@ storage semantics for commercial state. `pkg/licensing/persistence.go` and
but they must not assume they can chmod the root of a writable Kubernetes or
container-mounted runtime data directory. When the mount root is writable but
not owned by the Pulse process, canonical persistence must keep file-level
-secrets hardened at `0600`, fail closed on world-writable storage roots, and
-continue operating instead of crashing just because the mount root itself
+secrets hardened at `0600`, validate that the resolved storage root is still
+the expected real directory rather than a symlink or other filesystem object,
+and continue operating instead of crashing just because the mount root itself
cannot be chmod-ed.
Hosted entitlement-source loading follows the same rule: `DatabaseSource` must
normalize persisted Cloud/MSP plan aliases and legacy limit keys before runtime
diff --git a/docs/release-control/v6/internal/subsystems/security-privacy.md b/docs/release-control/v6/internal/subsystems/security-privacy.md
index 7bf20e0f63..ea58aa6c9b 100644
--- a/docs/release-control/v6/internal/subsystems/security-privacy.md
+++ b/docs/release-control/v6/internal/subsystems/security-privacy.md
@@ -227,7 +227,10 @@ harden storage directories when Pulse owns them, but they must not assume the
process owns the mount root of a writable Kubernetes or container volume.
Mounted storage roots that are writable but not chmod-able must still support
secure startup, while sensitive leaf files such as `.encryption.key` remain
-file-hardened at `0600` and world-writable storage roots still fail closed.
+file-hardened at `0600`. The mount root itself must be validated as the real
+directory path rather than a symlink or other filesystem object, but its mode
+bits are not a fatal startup gate when Kubernetes or another runtime owns that
+mount point.
That same Security Overview surface must stay action-oriented once those
low-risk states are demoted out of the global banner:
`frontend-modern/src/components/Settings/SecurityOverviewPanel.tsx` and
diff --git a/internal/securityutil/secure_storage_dir.go b/internal/securityutil/secure_storage_dir.go
index 5e3f689566..81774069cd 100644
--- a/internal/securityutil/secure_storage_dir.go
+++ b/internal/securityutil/secure_storage_dir.go
@@ -17,8 +17,8 @@ var (
// permissions when possible. For pre-mounted runtime storage roots such as
// Kubernetes volume mounts, the running process may be able to write inside the
// directory without owning the mount root itself. In that case, permission
-// errors from chmod are tolerated as long as the existing directory is not
-// world-writable.
+// errors from chmod are tolerated as long as the resolved path is still the
+// expected real directory rather than a symlink or other filesystem object.
func EnsureSecureStorageDir(dir string, perm os.FileMode) error {
if err := secureStorageDirMkdirAllFn(dir, perm); err != nil {
return err
@@ -39,9 +39,6 @@ func EnsureSecureStorageDir(dir string, perm os.FileMode) error {
if !isStorageDirPermissionError(err) {
return err
}
- if info.Mode().Perm()&0o002 != 0 {
- return fmt.Errorf("cannot leave world-writable storage directory %q unhardened: %w", dir, err)
- }
return nil
}
diff --git a/internal/securityutil/secure_storage_dir_test.go b/internal/securityutil/secure_storage_dir_test.go
index 27b6b6ad2b..83472bc1ea 100644
--- a/internal/securityutil/secure_storage_dir_test.go
+++ b/internal/securityutil/secure_storage_dir_test.go
@@ -56,7 +56,7 @@ func TestEnsureSecureStorageDir_AllowsExistingCompatibleDirWhenChmodNotPermitted
}
}
-func TestEnsureSecureStorageDir_RejectsWorldWritableExistingDirWhenChmodNotPermitted(t *testing.T) {
+func TestEnsureSecureStorageDir_AllowsMountedDirWhenChmodNotPermitted(t *testing.T) {
t.Cleanup(resetSecureStorageDirFns)
secureStorageDirMkdirAllFn = func(string, os.FileMode) error { return nil }
@@ -64,9 +64,8 @@ func TestEnsureSecureStorageDir_RejectsWorldWritableExistingDirWhenChmodNotPermi
return stubFileInfo{mode: os.ModeDir | 0o777}, nil
}
secureStorageDirChmodFn = func(string, os.FileMode) error { return os.ErrPermission }
-
- if err := EnsureSecureStorageDir("/data", 0o700); err == nil {
- t.Fatal("expected world-writable directory error")
+ if err := EnsureSecureStorageDir("/data", 0o700); err != nil {
+ t.Fatalf("EnsureSecureStorageDir() error: %v", err)
}
}
@@ -82,3 +81,16 @@ func TestEnsureSecureStorageDir_RejectsSymlinkPaths(t *testing.T) {
t.Fatal("expected symlink directory error")
}
}
+
+func TestEnsureSecureStorageDir_RejectsNonDirectoryPaths(t *testing.T) {
+ t.Cleanup(resetSecureStorageDirFns)
+
+ secureStorageDirMkdirAllFn = func(string, os.FileMode) error { return nil }
+ secureStorageDirLstatFn = func(string) (os.FileInfo, error) {
+ return stubFileInfo{mode: 0o600}, nil
+ }
+
+ if err := EnsureSecureStorageDir("/data", 0o700); err == nil {
+ t.Fatal("expected non-directory path error")
+ }
+}