Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion agent/secret_sources/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ def parse_secret_output(stdout: str, wanted_key: str) -> Optional[str]:
]
for line in dotenv_lines:
m = _ENV_LINE.match(line)
assert m is not None # filtered above
if m is None:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The preceding comprehension retains only lines for which this same _ENV_LINE.match succeeded. Under python -O, removing the assertion does not itself make this second match fail; please provide a reachable condition and regression test for this guard, or reframe it as defensive cleanup.

continue # pragma: no cover — filtered above, defensive guard
if m.group(1) == wanted_key:
value = unquote_dotenv_value(m.group(2))
# Whitespace-only (e.g. a quoted `K=" "` placeholder) is "no
Expand Down
Loading