Skip to content

Commit

Permalink
Improve Windows security descriptor documentation in libparsec_platfo…
Browse files Browse the repository at this point in the history
…rm_mountpoint
  • Loading branch information
touilleMan committed Jan 20, 2025
1 parent daa9e7a commit 9643cc7
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions libparsec/crates/platform_mountpoint/src/windows/filesystem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,20 @@ use crate::windows::winify::winify_entry_name;

use super::winify::unwinify_entry_name;

/// we currently don't support arbitrary security descriptor and instead use only this one
/// https://docs.microsoft.com/fr-fr/windows/desktop/SecAuthZ/security-descriptor-string-format
// We don't support arbitrary security descriptor, and instead use a one-size-fits-all.
//
// To be honest, I'm genuinely impressed by how unreadable they managed to make this security descriptor format O_o
//
// Basically to have a chance deciphering this, you need to know:
// - `:` is not a separator between groups
// - There 3 groups, starting with `O:`, `G:`` and `D:`
// - The D group contains multiple sub-groups...
// - ...which are this time splitted by `;`
//
// For instance `O:BAG:BAD:P(A;;FRFX;;;SY)(A;;FRFX;;;BA)(A;;FRFX;;;WD)` is the read-only version
// of our current security descriptor (`FA` is "File All", `FRFX` is "File Read File Execute").
//
// See https://docs.microsoft.com/fr-fr/windows/desktop/SecAuthZ/security-descriptor-string-format
static SECURITY_DESCRIPTOR: Lazy<SecurityDescriptor> = Lazy::new(|| {
SecurityDescriptor::from_wstr(u16cstr!("O:BAG:BAD:P(A;;FA;;;SY)(A;;FA;;;BA)(A;;FA;;;WD)"))
.expect("unreachable, valid SecurityDescriptor")
Expand Down

0 comments on commit 9643cc7

Please sign in to comment.