Skip to content

Reject empty source public keys file in consolidate command - #801

Open
cyc60 wants to merge 3 commits into
masterfrom
fix-consolidate-empty-source-keys-file
Open

Reject empty source public keys file in consolidate command#801
cyc60 wants to merge 3 commits into
masterfrom
fix-consolidate-empty-source-keys-file

Conversation

@cyc60

@cyc60 cyc60 commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Description

An empty --source-public-keys-file passed CLI validation (validate_public_keys_file iterates lines, so a zero-line file is accepted) and loaded as an empty list. Since process() builds ConsolidationKeys only when source_public_keys is truthy, the command silently fell through to the auto-pick (ConsolidationSelector) path — ignoring the user's explicit --target-public-key and consolidating validators the user never chose, with no warning.

The consolidate command now raises a clean error when the provided source keys file yields no keys. Files with blank lines were already rejected upfront by the CLI callback, so the check targets the zero-keys case specifically. validate_public_keys_file is left unchanged, as it is shared with --exclude-public-keys-file, where an empty file is harmless.

Adds the first tests for the consolidate command (src/validators/commands/tests/test_consolidate.py).

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.

1 participant