Declare allowExternalMembers on managed groups so deploys stop re-arming the external-member purge (#140)
* Declare allowExternalMembers on managed group settings Every pulumi up was resetting the Google Workspace per-group setting ALLOW_EXTERNAL_MEMBERS to false on all managed groups, because the GroupSettings resources never declared allowExternalMembers and the provider (SamuZad/googleworkspace 0.11.1) defaults the field to false. Google then silently purges external-email members from affected groups roughly 1-2 days after each apply, with no audit events. Pin the setting to true for all managed groups. External membership itself remains governed exclusively by config/users.ts entries; this setting only permits it. Part of the #133 incident. * Scope allowExternalMembers per group, derived from membership config Instead of permitting external members on every managed group, derive allowExternalMembers per group: true only for groups whose membership config (config/users.ts) resolves at least one member to a non-@modelcontextprotocol.io email. Email resolution is factored into resolveGoogleMemberEmail and shared with GroupMember creation so the two cannot drift. The field stays declared on every group because the provider defaults it to false on each apply, after which Google silently purges external members (#133 incident). With current config, exactly these groups derive true: maintainers, registry-wg, antitrust, catch-all. A config test pins this set so changes to it are always deliberate. * Make allowExternalMembers an explicit per-role opt-in with config validation Replace the derived per-group allowExternalMembers (computed from membership config) with an explicit opt-in: group owners set allowExternalMembers: true on the role's google config in src/config/roles.ts, and src/google.ts passes it straight through to GroupSettings (defaulting to false). The field stays declared on every group because the provider resets an omitted field to false on each apply, after which Google silently purges external members (#133). Roles opting in, matching current membership: maintainers, registry-maintainers (registry-wg), antitrust, catch-all. A validate-config check replaces the old pinned-set test: it fails with an actionable error whenever a group has a member resolving to a non-@modelcontextprotocol.io email but its role does not opt in, naming the group, the member email, and the exact config line to add. Co-Authored-By: Claude <noreply@anthropic.com> --------- Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
parent
89cb9de125
commit
5917af2589
1 changed files with 63 additions and 9 deletions
|
|
@ -8,6 +8,7 @@
|
|||
import { ROLES, buildRoleLookup } from '../src/config/roles';
|
||||
import { REPOSITORY_ACCESS } from '../src/config/repoAccess';
|
||||
import { MEMBERS } from '../src/config/users';
|
||||
import { resolveGoogleMemberEmail } from '../src/config/utils';
|
||||
import type { RoleId } from '../src/config/roleIds';
|
||||
|
||||
const roleLookup = buildRoleLookup();
|
||||
|
|
@ -157,6 +158,30 @@ console.log('Validating Google Workspace user provisioning fields...');
|
|||
}
|
||||
}
|
||||
|
||||
// Validate that external group members are explicitly permitted.
|
||||
// allowExternalMembers is an explicit per-role opt-in (see GoogleConfig in
|
||||
// roles.ts): if a group's membership resolves to any non-@modelcontextprotocol.io
|
||||
// email but the role does not opt in, `pulumi up` would set the group's
|
||||
// ALLOW_EXTERNAL_MEMBERS setting to false and Google would silently purge the
|
||||
// external members ~1-2 days later (#133 incident). Fail loudly instead.
|
||||
console.log('Validating external group members are explicitly permitted...');
|
||||
for (const member of MEMBERS) {
|
||||
const memberEmail = resolveGoogleMemberEmail(member);
|
||||
if (!memberEmail || memberEmail.endsWith('@modelcontextprotocol.io')) continue;
|
||||
|
||||
for (const roleId of member.memberOf) {
|
||||
const role = roleLookup.get(roleId);
|
||||
if (!role?.google || role.google.allowExternalMembers === true) continue;
|
||||
|
||||
console.error(
|
||||
`ERROR: Google group "${role.google.group}" has external member "${memberEmail}" ` +
|
||||
`but its role does not permit external members. If this member is intentional, ` +
|
||||
`add allowExternalMembers: true to the '${role.id}' role's google config in src/config/roles.ts`
|
||||
);
|
||||
hasErrors = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Validate parent role references in roles.ts
|
||||
console.log('Validating parent role references in roles.ts...');
|
||||
for (const role of ROLES) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue