Skip to content

Configuration merge doesn't make sense for credential-provider #14906

Closed
@kornelski

Description

Problem

When merging multiple config.toml files, Cargo concatenates arrays. For the registries.….credential-provider setting this merging is counter-productive, because it constructs an invalid command.

Steps

When there's more than one applicable cargo.toml file that contains:

[registries.custom]
credential-provider = ["cargo:token-from-stdout", "command", "arguments"]

after merging, it becomes:

[registries.custom]
credential-provider = ["cargo:token-from-stdout", "command", "arguments", "cargo:token-from-stdout", "command", "arguments"]

and results in Cargo running command arguments cargo:token-from-stdout command arguments, which contains wrong arguments, and can fail in very confusing ways.

It's particularly easy to end up with exact duplicates of a custom registry configuration when configs are injected by build tools or projects have their own copy in addition to per-user or per-host configs.

Possible Solution(s)

The credential-provider field should be replaced, not concatenated, when merging config files.

Notes

No response

Version

cargo 1.83.0 (5ffbef321 2024-10-29)

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-configurationArea: cargo config files and env varsA-credential-providerArea: credential provider for storing and retreiving credentialsC-bugCategory: bugS-acceptedStatus: Issue or feature is accepted, and has a team member available to help mentor or reviewS-needs-team-inputStatus: Needs input from team on whether/how to proceed.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions