Skip to content
Merged
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
15 changes: 6 additions & 9 deletions ctfcli/cli/challenges.py
Original file line number Diff line number Diff line change
Expand Up @@ -753,17 +753,14 @@ def deploy(

deployment_result = deployment_handler.deploy(skip_login=skip_login)

# Don't modify the connection_info if it exists already
if challenge_instance.get("connection_info"):
click.secho("Using connection_info from challenge.yml", fg="yellow")

# Otherwise, use connection_info from the deployment result if provided
elif deployment_result.connection_info:
# Save connection_info from the deployment result if returned
if deployment_result.connection_info:
click.secho("Saving connection_info in challenge.yml", fg="yellow")
challenge_instance["connection_info"] = deployment_result.connection_info

# Finally, if no connection_info was provided in the challenge and the
# deployment didn't result in one either, just ensure it's not present
else:
# If no connection_info was provided by the challenge
# and the deployment didn't result in one either, just ensure it's not present
elif not challenge_instance.get("connection_info"):
Comment on lines +761 to +763
Copy link

Copilot AI Dec 15, 2025

Choose a reason for hiding this comment

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

This condition should always execute when deployment_result.connection_info is falsy (line 757). The elif will never be reached when there's existing connection_info in challenge_instance and no deployment connection_info, leaving stale connection_info in place. Consider using 'else:' or explicitly checking 'if not deployment_result.connection_info:'.

Suggested change
# If no connection_info was provided by the challenge
# and the deployment didn't result in one either, just ensure it's not present
elif not challenge_instance.get("connection_info"):
# If no connection_info was provided by the deployment, just ensure it's not present
else:

Copilot uses AI. Check for mistakes.
challenge_instance["connection_info"] = None

if not deployment_result.success:
Expand Down