Rust

Rust

Made by DeepSource

Detected non-octal Unix permissions RS-E1013

Security
Critical

Using non-octal values to set Unix file permissions can result in unintended file permissions.

Prefer passing in an octal value to operations such as Permissions::from_mode to avoid unintended file permission modes.

Bad practice

use std::fs::DirBuilder;
use std::os::unix::fs::DirBuilderExt;

let mut builder = DirBuilder::new();
builder.mode(755);

Recommended

use std::fs::DirBuilder;
use std::os::unix::fs::DirBuilderExt;

let mut builder = DirBuilder::new();
builder.mode(0o755);

References