Skip to content

Add ScopedPrivileges RAII and sanitize env on elevation - #3138

Open
dxapd wants to merge 2 commits into
google:mainfrom
dxapd:nftables-privilege-raii
Open

Add ScopedPrivileges RAII and sanitize env on elevation#3138
dxapd wants to merge 2 commits into
google:mainfrom
dxapd:nftables-privilege-raii

Conversation

@dxapd

@dxapd dxapd commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator

this pr does two things:

  1. create a RAII abstraction for holding elevated privileges
  2. within that abstraction, sanitize the entire provided environment, including the PATH, before elevating

not going to wire it up to cvdalloc until the final PR, though

@dxapd
dxapd marked this pull request as ready for review September 3, 2026 22:29
@dxapd
dxapd requested a review from 3405691582 September 3, 2026 22:30
@dxapd

dxapd commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator Author

@3405691582 we can continue the discussion about whether or not the sanitization is necessary here. imo it's not a huge deal, but there's no harm in doing it given that we are using the PATH variable and also transitively conferring elevated caps onto other binaries.

Comment thread base/cvd/cuttlefish/host/commands/cvdalloc/privilege.cpp
Comment thread base/cvd/cuttlefish/host/commands/cvdalloc/privilege.cpp
Comment thread base/cvd/cuttlefish/host/commands/cvdalloc/privilege.cpp Outdated
Comment thread base/cvd/cuttlefish/host/commands/cvdalloc/privilege.cpp Outdated
Comment thread base/cvd/cuttlefish/host/commands/cvdalloc/privilege.cpp
Comment thread base/cvd/cuttlefish/host/commands/cvdalloc/privilege.cpp
@dxapd
dxapd force-pushed the nftables-privilege-raii branch from 76af9c4 to 82b4a73 Compare September 10, 2026 23:16
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.

2 participants