feat(entities): Implement ENTITY_ORGANIZATION for Github Providers #6356
Open
Jaydeep869 wants to merge 3 commits intomindersec:mainfrom
Open
feat(entities): Implement ENTITY_ORGANIZATION for Github Providers #6356Jaydeep869 wants to merge 3 commits intomindersec:mainfrom
Jaydeep869 wants to merge 3 commits intomindersec:mainfrom
Conversation
Implements ENTITY_ORGANIZATION relying entirely on the new generic entity architecture to solve mindersec#5377 and unblock 2FA checks. Includes property fetcher, validator, and async Watermill organization auto-registration upon GitHub App installation. Also implements a backfill migration to synthesize missing organization associations for existing providers.
- Addresses exhaustive switch cases missed in initial entity setup - Fixes cyclomatic complexity warning in processAppCallback by extracting error handling - Fixes gh provider initialization panic by adding support for organization in RegisterEntity
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR fully implements
ENTITY_ORGANIZATIONto act as a proper target for evaluation rules and effectively unblocks the 2FA checking mechanics highlighted in #3842.As per recent discussions with @evankanderson, rather than introducing custom endpoints or manual administration routines, this integration relies natively on the new generic entity properties architecture and auto registers organizations fully in the background directly after a user successfully installs the Github Provider app.
Key Changes
entitiesenum via a new migration (000117_organization_entity.up.sql) to include the'organization'value.ENTITY_ORGANIZATION = 9natively withinminder.proto.OrganizationFetcherwithingithub/propertiesthat queries Github's API to constructproperties.Propertiesmapping theis_userandavatar_urlfields correctly.OrganizationValidatorfor reliable validation logic and registeredENTITY_ORGANIZATIONinservice.go.CreateGitHubAppProviderto publish aMinderEventto theTopicQueueReconcileEntityAddWatermill queue synchronously upon provider registration. The control plane natively handles this via background reconcile pipelines.backfill_organizations.go) linked through themigrate upprocedure to automatically traverse all existing user/database providers and populate any orphanedorganizationlinks via transaction safety upon startup.*db.Provideras a third return value payload originating fromCreateGitHubAppWithoutInvitationand rebuilt all the testing mocks appropriately matching the expectation logic.Related Issues
Testing Performed
make buf,make sqlc,make mock).make test-silent), fixing broken mock signatures.make run-docker.