MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / create_dir_restricted

Function create_dir_restricted

crates/openshell-core/src/paths.rs:70–76  ·  view source on GitHub ↗

Create a directory (and parents) with owner-only permissions (`0o700`) on Unix. On non-Unix platforms, falls back to default permissions. This should be used for any directory that contains sensitive material (tokens, private keys, certificates).

(path: &Path)

Source from the content-addressed store, hash-verified

68/// This should be used for any directory that contains sensitive material
69/// (tokens, private keys, certificates).
70pub fn create_dir_restricted(path: &Path) -> Result<()> {
71 std::fs::create_dir_all(path)
72 .into_diagnostic()
73 .wrap_err_with(|| format!("failed to create {}", path.display()))?;
74 set_dir_owner_only(path)?;
75 Ok(())
76}
77
78/// Set a directory to owner-only access (`0o700`) on Unix.
79///

Callers 10

store_pki_bundleFunction · 0.85
write_local_bundleFunction · 0.85
write_local_tls_bundleFunction · 0.85
write_local_jwt_bundleFunction · 0.85
install_ssh_configFunction · 0.85
write_sandbox_token_fileFunction · 0.85
write_sandbox_token_fileFunction · 0.85
write_forward_pidFunction · 0.85

Calls 1

set_dir_owner_onlyFunction · 0.85

Tested by 1