1. Resources
  2. Detection rules
  3. Security Policy Deleted or Bypassed in GitLab

Security Policy Deleted or Bypassed in GitLab detection rules

An attacker deletes a GitLab security policy, unlinks the security policy project, removes the compliance framework that puts a project in scope, or uses a bypass exception, so enforced scans and approvals no longer stop a change.

Platform
GitLab
Severity
Medium
Log source
GitLab audit events
Last updated
MITRE ATT&CK technique
T1685Disable or Modify Tools
Rule formats
Sigmaand queries for: Splunk
What an attacker needs
The right to change the security policy project or its link, to remove a compliance framework, or an identity listed in a policy's bypass settings.
Impact
Enforced scans and approvals stop applying to a project or are skipped for one change, which then reaches a protected branch.
Response
Restore the policy, its link or the compliance framework, and review what was merged or pushed while the policy did not apply.
Mitigation
Keep the security policy project out of the reach of development teams, and keep bypass settings short and reviewed.
Audit events
destroy_compliance_frameworkcompliance_framework_removedcompliance_framework_deletedsecurity_policy_merge_request_merged_with_policy_violationsmerge_request_merged_with_dismissed_security_policysecurity_policy_merge_request_bypasssecurity_policy_user_push_bypasssecurity_policy_access_token_push_bypasssecurity_policy_service_account_push_bypasssecurity_policy_protected_branch_bypasssecurity_policy_access_token_branch_deletion_bypasssecurity_policy_service_account_branch_deletion_bypassand 4 more in the rules below

How the attack works

Security policies (Ultimate) let a security or compliance team enforce controls on groups and projects from one place: scans that must run in pipelines, jobs that are injected into them, and approvals that a merge request needs when a scan finds something. The policies live in a security policy project that is linked to the groups and projects they apply to, and a policy can be scoped to the projects that carry a certain compliance framework. GitLab's own guidance is that development teams should not be able to disable, modify or circumvent the policies.

An attacker who wants a change to pass has several ways around them, and each one is an audit event type. They can delete a policy (security_policy_delete), change the link to the security policy project (policy_project_updated), or remove the compliance framework from a project so that a scoped policy no longer applies (compliance_framework_removed, destroy_compliance_framework). They can also use the exceptions a policy allows. A merge request approval policy can name branches, access tokens, service accounts, users, groups and roles that may bypass it, and GitLab logs each use, for example as security_policy_merge_request_bypass or security_policy_user_push_bypass. A merge that went through despite violations is recorded as security_policy_merge_request_merged_with_policy_violations.

What an attacker needs

  • To change policies, the right to merge into the security policy project. To link or unlink it, the Owner role on the group or project, or a custom role with the manage_security_policy_link permission.
  • To delete a compliance framework, the Owner or Security Manager role on the top-level group or a custom role with the admin_compliance_framework permission. GitLab also states that project Owners can choose the framework that is applied to their projects.
  • To bypass, an identity that the policy lists in its bypass settings, such as a user, an access token or a service account.
  • Log collection: audit event streaming (Ultimate) for the top-level group or the instance, to an HTTP destination, received as JSON. GitLab logs bypass events in the security policy project, so the stream must cover the group that holds it.

Impact

The checks that were meant to be mandatory stop applying to a project, or are skipped for one change. Code with known vulnerabilities, leaked secrets or no independent approval reaches a protected branch and the pipelines that deploy from it. Because bypass exceptions are part of the policy, their use does not look like a violation unless someone reads the audit events.

Detection rules

GitLab Compliance Framework Deleted or Removed From a Project

Detects a compliance framework being deleted (destroy_compliance_framework) or removed from a project (compliance_framework_removed, GitLab 17.2 and later, and the older type compliance_framework_deleted). A compliance framework marks the projects that need additional oversight, and in the Ultimate tier it can enforce security policies on the projects it is applied to, because a policy can be scoped by compliance framework. Taking the framework off a project removes the project from the scope of those policies without any change to the policy itself. The event type reference lists these events without their fields, so the rule matches on the event type. The project or group is in entity_path.

LevelMediumStatusExperimentalLog sourceGitLab audit events
title: GitLab Compliance Framework Deleted or Removed From a Project
id: bb63dea5-12ca-4f8e-bcc4-118a1afdba86
status: experimental
description: >-
  Detects a compliance framework being deleted (destroy_compliance_framework)
  or removed from a project (compliance_framework_removed, GitLab 17.2 and
  later, and the older type compliance_framework_deleted). A compliance
  framework marks the projects that need additional oversight, and in the
  Ultimate tier it can enforce security policies on the projects it is
  applied to, because a policy can be scoped by compliance framework.
  Taking the framework off a project removes the project from the scope
  of those policies without any change to the policy itself. The event
  type reference lists these events without their fields, so the rule
  matches on the event type. The project or group is in entity_path.
