Skip to content

Allow CLI passwords starting with dash characters#1842

Open
rolandwalker wants to merge 1 commit intomainfrom
RW/allow-leading-hyphen-on-cli-passwords
Open

Allow CLI passwords starting with dash characters#1842
rolandwalker wants to merge 1 commit intomainfrom
RW/allow-leading-hyphen-on-cli-passwords

Conversation

@rolandwalker
Copy link
Copy Markdown
Contributor

@rolandwalker rolandwalker commented Apr 11, 2026

Description

Allow the argument to --password (and aliases) to start with a dash character, by stopping to pass the flag_value parameter to click.

Now --password (and aliases) always take a value at the CLI, unless given in the final position, in which case the flag works as a request for an interactive prompt.

This retains the mechanism of EMPTY_PASSWORD_FLAG_SENTINEL, just does not use flag_value to set the sentinel value.

There still remains the special-casing of DSNs after --password flags, which, while not related to the dash-character bug, still defines some special strings which can't be used as CLI password arguments.

Fixes #1752.

Checklist

  • I added this contribution to the changelog.md file.
  • I added my name to the AUTHORS file (or it's already there).
  • To lint and format the code, I ran
    uv run ruff check && uv run ruff format && uv run mypy --install-types .

@rolandwalker rolandwalker self-assigned this Apr 11, 2026
Allow the argument to --password (and aliases) to start with a dash
character, by stopping to pass the "flag_value" parameter to click.

Now --password (and aliases) always take a value at the CLI, unless
given in the final position, in which case the flag works as a request
for an interactive prompt.

This retains the mechanism of EMPTY_PASSWORD_FLAG_SENTINEL, just does
not use "flag_value" to set the sentinel value.

There still remains the special-casing of DSNs after --password flags,
which, while not related to the dash-character bug, still defines some
special strings which can't be used as CLI password arguments.
@rolandwalker rolandwalker force-pushed the RW/allow-leading-hyphen-on-cli-passwords branch from e0bc634 to 1fe534a Compare April 11, 2026 20:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Password value on the CLI cannot start with -

1 participant