Skip to content

Commit 98d3541

Browse files
committed
fix: add external_id and external_provider_id to organization_external_identity
1 parent 6e47b52 commit 98d3541

File tree

4 files changed

+27
-4
lines changed

4 files changed

+27
-4
lines changed

cloudql/github/table_github_organization_external_identity.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ func gitHubOrganizationExternalIdentityColumns() []*plugin.Column {
1111
return []*plugin.Column{
1212
{Name: "guid", Type: proto.ColumnType_STRING, Description: "Guid identifier for the external identity.",
1313
Transform: transform.FromField("Description.Guid")},
14+
{Name: "external_id", Type: proto.ColumnType_STRING, Description: "The unique identifier of the app.",
15+
Transform: transform.FromField("Description.ExternalID")},
16+
{Name: "external_provider_id", Type: proto.ColumnType_STRING, Description: "The unique identifier of the app.",
17+
Transform: transform.FromField("Description.ExternalProviderID")},
1418
{Name: "user_login", Type: proto.ColumnType_STRING, Description: "The GitHub user login.",
1519
Transform: transform.FromField("Description.UserLogin")},
1620
{Name: "user_id", Type: proto.ColumnType_INT, Description: "The GitHub user details.",

discovery/describers/organization_external_identity.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,25 @@ func GetOrganizationExternalIdentities(ctx context.Context, githubClient model.G
5252
}
5353
for _, externalIdentity := range query.Organization.SamlIdentityProvider.ExternalIdentities.Nodes {
5454
id := fmt.Sprintf("%s/%s", org, externalIdentity.User.Login)
55+
var externalID string
56+
var externalProviderID string
57+
58+
for _, att := range externalIdentity.SamlIdentity.Attributes {
59+
if att.Name == "http://schemas.microsoft.com/identity/claims/objectidentifier" {
60+
externalID = att.Value
61+
}
62+
if att.Name == "http://schemas.microsoft.com/identity/claims/tenantid" {
63+
externalProviderID = att.Value
64+
}
65+
}
5566
value := models.Resource{
5667
ID: id,
5768
Name: org,
5869
Description: model.OrgExternalIdentityDescription{
5970
OrganizationExternalIdentity: externalIdentity,
6071
Organization: org,
72+
ExternalID: externalID,
73+
ExternalProviderID: externalProviderID,
6174
OrganizationID: organization.ID,
6275
UserLogin: externalIdentity.User.Login,
6376
UserID: externalIdentity.User.Id,

discovery/pkg/es/resources_clients.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2999,6 +2999,8 @@ func (p OrgExternalIdentityPaginator) NextPage(ctx context.Context) ([]OrgExtern
29992999
}
30003000

30013001
var listOrgExternalIdentityFilters = map[string]string{
3002+
"external_id": "Description.ExternalID",
3003+
"external_provider_id": "Description.ExternalProviderID",
30023004
"guid": "Description.Guid",
30033005
"organization_id": "Description.OrganizationID",
30043006
"organization_invitation": "Description.OrganizationInvitation",
@@ -3069,6 +3071,8 @@ func ListOrgExternalIdentity(ctx context.Context, d *plugin.QueryData, _ *plugin
30693071
}
30703072

30713073
var getOrgExternalIdentityFilters = map[string]string{
3074+
"external_id": "Description.ExternalID",
3075+
"external_provider_id": "Description.ExternalProviderID",
30723076
"guid": "Description.Guid",
30733077
"organization_id": "Description.OrganizationID",
30743078
"organization_invitation": "Description.OrganizationInvitation",

discovery/provider/model.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -802,10 +802,12 @@ type OrgAlertDependabotDescription struct {
802802

803803
type OrgExternalIdentityDescription struct {
804804
steampipemodels.OrganizationExternalIdentity
805-
Organization string
806-
OrganizationID *int64
807-
UserLogin string
808-
UserID int
805+
ExternalID string
806+
ExternalProviderID string
807+
Organization string
808+
OrganizationID *int64
809+
UserLogin string
810+
UserID int
809811
}
810812

811813
type OrgMembersDescription struct {

0 commit comments

Comments
 (0)