Skip to content

Conversation

@MilyMilo
Copy link
Contributor

Always save connection info in challenge.yml if returned by the deployment handler.

If a deployment returns a connection_info string - it's guaranteed to be correct, and we should override the current connection_info. This prevents a case where leftover (e.g. from a previous event) connection_info strings are set during another even because they were saved in challenge.yml.

@ColdHeat ColdHeat requested a review from Copilot December 15, 2025 17:41
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR modifies the connection info handling logic in the challenge deployment process. Previously, existing connection info in challenge.yml was preserved and took precedence over deployment results. Now, deployment results always override existing connection info when provided, ensuring accuracy and preventing stale connection info from being used across events.

  • Changes the precedence order so deployment-returned connection info always takes priority
  • Updates user messaging to indicate when connection info is being updated
  • Ensures connection info is only set to None when neither the deployment nor existing challenge provides it

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +761 to +763
# 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"):
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.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@ColdHeat ColdHeat merged commit b3f0d74 into CTFd:master Dec 15, 2025
8 checks passed
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.

2 participants