Skip to content

feat(repos): Add audit logs when auto syncing repositories#112056

Merged
wedamija merged 3 commits into
masterfrom
danf/repo-sync-audit-logs
Apr 7, 2026
Merged

feat(repos): Add audit logs when auto syncing repositories#112056
wedamija merged 3 commits into
masterfrom
danf/repo-sync-audit-logs

Conversation

@wedamija
Copy link
Copy Markdown
Member

@wedamija wedamija commented Apr 1, 2026

Add in audit logs whenever we automatically add, update or disable a repository via webhooks and periodic syncing

@wedamija wedamija requested a review from a team April 1, 2026 22:08
@wedamija wedamija requested review from a team as code owners April 1, 2026 22:08
@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Apr 1, 2026
Comment thread src/sentry/plugins/providers/integration_repository.py Outdated
Comment thread src/sentry/integrations/github/tasks/sync_repos.py Outdated
Comment thread src/sentry/plugins/providers/integration_repository.py Outdated
@wedamija wedamija force-pushed the danf/github-periodic-repo-sync branch from dc6db0b to 04ffffa Compare April 1, 2026 22:26
@wedamija wedamija requested a review from a team as a code owner April 1, 2026 22:26
@wedamija wedamija force-pushed the danf/repo-sync-audit-logs branch from cefd1e8 to 394be4f Compare April 1, 2026 22:26
@wedamija wedamija force-pushed the danf/github-periodic-repo-sync branch from e1110fd to 9e370c5 Compare April 3, 2026 16:24
@wedamija wedamija force-pushed the danf/repo-sync-audit-logs branch from 394be4f to e038a92 Compare April 3, 2026 16:25
@wedamija wedamija force-pushed the danf/github-periodic-repo-sync branch 2 times, most recently from 2e87a63 to a342e00 Compare April 3, 2026 22:25
@wedamija wedamija force-pushed the danf/repo-sync-audit-logs branch from e038a92 to 7af940e Compare April 3, 2026 22:26
Comment thread src/sentry/plugins/providers/integration_repository.py Outdated
Comment thread src/sentry/integrations/github/tasks/sync_repos.py
@wedamija wedamija force-pushed the danf/github-periodic-repo-sync branch from b33f134 to 42a5298 Compare April 6, 2026 17:50
@wedamija wedamija force-pushed the danf/repo-sync-audit-logs branch from 7af940e to c7591b2 Compare April 6, 2026 17:55
Comment thread src/sentry/plugins/providers/integration_repository.py Outdated
Comment thread src/sentry/integrations/github/tasks/sync_repos.py
Comment thread src/sentry/plugins/providers/integration_repository.py Outdated
Comment thread src/sentry/integrations/github/tasks/sync_repos.py
Base automatically changed from danf/github-periodic-repo-sync to master April 7, 2026 16:23
wedamija added 2 commits April 7, 2026 09:25
Add in audit logs whenever we automatically add, update or disable a repository via webhooks and periodic syncing
Comment thread src/sentry/plugins/providers/integration_repository.py Outdated
Copy link
Copy Markdown
Contributor

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 784ec6e. Configure here.


if missing_repos:
raise RepoExistsError(repos=missing_repos)
return created_repos, repos_to_update, missing_repos
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Spurious REPO_ENABLED logs for already-active repos

Low Severity

The second return value of create_repositories (repos_to_update) is documented as "reactivated" repos, but it also includes repos found via the fallback path at lines 296–303 when create_repository returns None. These repos already exist with the same integration and may already be ACTIVE. Callers treat the entire list as reactivated and emit REPO_ENABLED audit logs for each, producing incorrect customer-facing audit entries for repos that were never actually disabled.

Additional Locations (2)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 784ec6e. Configure here.

@wedamija wedamija merged commit 6f2614c into master Apr 7, 2026
60 checks passed
@wedamija wedamija deleted the danf/repo-sync-audit-logs branch April 7, 2026 16:59
@wedamija wedamija added the Trigger: Revert Add to a merged PR to revert it (skips CI) label Apr 7, 2026
@getsentry-bot
Copy link
Copy Markdown
Contributor

PR reverted: 2765803

getsentry-bot added a commit that referenced this pull request Apr 7, 2026
…112056)"

This reverts commit 6f2614c.

Co-authored-by: wedamija <6288560+wedamija@users.noreply.github.com>
wedamija added a commit that referenced this pull request Apr 7, 2026
wedamija added a commit that referenced this pull request Apr 7, 2026
…12378)

Re-do of #112056

Add in audit logs whenever we automatically add, update or disable a
repository via webhooks and periodic syncing.

This failed on master before because our audit log ids conflicts with
ids in getsentry.
george-sentry pushed a commit that referenced this pull request Apr 9, 2026
Add in audit logs whenever we automatically add, update or disable a
repository via webhooks and periodic syncing
george-sentry pushed a commit that referenced this pull request Apr 9, 2026
…112056)"

This reverts commit 6f2614c.

Co-authored-by: wedamija <6288560+wedamija@users.noreply.github.com>
george-sentry pushed a commit that referenced this pull request Apr 9, 2026
…12378)

Re-do of #112056

Add in audit logs whenever we automatically add, update or disable a
repository via webhooks and periodic syncing.

This failed on master before because our audit log ids conflicts with
ids in getsentry.
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 23, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Scope: Backend Automatically applied to PRs that change backend components Trigger: Revert Add to a merged PR to revert it (skips CI)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants