[PR #2811] [MERGED] check if data folder is a writable directory #3156

Closed
opened 2026-03-03 09:41:25 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/dani-garcia/vaultwarden/pull/2811
Author: @stefan0xC
Created: 10/11/2022
Status: Merged
Merged: 10/14/2022
Merged by: @dani-garcia

Base: mainHead: check-data-folder-permissions


📝 Commits (2)

  • 7532072 add check if data folder is a directory
  • 2dd5086 more verbose permission denied error

📊 Changes

2 files changed (+15 additions, -2 deletions)

View changed files

📝 src/main.rs (+4 -0)
📝 src/util.rs (+11 -2)

📄 Description

Adds a check if the data folder is a directory and also returns a more verbose error message if the permission was denied when creating a file.

I tried adding something like the following to check_data_folder() as well

let metadata = path.metadata().unwrap();
if metadata.permissions().readonly() {
    warn!("Data folder '{}' is read-only.", data_folder);
}

However, this does not really work because readonly() only checks if anyone has write permissions. 😖


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/dani-garcia/vaultwarden/pull/2811 **Author:** [@stefan0xC](https://github.com/stefan0xC) **Created:** 10/11/2022 **Status:** ✅ Merged **Merged:** 10/14/2022 **Merged by:** [@dani-garcia](https://github.com/dani-garcia) **Base:** `main` ← **Head:** `check-data-folder-permissions` --- ### 📝 Commits (2) - [`7532072`](https://github.com/dani-garcia/vaultwarden/commit/7532072d50bd030bb7fd3b900af571049ef5378b) add check if data folder is a directory - [`2dd5086`](https://github.com/dani-garcia/vaultwarden/commit/2dd508691689d4f5a9c39f411837300666f4dfc7) more verbose permission denied error ### 📊 Changes **2 files changed** (+15 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `src/main.rs` (+4 -0) 📝 `src/util.rs` (+11 -2) </details> ### 📄 Description Adds a check if the data folder is a directory and also returns a more verbose error message if the permission was denied when creating a file. I tried adding something like the following to `check_data_folder()` as well ```rust let metadata = path.metadata().unwrap(); if metadata.permissions().readonly() { warn!("Data folder '{}' is read-only.", data_folder); } ``` However, this does not really work because [`readonly()`](https://github.com/rust-lang/rust/blob/5237c4d83db0a04a0119918b174ee642acd82d9c/library/std/src/sys/unix/fs.rs#L510-L513) only checks if _anyone_ has write permissions. :confounded: --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-03 09:41:25 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/vaultwarden#3156
No description provided.