Skip to content

A Cargo.toml file in parent directory which you cannot delete prevents cargo from building anything #12080

Closed as not planned
@cbeuw

Description

Problem

On a shared system, there is a directory (weirdly, but it could've been a file) named Cargo.toml under $HOME/... It is owned by root with 000 permission. As the parent directory still has r permission, a cargo project under $HOME cannot be built as cargo will detect the bad Cargo.toml, attempt to access it and then error out with permission denied.

A root user could put a Cargo.toml under / which acts a system-wide DoS against cargo for other users.

I know this recursive look up is expected behaviour, but it doesn't really play well with file permissions on shared systems. This is unlike .cargo/config.toml where each user can override the parent directory with a more specific one.

Steps

No response

Possible Solution(s)

Add a flag, say --workspace-lookup-depth=n, to prevent cargo from looking more than n levels up the file system

Notes

No response

Version

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: bugS-triageStatus: This issue is waiting on initial triage.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions