Missing audit event when changing Pages public access setting at group level
Summary
Changing the Pages visibility (pages_access_level) at the project level correctly creates an audit event (project_feature_pages_access_level_updated), but toggling the "Remove public access" setting (force_pages_access_control) at the group level does not produce any audit event.
This is a gap in audit event instrumentation for a security-relevant setting that affects all projects within a group and its subgroups.
Current Behavior
- Project level: Changing Pages access level triggers
project_feature_pages_access_level_updatedaudit event viaProjects::ProjectFeatureChangesAuditor(ee/lib/projects/project_feature_changes_auditor.rb). This works correctly. - Group level: Toggling "Remove public access" (
force_pages_access_controlonNamespaceSetting) does not create an audit event. The column is explicitly excluded fromNamespaces::NamespaceSettingChangesAuditor(ee/lib/namespaces/namespace_setting_changes_auditor.rb).
Root Cause
The force_pages_access_control column is not listed in EVENT_NAME_PER_COLUMN in ee/lib/namespaces/namespace_setting_changes_auditor.rb, and is explicitly placed in the denylist (columns_not_to_audit) in the corresponding spec (ee/spec/lib/namespaces/namespace_setting_changes_auditor_spec.rb, around line 127).
The flow is:
- Group update goes through
Groups::UpdateService(EE override inee/app/services/ee/groups/update_service.rb) - On success,
log_audit_eventsis called, which invokesNamespaces::GroupChangesAuditor GroupChangesAuditordelegates toNamespaces::NamespaceSettingChangesAuditorNamespaceSettingChangesAuditoronly audits columns in itsEVENT_NAME_PER_COLUMNhash, which does not includeforce_pages_access_control
Expected Behavior
Toggling the "Remove public access" setting for Pages at the group level should create an audit event, consistent with how project-level Pages access changes are audited.
Proposal
-
Create a new audit event type file at
ee/config/audit_events/types/group_force_pages_access_control_updated.yml:--- name: group_force_pages_access_control_updated description: A group's Pages public access control setting is updated introduced_by_issue: <this issue URL> introduced_by_mr: <MR URL> feature_category: pages milestone: '<current milestone>' saved_to_database: true streamed: true scope: [Group] -
Add the column to
EVENT_NAME_PER_COLUMNinee/lib/namespaces/namespace_setting_changes_auditor.rb:force_pages_access_control: 'group_force_pages_access_control_updated' -
Update the spec in
ee/spec/lib/namespaces/namespace_setting_changes_auditor_spec.rb:- Remove
force_pages_access_controlfrom thecolumns_not_to_auditdenylist - Add a test case to the parameterized table:
:force_pages_access_control | false | true
- Remove
-
Regenerate audit event documentation:
bundle exec rake gitlab:audit_event_types:compile_docs
Relevant Files
| File | Role |
|---|---|
ee/lib/namespaces/namespace_setting_changes_auditor.rb |
Auditor that needs the new column entry |
ee/spec/lib/namespaces/namespace_setting_changes_auditor_spec.rb |
Spec with denylist to update |
ee/lib/projects/project_feature_changes_auditor.rb |
Reference: how project-level Pages audit works |
ee/config/audit_events/types/project_feature_pages_access_level_updated.yml |
Reference: existing project-level audit event type |
app/views/groups/settings/_pages_access_control.html.haml |
The group settings UI for "Remove public access" |
app/controllers/concerns/groups/params.rb |
Where force_pages_access_control is permitted |
ee/app/services/ee/groups/update_service.rb |
EE group update service that calls log_audit_events |