-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Aliases should not be able to shadow external subcommands #10049
Copy link
Copy link
Open
Labels
A-aliasesArea: command aliasesArea: command aliasesC-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`S-needs-mentorStatus: Issue or feature is accepted, but needs a team member to commit to helping and reviewing.Status: Issue or feature is accepted, but needs a team member to commit to helping and reviewing.
Metadata
Metadata
Assignees
Labels
A-aliasesArea: command aliasesArea: command aliasesC-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`S-needs-mentorStatus: Issue or feature is accepted, but needs a team member to commit to helping and reviewing.Status: Issue or feature is accepted, but needs a team member to commit to helping and reviewing.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Problem
If Ihave a repo that has, in it's
.cargo/config.toml,then running
cargo crevin this crate will run repo-controlled code, which could be a security problem. Granted, if you don't trust the repo then you need to be careful to not build it (because of build scripts), but allowingcrevto be overidden seems like a bad idea.Proposed Solution
Treat external subcommands (binaries with the name
cargo-<subcommand>) the same as known subcommands for purposes of aliasing.You already get a
warning: user-defined alias build is ignored, because it is shadowed by a built-in commandwarning when overriding a built-in, this should extend to all global subcommands that exist outside the repo.Notes
No response