feat(googleworkspace): add groups service checks#11186
Conversation
|
✅ Conflict Markers Resolved All conflict markers have been successfully resolved in this pull request. |
|
✅ All necessary |
Compliance Mapping ReviewThis PR adds new checks. Please verify that they have been mapped to the relevant compliance framework requirements. New checks already mapped in this PR
Use the |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #11186 +/- ##
==========================================
+ Coverage 93.65% 95.58% +1.92%
==========================================
Files 232 60 -172
Lines 33968 1630 -32338
==========================================
- Hits 31813 1558 -30255
+ Misses 2155 72 -2083
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
🔒 Container Security ScanImage: 📊 Vulnerability Summary
5 package(s) affected
|
danibarranqueroo
left a comment
There was a problem hiding this comment.
Good job! Please review this two little suggestions.
| # Default is true (insecure) — only false is compliant | ||
| if incoming_mail is None or incoming_mail is True: | ||
| effective = "true (default)" if incoming_mail is None else "true" | ||
| issues.append( | ||
| f"group owners can allow incoming email from outside the organization ({effective})" | ||
| ) |
There was a problem hiding this comment.
CIS 3.1.6.2 (in cis_1.3_googleworkspace.json, edited in this PR) documents the opposite default:
"DefaultValue": "... • Group owners can allow incoming email from outside the organization is unchecked"
It's also inconsistent within the same check: the adjacent toggle ownersCanAllowExternalMembers — listed right next to it in the same CIS DefaultValue ("unchecked") — is correctly treated as
default=False (if external_members is True: doesn't fire on None). Both are admin-console booleans on the same screen with the same documented default; treating only one as insecure-on-absence
will FAIL tenants whose config matches the CIS default and is compliant.
Suggested Fix:
- In the check: change i
f incoming_mail is None or incoming_mail is True:→if incoming_mail is True:, and drop the (default) rendering branch. - In groups_creation_restricted_test.py:152-186 (test_fail_all_defaults_none): with everything None, only the create_groups_access_level issue should be reported (USERS_IN_DOMAIN is the genuine insecure default). Update the docstring and remove the assert "incoming email" in findings[0].status_extended. Consider splitting into two cases — "all-None → FAIL only on creation level" and "creation_level=ADMIN_ONLY, others None → PASS" — to lock the corrected default in.
- PR description: the line "USERS_IN_DOMAIN and true for incoming mail are insecure for 3.1.6.2" propagates the same wrong assumption and should be updated.
Context
Groups service checks for the Google Workspace provider. This PR implements the 3 automatable CIS controls for Groups for Business using the Cloud Identity Policy API (
groups_for_business.groups_sharingsetting).Description
Implements 3 CIS Google Workspace Groups controls covering external access, group creation restrictions, and conversation visibility:
Groups (3):
collaboration_capabilityisDOMAIN_USERS_ONLYor absent (secure default)create_groups_access_levelisADMIN_ONLY,owners_can_allow_external_membersisfalse, andowners_can_allow_incoming_mail_from_publicisfalseview_topics_default_access_levelisGROUP_MEMBERSDefault field values from the Policy API are handled explicitly: fields absent from the API response are treated according to their documented defaults (
DOMAIN_USERS_ONLYis secure for 3.1.6.1;USERS_IN_DOMAINandtruefor incoming mail are insecure for 3.1.6.2;DOMAIN_USERSis insecure for 3.1.6.3).Checklist
Community Checklist
SDK/CLI
UI
API
License
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.