chore(integrations): Move repository syncing code to generic place. #112431
1 issue
sentry-backend-bugs: Found 1 issue (1 medium)
Medium
Missing KeyError handling for get_repo_config unlike other callers - `src/sentry/integrations/source_code_management/sync_repos.py:176-180`
The list comprehension at line 176-180 calls get_repo_config(repo, integration.id) which accesses repo["id"] and repo["full_name"]. If the GitHub API returns a repository without these fields, the task crashes with KeyError. Both other callers of get_repo_config in the codebase (link_all_repos.py lines 84-88 and sync_repos_on_install_change.py lines 114-119) wrap this call in try/except KeyError, but this code does not.
Duration: 1m 54s · Tokens: 345.7k in / 6.2k out · Cost: $0.68 (+extraction: $0.01, +fix_gate: $0.00)
Annotations
Check warning on line 180 in src/sentry/integrations/source_code_management/sync_repos.py
sentry-warden / warden: sentry-backend-bugs
Missing KeyError handling for get_repo_config unlike other callers
The list comprehension at line 176-180 calls `get_repo_config(repo, integration.id)` which accesses `repo["id"]` and `repo["full_name"]`. If the GitHub API returns a repository without these fields, the task crashes with `KeyError`. Both other callers of `get_repo_config` in the codebase (`link_all_repos.py` lines 84-88 and `sync_repos_on_install_change.py` lines 114-119) wrap this call in try/except `KeyError`, but this code does not.