references:
  - https://docs.gitlab.com/user/compliance/audit_event_types/
  - https://docs.gitlab.com/user/compliance/compliance_frameworks/
  - https://docs.gitlab.com/user/application_security/policies/
  - https://attack.mitre.org/techniques/T1685/
author: Forestall
date: 2026-11-18
tags:
  - attack.defense-impairment
  - attack.t1685
logsource:
  product: gitlab
  service: audit
detection:
  selection:
    event_type:
      - destroy_compliance_framework
      - compliance_framework_removed
      - compliance_framework_deleted
  condition: selection
falsepositives:
  - Compliance teams that reorganise frameworks or retire one. A project that moves out of its top-level group also loses its frameworks. Confirm with the owner of the framework.
level: medium

False positives

  • Compliance teams that reorganise frameworks or retire one. A project that moves out of its top-level group also loses its frameworks. Confirm with the owner of the framework.

GitLab Merge Request Merged With Security Policy Violations

Detects a merge request that was merged although a security policy was violated: security_policy_merge_request_merged_with_policy_violations (GitLab 18.2 and later) and merge_request_merged_with_dismissed_security_policy (GitLab 18.5 and later), which GitLab writes when a merge request violated a policy in warn mode, the violation was dismissed and the merge request was merged. With a policy in warn mode the merge request offers an option to bypass the violations. GitLab states that the audit events record that a bypass occurred but not the comment or reason the user gave. The reference lists both events without their fields, so read the merge request for the violations and the reason.

LevelMediumStatusExperimentalLog sourceGitLab audit events
title: GitLab Merge Request Merged With Security Policy Violations
id: 906952ea-cb14-4645-8fef-7c9f34b18dbb
status: experimental
description: >-
  Detects a merge request that was merged although a security policy was
  violated: security_policy_merge_request_merged_with_policy_violations
  (GitLab 18.2 and later) and
  merge_request_merged_with_dismissed_security_policy (GitLab 18.5 and
  later), which GitLab writes when a merge request violated a policy in
  warn mode, the violation was dismissed and the merge request was merged.
  With a policy in warn mode the merge request offers an option to bypass
  the violations. GitLab states that the audit events record that a
  bypass occurred but not the comment or reason the user gave. The reference
  lists both events without their fields, so read the merge request for
  the violations and the reason.
references:
  - https://docs.gitlab.com/user/compliance/audit_event_types/
  - https://docs.gitlab.com/user/application_security/policies/merge_request_approval_policies/
  - https://attack.mitre.org/techniques/T1685/
author: Forestall
date: 2026-11-18
tags:
  - attack.defense-impairment
  - attack.t1685
logsource:
  product: gitlab
  service: audit
detection:
  selection:
    event_type:
      - security_policy_merge_request_merged_with_policy_violations
      - merge_request_merged_with_dismissed_security_policy
  condition: selection
falsepositives:
  - Policies that are rolled out in warn mode, where developers dismiss findings while the policy is tested. Expect many events during a rollout and review them with the team that owns the policy.
level: medium

False positives

  • Policies that are rolled out in warn mode, where developers dismiss findings while the policy is tested. Expect many events during a rollout and review them with the team that owns the policy.

GitLab Security Policy Bypassed

Detects the use of a bypass exception of a security policy. GitLab writes separate audit event types for a policy bypassed for a merge request (security_policy_merge_request_bypass), a blocked branch push bypassed for configured users, access tokens or service accounts (security_policy_user_push_bypass, security_policy_access_token_push_bypass, security_policy_service_account_push_bypass), a protected branch push restriction bypassed (security_policy_protected_branch_bypass), a protected branch deleted by an access token or service account through a bypass (security_policy_access_token_branch_deletion_bypass, security_policy_service_account_branch_deletion_bypass) and a merge request whose approval is bypassed by the branches configured in the policy (merge_request_branch_bypassed_by_security_policy). The exceptions are part of the policy, so each event is an allowed action that still needs a reason. GitLab logs bypass events in the security policy project. The types were introduced between GitLab 18.2 and 18.10, and the reference lists them without their fields.

LevelMediumStatusExperimentalLog sourceGitLab audit events
title: GitLab Security Policy Bypassed
id: c8dfe99b-b5fb-4aca-bc5f-84013b85800d
status: experimental
description: >-
  Detects the use of a bypass exception of a security policy. GitLab
  writes separate audit event types for a policy bypassed for a merge
  request (security_policy_merge_request_bypass), a blocked branch push
  bypassed for configured users, access tokens or service accounts
  (security_policy_user_push_bypass,
  security_policy_access_token_push_bypass,
  security_policy_service_account_push_bypass), a protected branch push
  restriction bypassed (security_policy_protected_branch_bypass), a
  protected branch deleted by an access token or service account through
  a bypass (security_policy_access_token_branch_deletion_bypass,
  security_policy_service_account_branch_deletion_bypass) and a merge
  request whose approval is bypassed by the branches configured in the
  policy (merge_request_branch_bypassed_by_security_policy). The
  exceptions are part of the policy, so each event is an allowed action
  that still needs a reason. GitLab logs bypass events in the security
  policy project. The types were introduced between GitLab 18.2 and
  18.10, and the reference lists them without their fields.
references:
  - https://docs.gitlab.com/user/compliance/audit_event_types/
  - https://docs.gitlab.com/user/application_security/policies/merge_request_approval_policies/
  - https://attack.mitre.org/techniques/T1685/
author: Forestall
date: 2026-11-18
tags:
  - attack.defense-impairment
  - attack.t1685
logsource:
  product: gitlab
  service: audit
detection:
  selection:
    event_type:
      - security_policy_merge_request_bypass
      - security_policy_user_push_bypass
      - security_policy_access_token_push_bypass
      - security_policy_service_account_push_bypass
      - security_policy_protected_branch_bypass
      - security_policy_access_token_branch_deletion_bypass
      - security_policy_service_account_branch_deletion_bypass
      - merge_request_branch_bypassed_by_security_policy
  condition: selection
falsepositives:
  - Release automation, mirroring and dependency updates that the policy exempts on purpose. Exclude the service account or token by author_id once its exception is confirmed, and review every bypass by a person.
  - Branch exceptions such as merges from a release branch, which fire on every such merge request. Drop merge_request_branch_bypassed_by_security_policy from the list if it is too noisy.
level: medium

False positives

  • Release automation, mirroring and dependency updates that the policy exempts on purpose. Exclude the service account or token by author_id once its exception is confirmed, and review every bypass by a person.
  • Branch exceptions such as merges from a release branch, which fire on every such merge request. Drop merge_request_branch_bypassed_by_security_policy from the list if it is too noisy.

GitLab Security Policy Deleted or Security Policy Project Link Changed

Detects a security policy being deleted (security_policy_delete, GitLab 18.1 and later), the security policy project of a group or project being updated (policy_project_updated) and the compliance and security policy group of the instance being assigned, changed or removed (compliance_and_security_policy_group_updated, GitLab 19.6 and later). Security policies enforce scans, pipeline jobs and merge request approvals from a separate security policy project. Deleting a policy, or changing the link between a project and its policy project, takes those controls away without touching the project's own settings. The event type reference lists these events without their fields, so the rule does not tell a link from an unlink. Read the Policies page of the group or project for the state now in force.

LevelMediumStatusExperimentalLog sourceGitLab audit events
title: GitLab Security Policy Deleted or Security Policy Project Link Changed
id: 6a3c057b-cf4d-487d-842b-747a9ddd956d
status: experimental
description: >-
  Detects a security policy being deleted (security_policy_delete, GitLab
  18.1 and later), the security policy project of a group or project being
  updated (policy_project_updated) and the compliance and security policy
  group of the instance being assigned, changed or removed
  (compliance_and_security_policy_group_updated, GitLab 19.6 and later).
  Security policies enforce scans, pipeline jobs and merge request
  approvals from a separate security policy project. Deleting a policy, or
  changing the link between a project and its policy project, takes those
  controls away without touching the project's own settings. The event
  type reference lists these events without their fields, so the rule
  does not tell a link from an unlink. Read the Policies page of the group
  or project for the state now in force.
references:
  - https://docs.gitlab.com/user/compliance/audit_event_types/
  - https://docs.gitlab.com/user/application_security/policies/
  - https://attack.mitre.org/techniques/T1685/
author: Forestall
date: 2026-11-18
tags:
  - attack.defense-impairment
  - attack.t1685
logsource:
  product: gitlab
  service: audit
detection:
  selection:
    event_type:
      - security_policy_delete
      - policy_project_updated
      - compliance_and_security_policy_group_updated
  condition: selection
falsepositives:
  - The security team retiring a policy or linking a policy project to a new group. Policies change rarely, so confirm each event against the merge request in the security policy project.
level: medium

False positives

  • The security team retiring a policy or linking a policy project to a new group. Policies change rarely, so confirm each event against the merge request in the security policy project.

Detection logic

Patterns that need more than one event, a baseline or knowledge of your own environment. Each is a hypothesis to build and tune in your SIEM, not a ready rule.

Project taken out of policy scope, change merged, scope restored

Detection hypothesisSequence of events

Removing a policy for one merge and putting it back hides in two routine events. A compliance framework that is removed from a project and added again, or a policy project link that changes twice, with a merge in the same project in between, shows a control that was lifted for exactly one change.

  1. The scope is lifted: compliance_framework_removed or policy_project_updated for a project. Keep entity_path, author_id and the time.
  2. Within the next 24 hours a merge request is merged in that project: merge_request_merged (GitLab 17.5 and later) with the same entity_path.
  3. The scope comes back: compliance_framework_added (GitLab 17.2 and later) or a second policy_project_updated for the same project after the merge.
  4. Alert when all three exist, and raise the priority when the same author_id lifted and restored the scope.

Eventscompliance_framework_removedpolicy_project_updatedmerge_request_mergedcompliance_framework_added

LimitsA team that reorganises its compliance frameworks produces the first and third step for many projects at once without any merge in between. The link event does not say in a documented field whether the project was linked or unlinked. The 24 hours are a starting point.

Triage

  • Identify who acted (author_name, author_id, ip_address), which event type it was and where (entity_path). For bypass events the entity may be the security policy project, so read target_details and the details object for the project and the merge request.
  • For a deleted or changed policy, open the merge request in the security policy project that made the change and check who approved it.
  • For a changed policy project link, check in the Policies page of the group or project which security policy project is linked now, if any.
  • For a bypass, find the exception in the policy that allowed it and ask the user or the owner of the token for the reason. GitLab's audit events record that a bypass occurred but not the reason that was entered.
  • For a removed compliance framework, check which policies were scoped to that framework and what was merged in the project afterwards.

Response

Once the attack is confirmed:

  1. Restore the policy, the link to the security policy project or the compliance framework, and confirm on the Policies page that the policy is enforced again.
  2. Review what was merged or pushed in the affected projects while the policy did not apply, and revert changes that would have been blocked.
  3. Run the scans the policy enforces on the current default branch of those projects and handle the findings.
  4. Remove the bypass exception that was misused, and revoke the access token or secure the account behind it.
  5. Take the role that allowed the change from the account that made it until the change is explained.

Mitigation

  • Keep the security policy project in a group that development teams cannot administer, protect its default branch and require approvals from the security team on its merge requests.
  • Limit the Owner role and the manage_security_policy_link permission on groups, so that few accounts can unlink the policy project.
  • Keep bypass settings as short as possible, prefer service accounts over people, and review the list on a schedule.
  • Scope policies by group where you can, so that removing a compliance framework from a project does not take the project out of scope.
  • Alert on every deleted policy, every change of the policy project link and every bypass, and review bypasses with the team that owns the policy.

Frequently asked questions

Is every bypass event an incident?

No. A bypass is an exception that the policy itself allows, for example for a release automation or for an emergency. GitLab logs each use so that someone can review it. The event becomes a finding when the identity had no reason to use the exception, when the reason does not hold, or when the exception was added to the policy shortly before it was used.

Do the audit events contain the reason a user gave for a bypass?

No. For policies in warn mode GitLab states that audit events record that a bypass occurred but do not include the bypass comment or dismissal reason. Read the reason in the merge request itself, and treat a missing or meaningless reason as part of the finding.

Why does removing a compliance framework from a project matter for policies?

A policy can be scoped to the projects that carry certain compliance frameworks. In the Ultimate tier GitLab describes the framework as able to enforce security policies on the projects it is applied to. Taking the framework off a project, or deleting the framework, therefore removes the project from the scope of those policies without any change to the policy file.

Which GitLab versions write these events?

They arrived over many releases. The policy project link event exists from GitLab 15.6 and the compliance framework events from 14.1, 14.6 and 17.2. Policy creation, update and deletion events exist from 18.1, the token and service account push bypass and the merge with violations from 18.2, the user push bypass from 18.4, the merge request bypass from 18.5, the branch deletion bypass from 18.9 and the protected branch bypass from 18.10. Older instances are silent for the missing types.

References

We respect your privacy

We use cookies to keep this site secure and working properly. With your permission, we also use optional cookies to understand usage and improve the experience. Cookie Policy

You can change your choice at any time.