Austin Pierce opened issue #596563: Allow administrators to configure email notifications to exclude source code content at GitLab.org / GitLab

Austin Pierce
2026-04-13T19:14:28Z

Problem to Solve

Organizations operating in regulated or security-sensitive environments (e.g., defense, finance, healthcare, government) often have strict data classification policies governing what information may transit certain communication channels. GitLab email notifications — particularly those triggered by code review activity (merge request comments, inline diff comments, suggestions) — can include snippets of source code. When these emails are routed through email systems that are not cleared or approved for source code, this creates a compliance and data security risk.

Currently, the only way to prevent source code from appearing in email notifications is to disable email notifications entirely, which is an unacceptable trade-off for teams that rely on email-based workflows for non-code activity (e.g., issue updates, pipeline status, mentions).

Intended Users

Instance administrators on Self-Managed and GitLab Dedicated deployments who need to enforce organization-wide email content policies

Group owners who manage teams with specific data handling requirements

Security and compliance officers who need to ensure source code does not transit uncleared email infrastructure

User Experience Goal

Administrators should be able to configure GitLab so that email notifications never include source code content (e.g., diff hunks, inline code snippets from review comments, code suggestions), while still delivering all other notification metadata (e.g., who commented, on which file/line, a link back to GitLab to view the full content).

Proposal

Introduce a configurable setting — at the instance level (Admin Area) and optionally at the group level — that controls whether source code content is included in outbound email notifications.

When enabled, this setting would:

Strip code diff/snippet content from email notification bodies for events.

Replace stripped content with a placeholder such as:

"[Source code content omitted. Click here to view the full comment in GitLab.]" along with a direct link to the relevant resource in the GitLab UI.

Preserve all other notification content, including:

Commenter name and timestamp

File name and line number reference

Any non-code prose in the comment body

Links back to the merge request / commit / issue

Benefits

Enables organizations with strict data classification requirements to use GitLab email notifications safely

Reduces the risk of source code inadvertently transiting uncleared or unencrypted email infrastructure

Provides a compliance-friendly alternative to disabling email notifications entirely

Aligns with GitLab's compliance and governance capabilities (devopsgovern)

Permissions and Security

The instance-level setting should be configurable only by instance administrators

If a group-level override is supported, it should only be configurable by group owners, and only if the instance setting permits overrides

The setting should be enforced server-side — it must not be bypassable by individual users

Availability

Self-Managed (primary use case)

GitLab Dedicated

GitLab.com (group-level setting may be applicable)