Skip to content

Conversation

kbukum1
Copy link
Contributor

@kbukum1 kbukum1 commented Aug 29, 2025

What are you trying to accomplish?

This fixes a KeyError: key not found: "host" that occurs in SharedHelpers.configure_git_to_use_https_with_credentials when processing credential entries that don't have a "host" key.

The error was introduced in the recent changes to support Git rewrite rules without credentials. The code was calling cred.fetch("host") without first checking if the "host" key exists, causing crashes when malformed or incomplete credential entries are processed.

Anything you want to highlight for special attention from reviewers?

Added a defensive check next unless cred["host"] before processing each credential entry. This approach:

  • Skips entries without a host (can't create URLs or configure Git rewrite rules without knowing the host)
  • Maintains the existing logic for valid entries
  • Prevents crashes from malformed credential data

This is a minimal, safe fix that doesn't change the core functionality.

How will you know you've accomplished your goal?

  • The KeyError stack trace should no longer occur when processing credentials
  • Existing functionality remains unchanged for valid credential entries
  • Invalid/incomplete credential entries are safely skipped rather than causing crashes
  • All existing tests continue to pass

Checklist

  • I have run the complete test suite to ensure all tests and linters pass.
  • I have thoroughly tested my code changes to ensure they work as expected, including adding additional tests for new functionality.
  • I have written clear and descriptive commit messages.
  • I have provided a detailed description of the changes in the pull request, including the problem it addresses, how it fixes the problem, and any relevant details about the implementation.
  • I have ensured that the code is well-documented and easy to understand.

@kbukum1 kbukum1 marked this pull request as ready for review August 29, 2025 00:23
@kbukum1 kbukum1 requested a review from a team as a code owner August 29, 2025 00:23
@kbukum1 kbukum1 enabled auto-merge (squash) August 29, 2025 00:29
Copy link

sentry-io bot commented Aug 29, 2025

Sentry Issue: DELTAFORCE-1599

@kbukum1 kbukum1 merged commit 4630f3f into main Aug 29, 2025
126 of 127 checks passed
@kbukum1 kbukum1 deleted the kamil/fix-git-host-check-sentry-error branch August 29, 2025 01:01
yeikel pushed a commit to yeikel/dependabot-core that referenced this pull request Aug 29, 2025
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