Skip to content

Commit e5d5c0f

Browse files
authored
Merge pull request #759 from github/bss-mc-2fa-ent-graphql-examples
Create `.graphql` files for checking 2FA status of enterprise members…
2 parents 5717604 + c390d9b commit e5d5c0f

6 files changed

+159
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# This GraphQL query will list any enterprise members who have yet to enable 2FA on their personal GitHub account.
2+
# This does not list any outside collaborators, and will not work with Enterprise Managed Users other than the setup user.
3+
4+
query GetEnterpriseMembersWith2faDisabled {
5+
enterprise(slug: "ENTERPRISE_SLUG") {
6+
enterprise_id: id
7+
enterprise_slug: slug
8+
members_with_no_2fa: members(
9+
first: 100
10+
twoFactorMethodSecurity: DISABLED
11+
) {
12+
num_of_members: totalCount
13+
edges {
14+
node {
15+
... on EnterpriseUserAccount {
16+
login
17+
}
18+
}
19+
}
20+
pageInfo {
21+
endCursor
22+
startCursor
23+
hasNextPage
24+
hasPreviousPage
25+
}
26+
}
27+
}
28+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# This GraphQL query will list any enterprise members who have enabled 2FA on their GitHub account, but amongst their 2FA methods is SMS (which is deemed insecure).
2+
# This does not list any outside collaborators, and will not work with Enterprise Managed Users other than the setup user.
3+
4+
query GetEnterpriseMembersWithInsecure2fa {
5+
enterprise(slug: "ENTERPRISE_SLUG") {
6+
enterprise_id: id
7+
enterprise_slug: slug
8+
members_with_insecure_2fa: members(
9+
first: 100
10+
twoFactorMethodSecurity: INSECURE
11+
) {
12+
num_of_members: totalCount
13+
edges {
14+
node {
15+
... on EnterpriseUserAccount {
16+
login
17+
}
18+
}
19+
}
20+
pageInfo {
21+
endCursor
22+
startCursor
23+
hasNextPage
24+
hasPreviousPage
25+
}
26+
}
27+
}
28+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# This GraphQL query will list any enterprise members who have enabled 2FA on their GitHub account with a secure (non-SMS) method.
2+
# This does not list any outside collaborators, and will not work with Enterprise Managed Users other than the setup user.
3+
4+
query GetEnterpriseMembersWithSecure2fa {
5+
enterprise(slug: "ENTERPRISE_SLUG") {
6+
enterprise_id: id
7+
enterprise_slug: slug
8+
members_with_secure_2fa: members(
9+
first: 100
10+
twoFactorMethodSecurity: SECURE
11+
) {
12+
num_of_members: totalCount
13+
edges {
14+
node {
15+
... on EnterpriseUserAccount {
16+
login
17+
}
18+
}
19+
}
20+
pageInfo {
21+
endCursor
22+
startCursor
23+
hasNextPage
24+
hasPreviousPage
25+
}
26+
}
27+
}
28+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# This GraphQL query will list any outside collaborators in an enterprise who have yet to enable 2FA on their GitHub account.
2+
3+
query GetEnterpriseollaboratorsWith2faDisabled {
4+
enterprise(slug: "ENTERPRISE_SLUG") {
5+
enterprise_id: id
6+
enterprise_slug: slug
7+
enterprise_owner_info: ownerInfo {
8+
collaborators_with_no_2fa: outsideCollaborators(
9+
twoFactorMethodSecurity: DISABLED
10+
first: 100
11+
) {
12+
num_of_collaborators: totalCount
13+
nodes {
14+
login
15+
}
16+
pageInfo {
17+
endCursor
18+
startCursor
19+
hasNextPage
20+
hasPreviousPage
21+
}
22+
}
23+
}
24+
}
25+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# This GraphQL query will list any outside collaborators in an enterprise who have enabled 2FA on their GitHub account, but amongst the 2FA methods is SMS (which is deemed insecure).
2+
3+
query GetEnterpriseCollaboratorsWithInsecure2fa {
4+
enterprise(slug: "ENTERPRISE_SLUG") {
5+
enterprise_id: id
6+
enterprise_slug: slug
7+
enterprise_owner_info: ownerInfo {
8+
collaborators_with_insecure_2fa: outsideCollaborators(
9+
twoFactorMethodSecurity: INSECURE
10+
first: 100
11+
) {
12+
num_of_collaborators: totalCount
13+
nodes {
14+
login
15+
}
16+
pageInfo {
17+
endCursor
18+
startCursor
19+
hasNextPage
20+
hasPreviousPage
21+
}
22+
}
23+
}
24+
}
25+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# This GraphQL query will list any outside collaborators in an enterprise who have enabled 2FA on their GitHub account with a secure (non-SMS) method.
2+
3+
query GetEnterpriseCollaboratorsWithSecure2fa {
4+
enterprise(slug: "ENTERPRISE_SLUG") {
5+
enterprise_id: id
6+
enterprise_slug: slug
7+
enterprise_owner_info: ownerInfo {
8+
collaborators_with_secure_2fa: outsideCollaborators(
9+
twoFactorMethodSecurity: SECURE
10+
first: 100
11+
) {
12+
num_of_collaborators: totalCount
13+
nodes {
14+
login
15+
}
16+
pageInfo {
17+
endCursor
18+
startCursor
19+
hasNextPage
20+
hasPreviousPage
21+
}
22+
}
23+
}
24+
}
25+
}

0 commit comments

Comments
 (0)