> ## Documentation Index
> Fetch the complete documentation index at: https://docs.coderabbit.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Enforce settings teams can't change

> Pin review policy with global overrides, lock the status check settings, and fix the configuration branch so a pull request can't rewrite it.

Teams can change most settings in their own repository. To make a policy stick, enforce the keys with global overrides and stop pull requests from rewriting configuration on their own.

## Before you start

* The **Configuration source** page is available only for GitHub Cloud with CodeRabbit Cloud. Other Git providers, GitHub Enterprise Server and self-hosted CodeRabbit always use **Auto**.
* To choose between enforcing and setting defaults, see [Apply settings to every repository](https://docs.coderabbit.ai/configuration/guides/all-repositories.md).

## Know what a pull request can change

A [trusted](https://docs.coderabbit.ai/configuration/branch.md#who-counts-as-trusted) pull request, from a branch in the same repository, is reviewed with its own `.coderabbit.yaml`. It can change its own review settings, including risk limits and status check settings. A pull request can also change settings for one review through a command or its description.

| Channel | Can change | Can't change |
| - | - | - |
| Repository file in a trusted pull request | Any setting the file sets | Anything pinned by global overrides |
| `@coderabbitai review --with-config` | Any setting the block sets, including `reviews.review_progress`, `reviews.commit_status` and `reviews.fail_commit_status` | Merge and security risk instructions, `allow_author_approval`, approval risk limits and `overrides`, widening knowledge base scopes, and anything pinned by global overrides |
| Pull request description block | `reviews.review_details`; for trusted pull requests, also `reviews.path_instructions` and `knowledge_base.code_guidelines.filePatterns` | The approval policy, merge and security risk instructions, and every key not listed |

See [Change settings for one pull request](https://docs.coderabbit.ai/configuration/guides/one-pull-request.md) for the commands.

## Enforce keys with global overrides

1. Open **Review > Review settings** and select **Organization defaults**. For an SSO workspace, use **Workspace settings**.
2. Set **View mode** to **Global overrides**.
3. Write YAML with only the keys to enforce.
4. Save. The overrides apply to later reviews.

```yaml theme={null}
reviews:
  profile: assertive
inheritance: true
```

Global overrides win over every layer and over per-pull-request overrides. The workspace's overrides win over the organization's. When an organization has **Use workspace settings** on, CodeRabbit ignores its organization global overrides. Set the overrides in the workspace instead. A list in the overrides adds to a repository's list: entries with a matching key take the override's values, and other repository entries stay. Setting `inheritance: true` in the overrides forces inheritance for every repository, whatever its own file says. You can't change global overrides through the API.

## Lock the status check settings

To make sure a repository or pull request can't change what the `CodeRabbit` check reports, pin these keys in global overrides. Set each key to the value you want to enforce.

```yaml theme={null}
reviews:
  review_progress: true
  commit_status: true
  fail_commit_status: true
```

Global overrides use V2 keys.

See [Status check](https://docs.coderabbit.ai/pr-reviews/status-check.md) for what each key does.

## Pin the configuration branch

By default, CodeRabbit reads a trusted pull request's own file. To read the default branch instead:

1. Open the repository's **Configuration source** page. An organization admin makes the change.
2. Select **Default branch**.
3. Turn off **Allow configuration changes from trusted PRs**, which is on by default with this option.
4. Select **Save changes**.

With the toggle off, a pull request that edits the file doesn't change its own review. To pin the file to a dedicated branch, select **Custom** and name a branch in the same repository. A pull request that merges into that branch still changes the file for later reviews, so protect the branch so that only administrators can change it. Under **Auto**, fork pull requests use the configuration at their base commit. Under **Default branch** they use the latest commit on the default branch, and under **Custom** the named branch. See [Choose the configuration branch](https://docs.coderabbit.ai/configuration/branch.md).

## Check the result

Post `@coderabbitai configuration` on a pull request that tries to change an enforced key. The key's `# Source:` comment names `Organization global overrides` or `Workspace global overrides`. The **Run configuration** section of **Review info** shows the **Source mode** and branch. See [Check which configuration a review used](https://docs.coderabbit.ai/configuration/guides/check-effective-configuration.md).

## What's next

> [card] [Global overrides](https://docs.coderabbit.ai/configuration/global-overrides.md)
>
> Learn how overrides combine with every other layer.

> [card] [Choose the configuration branch](https://docs.coderabbit.ai/configuration/branch.md)
>
> Pick Auto, Default branch, or Custom for each repository.

> [card] [Status check](https://docs.coderabbit.ai/pr-reviews/status-check.md)
>
> Configure the check that gates merging.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.