Skip to content

std::fs::copy sets permissions too late #26933

Closed
@ben0x539

Description

@ben0x539

std::fs::copy makes a new file, reads permissions of the old file, copies contents of the old file to the new file, and then sets permissions of the new file to those it just read. If used to copy a file that is only readable to the current user into a public directory, there's an opportunity for another user to get ahold of the just-created file before permissions are set and read all the secret data. I think it needs to create the file with the right permissions to begin with.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-feature-acceptedCategory: A feature request that has been accepted pending implementation.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions