Skip to content

Commit 592cea7

Browse files
committed
perf(github): avoid full member scan for 2fa summary
1 parent 901e45d commit 592cea7

1 file changed

Lines changed: 2 additions & 18 deletions

File tree

packages/integration-platform/src/manifests/github/checks/two-factor-auth.ts

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -136,31 +136,16 @@ export const twoFactorAuthCheck: IntegrationCheck = {
136136
continue;
137137
}
138138

139-
// Step 3: Also fetch total member count for context
140-
let totalCount: number | null = null;
141-
try {
142-
const totalMembers = await ctx.fetchAllPages<GitHubOrgMember>(`/orgs/${orgSlug}/members`);
143-
totalCount = totalMembers.length;
144-
} catch (error) {
145-
// Non-critical: we can still report 2FA findings without total count
146-
const errorMsg = error instanceof Error ? error.message : String(error);
147-
ctx.warn(`Could not fetch total member count for ${org.login}: ${errorMsg}`);
148-
}
149-
150139
const without2FACount = membersWithout2FA.length;
151140

152141
if (without2FACount === 0) {
153142
ctx.pass({
154143
title: `All members have 2FA enabled in ${org.login}`,
155-
description:
156-
typeof totalCount === 'number' && totalCount > 0
157-
? `All ${totalCount} members of the ${org.login} organization have two-factor authentication enabled.`
158-
: `No members without 2FA were returned for ${org.login}.`,
144+
description: `No members without 2FA were returned for ${org.login}.`,
159145
resourceType: 'organization',
160146
resourceId: org.login,
161147
evidence: {
162148
organization: org.login,
163-
totalMembers: totalCount,
164149
membersWithout2FA: 0,
165150
checkedAt,
166151
},
@@ -188,14 +173,13 @@ export const twoFactorAuthCheck: IntegrationCheck = {
188173
// Also emit a summary
189174
ctx.fail({
190175
title: `${without2FACount} member(s) without 2FA in ${org.login}`,
191-
description: `${without2FACount} out of ${totalCount ?? 'unknown'} members in the ${org.login} organization do not have two-factor authentication enabled: ${formatUsernamesPreview(membersWithout2FA)}`,
176+
description: `${without2FACount} member(s) in the ${org.login} organization do not have two-factor authentication enabled: ${formatUsernamesPreview(membersWithout2FA)}`,
192177
resourceType: 'organization',
193178
resourceId: `${org.login}/2fa-summary`,
194179
severity: 'high',
195180
remediation: `1. Go to https://github.com/organizations/${org.login}/settings/security\n2. Under "Authentication security", check "Require two-factor authentication for everyone"\n3. This will require all existing and future members to enable 2FA`,
196181
evidence: {
197182
organization: org.login,
198-
totalMembers: totalCount,
199183
membersWithout2FA: without2FACount,
200184
sampleUsernames: membersWithout2FA
201185
.slice(0, MAX_USERNAMES_IN_EVIDENCE)

0 commit comments

Comments
 (0)