openhound-github 0.2.0__tar.gz → 0.3.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {openhound_github-0.2.0 → openhound_github-0.3.1}/PKG-INFO +2 -2
- {openhound_github-0.2.0 → openhound_github-0.3.1}/extension/schema.json +56 -0
- openhound_github-0.3.1/justfile +17 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/pyproject.toml +2 -2
- openhound_github-0.3.1/src/openhound_github/auth.py +182 -0
- openhound_github-0.3.1/src/openhound_github/graphql.py +419 -0
- openhound_github-0.3.1/src/openhound_github/helpers.py +208 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/src/openhound_github/kinds/edges.py +19 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/src/openhound_github/kinds/nodes.py +9 -0
- openhound_github-0.3.1/src/openhound_github/lookup.py +441 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/src/openhound_github/main.py +18 -3
- {openhound_github-0.2.0 → openhound_github-0.3.1}/src/openhound_github/models/__init__.py +44 -4
- {openhound_github-0.2.0 → openhound_github-0.3.1}/src/openhound_github/models/actions_permission.py +4 -1
- {openhound_github-0.2.0 → openhound_github-0.3.1}/src/openhound_github/models/app_installation.py +102 -142
- {openhound_github-0.2.0 → openhound_github-0.3.1}/src/openhound_github/models/branch.py +29 -22
- {openhound_github-0.2.0 → openhound_github-0.3.1}/src/openhound_github/models/branch_protection_rule.py +51 -86
- openhound_github-0.3.1/src/openhound_github/models/enterprise.py +110 -0
- openhound_github-0.3.1/src/openhound_github/models/enterprise_admin.py +21 -0
- openhound_github-0.3.1/src/openhound_github/models/enterprise_external_identity.py +202 -0
- openhound_github-0.3.1/src/openhound_github/models/enterprise_helpers.py +6 -0
- openhound_github-0.3.1/src/openhound_github/models/enterprise_managed_user.py +131 -0
- openhound_github-0.3.1/src/openhound_github/models/enterprise_member.py +63 -0
- openhound_github-0.3.1/src/openhound_github/models/enterprise_organization.py +79 -0
- openhound_github-0.3.1/src/openhound_github/models/enterprise_role.py +120 -0
- openhound_github-0.3.1/src/openhound_github/models/enterprise_role_team.py +47 -0
- openhound_github-0.3.1/src/openhound_github/models/enterprise_role_user.py +45 -0
- openhound_github-0.3.1/src/openhound_github/models/enterprise_saml_provider.py +122 -0
- openhound_github-0.3.1/src/openhound_github/models/enterprise_team.py +116 -0
- openhound_github-0.3.1/src/openhound_github/models/enterprise_team_member.py +45 -0
- openhound_github-0.3.1/src/openhound_github/models/enterprise_team_organization.py +81 -0
- openhound_github-0.3.1/src/openhound_github/models/enterprise_team_role.py +97 -0
- openhound_github-0.3.1/src/openhound_github/models/enterprise_user.py +96 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/src/openhound_github/models/env_secret.py +26 -26
- {openhound_github-0.2.0 → openhound_github-0.3.1}/src/openhound_github/models/env_variable.py +37 -29
- {openhound_github-0.2.0 → openhound_github-0.3.1}/src/openhound_github/models/environment.py +25 -31
- {openhound_github-0.2.0 → openhound_github-0.3.1}/src/openhound_github/models/environment_branch_policy.py +5 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/src/openhound_github/models/external_identity.py +44 -46
- {openhound_github-0.2.0 → openhound_github-0.3.1}/src/openhound_github/models/org.py +144 -269
- {openhound_github-0.2.0 → openhound_github-0.3.1}/src/openhound_github/models/org_role.py +91 -39
- {openhound_github-0.2.0 → openhound_github-0.3.1}/src/openhound_github/models/org_role_member.py +3 -2
- {openhound_github-0.2.0 → openhound_github-0.3.1}/src/openhound_github/models/org_role_team.py +3 -2
- {openhound_github-0.2.0 → openhound_github-0.3.1}/src/openhound_github/models/org_secret.py +98 -43
- {openhound_github-0.2.0 → openhound_github-0.3.1}/src/openhound_github/models/org_variable.py +34 -29
- {openhound_github-0.2.0 → openhound_github-0.3.1}/src/openhound_github/models/personal_access_token.py +63 -58
- {openhound_github-0.2.0 → openhound_github-0.3.1}/src/openhound_github/models/personal_access_token_access.py +6 -2
- {openhound_github-0.2.0 → openhound_github-0.3.1}/src/openhound_github/models/personal_access_token_request.py +32 -33
- openhound_github-0.3.1/src/openhound_github/models/projected_enterprise_team.py +61 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/src/openhound_github/models/repo_role_assignment.py +5 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/src/openhound_github/models/repository.py +103 -113
- {openhound_github-0.2.0 → openhound_github-0.3.1}/src/openhound_github/models/repository_role.py +31 -29
- {openhound_github-0.2.0 → openhound_github-0.3.1}/src/openhound_github/models/repository_secret.py +28 -27
- {openhound_github-0.2.0 → openhound_github-0.3.1}/src/openhound_github/models/repository_variable.py +28 -27
- {openhound_github-0.2.0 → openhound_github-0.3.1}/src/openhound_github/models/runner.py +120 -109
- {openhound_github-0.2.0 → openhound_github-0.3.1}/src/openhound_github/models/saml_provider.py +24 -32
- {openhound_github-0.2.0 → openhound_github-0.3.1}/src/openhound_github/models/scim_user.py +4 -1
- {openhound_github-0.2.0 → openhound_github-0.3.1}/src/openhound_github/models/secret_scanning_alert.py +114 -44
- {openhound_github-0.2.0 → openhound_github-0.3.1}/src/openhound_github/models/team.py +44 -34
- {openhound_github-0.2.0 → openhound_github-0.3.1}/src/openhound_github/models/team_member.py +7 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/src/openhound_github/models/team_role.py +31 -21
- {openhound_github-0.2.0 → openhound_github-0.3.1}/src/openhound_github/models/user.py +37 -33
- openhound_github-0.3.1/src/openhound_github/models/workflow.py +627 -0
- openhound_github-0.3.1/src/openhound_github/models/workflow_job.py +387 -0
- openhound_github-0.3.1/src/openhound_github/models/workflow_step.py +270 -0
- openhound_github-0.3.1/src/openhound_github/resources/__init__.py +2 -0
- openhound_github-0.3.1/src/openhound_github/resources/enterprise.py +425 -0
- openhound_github-0.2.0/src/openhound_github/source.py → openhound_github-0.3.1/src/openhound_github/resources/organization.py +736 -459
- openhound_github-0.3.1/src/openhound_github/source.py +197 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/src/openhound_github/transforms.py +2 -3
- openhound_github-0.3.1/uv.lock +1680 -0
- openhound_github-0.2.0/justfile +0 -17
- openhound_github-0.2.0/src/openhound_github/auth.py +0 -220
- openhound_github-0.2.0/src/openhound_github/graphql.py +0 -214
- openhound_github-0.2.0/src/openhound_github/helpers.py +0 -49
- openhound_github-0.2.0/src/openhound_github/lookup.py +0 -193
- openhound_github-0.2.0/src/openhound_github/models/workflow.py +0 -143
- {openhound_github-0.2.0 → openhound_github-0.3.1}/.github/CODE_OF_CONDUCT.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/.github/CONTRIBUTING.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/.github/GOVERNANCE.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/.github/GitHub-COC-Header.png +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/.github/GitHub-CONTRIB-Header.png +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/.github/GitHub-GOV-Header.png +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/.github/GitHub-Header.png +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/.github/GitHub-LIC-Header.png +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/.github/GitHub-SEC-Header.png +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/.github/SECURITY.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/.github/SO-Dark.svg +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/.github/SO-FOSS-Dark.svg +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/.github/SO-FOSS-Light.svg +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/.github/SO-Light.svg +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/.github/workflows/publish.yml +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/.github/workflows/release-on-merge.yml +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/.github/workflows/validate-branch.yml +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/.gitignore +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/.gitmodules +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/.pre-commit-config.yaml +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/LICENSE.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/README.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_AddAssignee.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_AddCollaborator.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_AddLabel.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_AddMember.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_AdminTo.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_BypassBranchProtection.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_BypassPullRequestAllowances.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_CallsWorkflow.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_CanAccess.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_CanAssumeIdentity.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_CanCreateBranch.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_CanEditProtection.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_CanPwnRequest.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_CanReadSecretScanningAlert.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_CanWriteBranch.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_CloseDiscussion.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_CloseIssue.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_ClosePullRequest.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_Contains.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_ConvertIssuesToDiscussions.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_CreateDiscussionCategory.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_CreateRepository.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_CreateSoloMergeQueueEntry.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_CreateTag.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_CreateTeam.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_DeleteAlertsCodeScanning.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_DeleteDiscussion.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_DeleteDiscussionComment.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_DeleteIssue.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_DeleteTag.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_DependsOn.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_DeploysTo.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_EditCategoryOnDiscussion.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_EditDiscussionCategory.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_EditDiscussionComment.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_EditRepoAnnouncementBanners.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_EditRepoCustomPropertiesValues.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_EditRepoMetadata.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_EditRepoProtections.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_HasBaseRole.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_HasBranch.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_HasEnvironment.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_HasExternalIdentity.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_HasJob.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_HasMember.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_HasPersonalAccessToken.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_HasPersonalAccessTokenRequest.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_HasRole.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_HasSamlIdentityProvider.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_HasSecret.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_HasStep.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_HasVariable.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_HasWorkflow.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_InstalledAs.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_InviteMember.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_JumpMergeQueue.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_ManageDeployKeys.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_ManageDiscussionBadges.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_ManageOrganizationWebhooks.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_ManageRepoSecurityProducts.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_ManageSecurityProducts.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_ManageSettingsMergeTypes.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_ManageSettingsPages.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_ManageSettingsProjects.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_ManageSettingsWiki.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_ManageTopics.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_ManageWebhooks.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_MapsToUser.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_MarkAsDuplicate.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_MemberOf.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_OrgBypassCodeScanningDismissalRequests.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_OrgBypassSecretScanningClosureRequests.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_OrgReviewAndManageSecretScanningBypassRequests.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_OrgReviewAndManageSecretScanningClosureRequests.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_Owns.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_ProtectedBy.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_PushProtectedBranch.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_ReadCodeScanning.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_ReadOrganizationActionsUsageMetrics.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_ReadOrganizationCustomOrgRole.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_ReadOrganizationCustomRepoRole.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_ReadRepoContents.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_RemoveAssignee.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_RemoveLabel.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_ReopenDiscussion.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_ReopenIssue.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_ReopenPullRequest.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_RequestPrReview.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_ResolveDependabotAlerts.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_ResolveSecretScanningAlerts.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_RestrictionsCanPush.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_RunOrgMigration.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_SetInteractionLimits.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_SetIssueType.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_SetMilestone.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_SetSocialPreview.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_SyncedTo.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_ToggleDiscussionAnswer.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_ToggleDiscussionCommentMinimize.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_TransferRepository.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_UsesSecret.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_UsesVariable.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_ValidToken.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_ViewDependabotAlerts.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_ViewSecretScanningAlerts.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_WriteCodeScanning.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_WriteOrganizationActionsSecrets.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_WriteOrganizationActionsSettings.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_WriteOrganizationActionsVariables.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_WriteOrganizationCustomOrgRole.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_WriteOrganizationCustomRepoRole.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_WriteOrganizationNetworkConfigurations.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_WriteRepoContents.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/edges/GH_WriteRepoPullRequests.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/nodes/GH_App.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/nodes/GH_AppInstallation.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/nodes/GH_Branch.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/nodes/GH_BranchProtectionRule.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/nodes/GH_Environment.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/nodes/GH_EnvironmentSecret.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/nodes/GH_EnvironmentVariable.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/nodes/GH_ExternalIdentity.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/nodes/GH_OrgRole.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/nodes/GH_OrgSecret.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/nodes/GH_OrgVariable.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/nodes/GH_Organization.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/nodes/GH_PersonalAccessToken.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/nodes/GH_PersonalAccessTokenRequest.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/nodes/GH_RepoRole.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/nodes/GH_RepoSecret.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/nodes/GH_RepoVariable.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/nodes/GH_Repository.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/nodes/GH_SamlIdentityProvider.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/nodes/GH_SecretScanningAlert.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/nodes/GH_Team.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/nodes/GH_TeamRole.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/nodes/GH_User.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/nodes/GH_Workflow.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/nodes/GH_WorkflowJob.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/descriptions/nodes/GH_WorkflowStep.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/docs/og-docs.json +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/extension/privilege_zone_rules/t0-all-repo-admin-role.json +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/extension/privilege_zone_rules/t0-app-installations-all-repos.json +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/extension/privilege_zone_rules/t0-apps-all-repos.json +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/extension/privilege_zone_rules/t0-external-identities-owners.json +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/extension/privilege_zone_rules/t0-organizations.json +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/extension/privilege_zone_rules/t0-owner-users.json +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/extension/privilege_zone_rules/t0-owners-role.json +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/extension/privilege_zone_rules/t0-pats-all-repos.json +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/extension/privilege_zone_rules/t0-privilege-escalation-roles.json +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/extension/privilege_zone_rules/t0-privilege-escalation-users.json +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/extension/privilege_zone_rules/t0-saml-identity-providers.json +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/extension/saved_searches/README.md +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/extension/saved_searches/actions-sha-pinning-not-required.json +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/extension/saved_searches/active-leaked-secrets.json +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/extension/saved_searches/advanced-security-disabled-new-repos.json +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/extension/saved_searches/all-actions-allowed.json +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/extension/saved_searches/app-installations-all-repos.json +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/extension/saved_searches/branch-protection-admins-not-enforced.json +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/extension/saved_searches/branch-protection-deletions-allowed.json +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/extension/saved_searches/branch-protection-force-pushes.json +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/extension/saved_searches/branch-protection-no-code-owner-reviews.json +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/extension/saved_searches/branch-protection-no-pr-reviews.json +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/extension/saved_searches/branch-protection-no-status-checks.json +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/extension/saved_searches/branch-protection-self-approval.json +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/extension/saved_searches/branch-protection-stale-reviews.json +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/extension/saved_searches/bypass-pr-requirements.json +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/extension/saved_searches/dangerous-branch-perms.json +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/extension/saved_searches/default-repository-permissions.json +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/extension/saved_searches/demo-sso-to-cloud-round-trip.json +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/extension/saved_searches/dependabot-alerts-disabled-new-repos.json +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/extension/saved_searches/dependabot-updates-disabled-new-repos.json +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/extension/saved_searches/dependency-graph-disabled-new-repos.json +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/extension/saved_searches/environments-admin-bypass.json +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/extension/saved_searches/expired-pats.json +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/extension/saved_searches/external-identities-without-scim.json +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/extension/saved_searches/github-to-azure-identity.json +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/extension/saved_searches/global-repo-perms.json +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/extension/saved_searches/hybrid-identities.json +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/extension/saved_searches/members-can-change-repo-visibility.json +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/extension/saved_searches/members-can-create-pages.json +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/extension/saved_searches/members-can-create-public-repos.json +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/extension/saved_searches/members-can-delete-repos.json +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/extension/saved_searches/members-can-fork-private-repos.json +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/extension/saved_searches/members-can-invite-outside-collaborators.json +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/extension/saved_searches/org-owners.json +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/extension/saved_searches/orgs-without-2fa.json +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/extension/saved_searches/pats-all-repo-access.json +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/extension/saved_searches/pending-pat-requests.json +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/extension/saved_searches/private-repos-forking-allowed.json +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/extension/saved_searches/privileged-custom-org-roles.json +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/extension/saved_searches/privileged-hybrid-identities.json +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/extension/saved_searches/public-repos.json +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/extension/saved_searches/push-protection-disabled-new-repos.json +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/extension/saved_searches/push-to-protected-branches.json +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/extension/saved_searches/repos-secret-scanning-disabled.json +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/extension/saved_searches/repos-vulnerable-to-workflow-secret-exfil.json +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/extension/saved_searches/repository-workflows.json +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/extension/saved_searches/saml-configuration.json +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/extension/saved_searches/secret-scanning-alerts.json +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/extension/saved_searches/secret-scanning-disabled-new-repos.json +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/extension/saved_searches/secrets-reachable-by-user.json +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/extension/saved_searches/team-membership-admin.json +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/extension/saved_searches/team-structure.json +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/extension/saved_searches/unprotected-branches.json +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/extension/saved_searches/unprotected-default-branch-with-workflow.json +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/extension/saved_searches/unprotected-default-branches.json +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/extension/saved_searches/web-commit-signoff-not-required.json +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/extension.yaml +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/src/main.py +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/src/openhound_github/__init__.py +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/src/openhound_github/graph.py +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/src/openhound_github/models/branch_pr_bypass_allowance.py +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/src/openhound_github/models/branch_push_allowance.py +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/tests/test_data/api/actions-permissions.json +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/tests/test_data/api/actionsecrets.json +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/tests/test_data/api/app.json +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/tests/test_data/api/appinstalls.json +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/tests/test_data/api/branch-policies.json +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/tests/test_data/api/branch-prot-rules.json +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/tests/test_data/api/branches.json +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/tests/test_data/api/custom-roles.json +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/tests/test_data/api/environments.json +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/tests/test_data/api/org-pat-request.json +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/tests/test_data/api/org-pat.json +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/tests/test_data/api/org-role-teams.json +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/tests/test_data/api/org-role-users.json +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/tests/test_data/api/org-roles.json +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/tests/test_data/api/org.json +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/tests/test_data/api/pat-repositories.json +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/tests/test_data/api/repo-collaborators.json +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/tests/test_data/api/repo-teams.json +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/tests/test_data/api/repositories.json +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/tests/test_data/api/scimusers.json +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/tests/test_data/api/secrets.json +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/tests/test_data/api/secretscanningalert.json +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/tests/test_data/api/selected-org-secrets.json +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/tests/test_data/api/variables.json +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/tests/test_data/api/workflows.json +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/tests/test_github_rest_client.py +0 -0
- {openhound_github-0.2.0 → openhound_github-0.3.1}/tests/test_github_retry.py +0 -0
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: openhound-github
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.1
|
|
4
4
|
Summary: Github collector for OpenHound
|
|
5
5
|
Author-email: "jdreijer@specterops.io" <jdreijer@specterops.io>, Jared Atkinson <jatkinson@specterops.io>
|
|
6
6
|
License-File: LICENSE.md
|
|
7
7
|
Requires-Python: >=3.13
|
|
8
|
-
Requires-Dist:
|
|
8
|
+
Requires-Dist: joserfc>=1.6.5
|
|
9
9
|
Requires-Dist: requests>=2.33.0
|
|
10
10
|
Description-Content-Type: text/markdown
|
|
11
11
|
|
|
@@ -6,6 +6,38 @@
|
|
|
6
6
|
"namespace": "GH"
|
|
7
7
|
},
|
|
8
8
|
"node_kinds": [
|
|
9
|
+
{
|
|
10
|
+
"name": "GH_Enterprise",
|
|
11
|
+
"display_name": "GitHub Enterprise",
|
|
12
|
+
"description": "A GitHub Enterprise account that contains organizations, enterprise teams, roles, and managed users",
|
|
13
|
+
"is_display_kind": true,
|
|
14
|
+
"icon": "globe",
|
|
15
|
+
"color": "#6EA8FE"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"name": "GH_EnterpriseTeam",
|
|
19
|
+
"display_name": "GitHub Enterprise Team",
|
|
20
|
+
"description": "A team managed at the GitHub Enterprise level and assignable across organizations",
|
|
21
|
+
"is_display_kind": true,
|
|
22
|
+
"icon": "users-between-lines",
|
|
23
|
+
"color": "#9B8CFF"
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"name": "GH_EnterpriseRole",
|
|
27
|
+
"display_name": "GitHub Enterprise Role",
|
|
28
|
+
"description": "The role a user or team has at the GitHub Enterprise level",
|
|
29
|
+
"is_display_kind": true,
|
|
30
|
+
"icon": "user-tie",
|
|
31
|
+
"color": "#B8D7FF"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"name": "GH_EnterpriseManagedUser",
|
|
35
|
+
"display_name": "GitHub Enterprise Managed User",
|
|
36
|
+
"description": "A GitHub Enterprise managed user account linked to an enterprise identity provider",
|
|
37
|
+
"is_display_kind": true,
|
|
38
|
+
"icon": "user-lock",
|
|
39
|
+
"color": "#7DD3FC"
|
|
40
|
+
},
|
|
9
41
|
{
|
|
10
42
|
"name": "GH_Organization",
|
|
11
43
|
"display_name": "GitHub Organization",
|
|
@@ -150,6 +182,30 @@
|
|
|
150
182
|
"icon": "lock-open",
|
|
151
183
|
"color": "#E89B5C"
|
|
152
184
|
},
|
|
185
|
+
{
|
|
186
|
+
"name": "GH_RunnerGroup",
|
|
187
|
+
"display_name": "GitHub Runner Group",
|
|
188
|
+
"description": "A GitHub self-hosted runner group that controls runner access and visibility",
|
|
189
|
+
"is_display_kind": true,
|
|
190
|
+
"icon": "server",
|
|
191
|
+
"color": "#94A3B8"
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
"name": "GH_OrgRunner",
|
|
195
|
+
"display_name": "GitHub Org Runner",
|
|
196
|
+
"description": "An organization-scoped GitHub self-hosted runner available to selected repositories or workflows",
|
|
197
|
+
"is_display_kind": true,
|
|
198
|
+
"icon": "microchip",
|
|
199
|
+
"color": "#22C55E"
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
"name": "GH_RepoRunner",
|
|
203
|
+
"display_name": "GitHub Repo Runner",
|
|
204
|
+
"description": "A repository-scoped GitHub self-hosted runner available to jobs in a single repository",
|
|
205
|
+
"is_display_kind": true,
|
|
206
|
+
"icon": "microchip",
|
|
207
|
+
"color": "#38BDF8"
|
|
208
|
+
},
|
|
153
209
|
{
|
|
154
210
|
"name": "GH_EnvironmentVariable",
|
|
155
211
|
"display_name": "GitHub Environment Variable",
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
set dotenv-load := true
|
|
2
|
+
|
|
3
|
+
collect +args='github /tmp/output/raw/':
|
|
4
|
+
@echo "Collecting data"
|
|
5
|
+
uv run src/main.py collect {{args}}
|
|
6
|
+
|
|
7
|
+
preprocess +args='github /tmp/output/raw/github':
|
|
8
|
+
@echo "Preprocessing data"
|
|
9
|
+
uv run openhound preprocess {{args}}
|
|
10
|
+
|
|
11
|
+
convert +args='github /tmp/output/raw/github /tmp/output/graph/github':
|
|
12
|
+
@echo "Converting data"
|
|
13
|
+
uv run openhound convert {{args}}
|
|
14
|
+
|
|
15
|
+
sync:
|
|
16
|
+
@echo "Syncing dependencies"
|
|
17
|
+
uv sync --group dev
|
|
@@ -5,7 +5,7 @@ description = "Github collector for OpenHound"
|
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
requires-python = ">=3.13"
|
|
7
7
|
dependencies = [
|
|
8
|
-
"
|
|
8
|
+
"joserfc>=1.6.5",
|
|
9
9
|
"requests>=2.33.0",
|
|
10
10
|
]
|
|
11
11
|
authors = [
|
|
@@ -28,7 +28,7 @@ local_scheme = "no-local-version"
|
|
|
28
28
|
|
|
29
29
|
[dependency-groups]
|
|
30
30
|
dev = [
|
|
31
|
-
"openhound",
|
|
31
|
+
"openhound==0.1.4",
|
|
32
32
|
"pre-commit>=4.5.1",
|
|
33
33
|
"pytest>=9.0.1",
|
|
34
34
|
"ruff>=0.15.5",
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
from datetime import datetime, timedelta, timezone
|
|
3
|
+
from threading import Lock
|
|
4
|
+
from typing import Iterator
|
|
5
|
+
|
|
6
|
+
import requests
|
|
7
|
+
from dlt.common.configuration import configspec
|
|
8
|
+
from dlt.sources.helpers.rest_client.auth import AuthConfigBase
|
|
9
|
+
from dlt.sources.helpers.rest_client.client import RESTClient
|
|
10
|
+
from dlt.sources.helpers.rest_client.paginators import (
|
|
11
|
+
HeaderLinkPaginator,
|
|
12
|
+
)
|
|
13
|
+
from joserfc import jwt
|
|
14
|
+
from joserfc.jwk import RSAKey
|
|
15
|
+
from pydantic import BaseModel
|
|
16
|
+
|
|
17
|
+
logger = logging.getLogger(__name__)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class AccountConfig(BaseModel):
|
|
21
|
+
id: int
|
|
22
|
+
login: str | None = None
|
|
23
|
+
name: str | None = None
|
|
24
|
+
type: str | None = None
|
|
25
|
+
slug: str | None = None
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class InstallationResponse(BaseModel):
|
|
29
|
+
id: int
|
|
30
|
+
client_id: str
|
|
31
|
+
account: AccountConfig
|
|
32
|
+
target_type: str
|
|
33
|
+
app_id: int | None = None
|
|
34
|
+
app_slug: str | None = None
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
class TokenResponse(BaseModel):
|
|
38
|
+
token: str
|
|
39
|
+
expires_at: datetime
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
class GithubSession:
|
|
43
|
+
def __init__(
|
|
44
|
+
self,
|
|
45
|
+
client_id: str,
|
|
46
|
+
private_key_path: str,
|
|
47
|
+
api_uri: str = "https://api.github.com/",
|
|
48
|
+
):
|
|
49
|
+
self.api_uri = api_uri
|
|
50
|
+
self.client_id = client_id
|
|
51
|
+
self.private_key_path = private_key_path
|
|
52
|
+
self.client = RESTClient(
|
|
53
|
+
base_url=self.api_uri,
|
|
54
|
+
paginator=HeaderLinkPaginator(),
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
@property
|
|
58
|
+
def jwt(self) -> str:
|
|
59
|
+
now_utc = datetime.now(timezone.utc).timestamp()
|
|
60
|
+
header = {"alg": "RS256", "typ": "JWT"}
|
|
61
|
+
claims = {
|
|
62
|
+
"iss": self.client_id,
|
|
63
|
+
"iat": int(now_utc - 10), # Issued 10 seconds in the past
|
|
64
|
+
"exp": int(now_utc + 540), # Expires in 9 minutes (GitHub max is 10, leaving room for clock drift)
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
try:
|
|
68
|
+
with open(self.private_key_path, "rb") as key_file:
|
|
69
|
+
key = RSAKey.import_key(key_file.read())
|
|
70
|
+
text = jwt.encode(header, claims, key)
|
|
71
|
+
return text
|
|
72
|
+
|
|
73
|
+
except Exception as e:
|
|
74
|
+
raise ValueError(f"Failed to load private key: {e}") from e
|
|
75
|
+
|
|
76
|
+
@property
|
|
77
|
+
def jwt_headers(self) -> dict:
|
|
78
|
+
return {
|
|
79
|
+
"Accept": "application/vnd.github+json",
|
|
80
|
+
"Authorization": f"Bearer {self.jwt}",
|
|
81
|
+
"X-GitHub-Api-Version": "2022-11-28",
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
class GithubInstallation(GithubSession):
|
|
86
|
+
def __init__(
|
|
87
|
+
self,
|
|
88
|
+
installation_id: str,
|
|
89
|
+
client_id: str,
|
|
90
|
+
private_key_path: str,
|
|
91
|
+
api_uri: str = "https://api.github.com/",
|
|
92
|
+
):
|
|
93
|
+
self.installation_id = installation_id
|
|
94
|
+
super().__init__(client_id, private_key_path, api_uri)
|
|
95
|
+
|
|
96
|
+
@property
|
|
97
|
+
def token(self) -> TokenResponse:
|
|
98
|
+
logger.info(f"Getting access token for {self.installation_id}")
|
|
99
|
+
response = self.client.post(
|
|
100
|
+
f"{self.api_uri}app/installations/{self.installation_id}/access_tokens",
|
|
101
|
+
timeout=10,
|
|
102
|
+
headers=self.jwt_headers,
|
|
103
|
+
)
|
|
104
|
+
response.raise_for_status()
|
|
105
|
+
return TokenResponse(**response.json())
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
class GithubApp(GithubSession):
|
|
109
|
+
def __init__(
|
|
110
|
+
self,
|
|
111
|
+
client_id: str,
|
|
112
|
+
private_key_path: str,
|
|
113
|
+
api_uri: str = "https://api.github.com/",
|
|
114
|
+
):
|
|
115
|
+
self.client_id = client_id
|
|
116
|
+
self.private_key_path = private_key_path
|
|
117
|
+
self.api_uri = api_uri
|
|
118
|
+
super().__init__(client_id, private_key_path, api_uri)
|
|
119
|
+
|
|
120
|
+
@property
|
|
121
|
+
def installations(self) -> Iterator[InstallationResponse]:
|
|
122
|
+
for page in self.client.paginate(
|
|
123
|
+
"/app/installations", params={"per_page": 100}, headers=self.jwt_headers
|
|
124
|
+
):
|
|
125
|
+
for item in page:
|
|
126
|
+
yield InstallationResponse(**item)
|
|
127
|
+
|
|
128
|
+
def install_id_for_org(self, org_login: str) -> int:
|
|
129
|
+
logger.info(f"Getting app installation ID for org {org_login}")
|
|
130
|
+
response = self.client.get(
|
|
131
|
+
f"/orgs/{org_login}/installation", headers=self.jwt_headers
|
|
132
|
+
)
|
|
133
|
+
response.raise_for_status()
|
|
134
|
+
return int(response.json()["id"])
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
@configspec
|
|
138
|
+
class GitHubAppInstallationAuth(AuthConfigBase):
|
|
139
|
+
"""Requests auth that refreshes GitHub App installation tokens as needed."""
|
|
140
|
+
|
|
141
|
+
def __init__(
|
|
142
|
+
self,
|
|
143
|
+
installation: GithubInstallation,
|
|
144
|
+
refresh_margin_seconds: int = 300,
|
|
145
|
+
):
|
|
146
|
+
self.installation = installation
|
|
147
|
+
self.refresh_margin_seconds = refresh_margin_seconds
|
|
148
|
+
self.access_token: str | None = None
|
|
149
|
+
self.expires_at: datetime | None = None
|
|
150
|
+
self._token_lock = Lock()
|
|
151
|
+
|
|
152
|
+
def _should_refresh(self) -> bool:
|
|
153
|
+
if self.expires_at is None:
|
|
154
|
+
return True
|
|
155
|
+
|
|
156
|
+
refresh_at = self.expires_at - timedelta(seconds=self.refresh_margin_seconds)
|
|
157
|
+
return datetime.now(timezone.utc) >= refresh_at
|
|
158
|
+
|
|
159
|
+
def token(self, force_refresh: bool = False) -> str | None:
|
|
160
|
+
if (
|
|
161
|
+
not force_refresh
|
|
162
|
+
and self.access_token is not None
|
|
163
|
+
and not self._should_refresh()
|
|
164
|
+
):
|
|
165
|
+
return self.access_token
|
|
166
|
+
|
|
167
|
+
with self._token_lock:
|
|
168
|
+
if (force_refresh or self._should_refresh()) or self.access_token is None:
|
|
169
|
+
logger.info(
|
|
170
|
+
f"Refreshing access token for {self.installation.installation_id}"
|
|
171
|
+
)
|
|
172
|
+
get_token = self.installation.token
|
|
173
|
+
self.access_token = get_token.token
|
|
174
|
+
self.expires_at = get_token.expires_at
|
|
175
|
+
|
|
176
|
+
return self.access_token
|
|
177
|
+
|
|
178
|
+
def __call__(self, request: requests.PreparedRequest) -> requests.PreparedRequest:
|
|
179
|
+
request.headers["Authorization"] = f"Bearer {self.token()}"
|
|
180
|
+
return request
|
|
181
|
+
|
|
182
|
+
#
|