Skip to content

Enforce proper permissions in store_secret #260

@cvengler

Description

@cvengler

I recently came across the following piece of code in the secret-memory crate:

impl<const N: usize> StoreSecret for Secret<N> {
    type Error = anyhow::Error;

    fn store_secret<P: AsRef<Path>>(&self, path: P) -> anyhow::Result<()> {
        std::fs::write(path, self.secret())?;
        Ok(())
    }
}

As far as I understand this, it does not ensure that the file has to proper permissions.
This is not acceptable, a secret must never be written into an insecure file.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions