From 07b676e90118c3da41a10204b3f7f5b9cebbd812 Mon Sep 17 00:00:00 2001 From: Johannes Kirschbauer Date: Fri, 16 May 2025 18:09:53 +0200 Subject: [PATCH] Fix: missing recipient should print a message --- pkgs/clan-cli/clan_cli/secrets/sops.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkgs/clan-cli/clan_cli/secrets/sops.py b/pkgs/clan-cli/clan_cli/secrets/sops.py index 898dd877a..defa23788 100644 --- a/pkgs/clan-cli/clan_cli/secrets/sops.py +++ b/pkgs/clan-cli/clan_cli/secrets/sops.py @@ -297,6 +297,13 @@ def get_public_age_keys(contents: str) -> set[str]: if match: recipient = match[1] + if not recipient: + msg = ( + f"Empty or invalid recipient on line {line_number}. " + "Expected a valid `# recipient: age1...` comment or a recognized recipient format." + ) + raise ClanError(msg) + keys.add(recipient) if line.startswith("#"):