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

# Blocking Rules

> Blocking rules enforce security and quality standards in pull requests or CI pipelines.

## Overview

### What it Does

Blocking rules are guardrails that define which findings should fail a pull request check or CI pipeline. This helps ensure that your codebase adheres to your organization's security and quality standards.

You can create three types of blocking rules:

* **Code Vulnerability Rules**: Block PRs based on security vulnerabilities, code-quality findings, or both
* **Dependency Vulnerability Rules**: Block PRs based on vulnerable dependencies found by SCA scanning
* **License Compliance Rules**: Block dependencies with specific SPDX licenses or license families

### Who it's For

Blocking rules are primarily designed for:

* Development teams
* Project managers
* Security professionals

This feature is particularly useful for organizations with strict compliance requirements or those working on mission-critical applications where code quality and security are paramount.

## Key Features and Benefits

<AccordionGroup>
  <Accordion title="Enforce Coding Standards" icon="shield-check">
    Define rules based on Common Weakness Enumerations (CWEs) to block pull requests that introduce specific types of vulnerabilities or code quality issues.
  </Accordion>

  <Accordion title="Customize Urgency Levels" icon="signal">
    Assign urgency levels (e.g., critical, high, medium, low) to different types of issues, allowing you to prioritize and handle them accordingly.
  </Accordion>

  <Accordion title="Filter Dependencies by CVSS" icon="gauge">
    For dependency vulnerability rules, define an inclusive CVSS score range to block vulnerable dependencies based on their CVSS score.
  </Accordion>

  <Accordion title="Filter Dependencies by Reachability" icon="diagram-project">
    For dependency vulnerability rules that apply to CI, narrow blocking to dependencies whose vulnerable code is actually reachable from your application, so unused and unreachable packages do not fail your pipeline.
  </Accordion>

  <Accordion title="Enforce License Policy" icon="file-contract">
    Block dependencies by specific SPDX license IDs or by the Copyleft, Permissive, and Commercial license families.
  </Accordion>

  <Accordion title="Project and Tag Scoped Rules" icon="folder-tree">
    Apply blocking rules to specific projects, project tags, or across your entire organization, giving you granular control over which projects are subject to which rules.
  </Accordion>

  <Accordion title="Rule Management" icon="gear">
    Easily create, edit, and delete blocking rules through a user-friendly interface, ensuring your rules stay up-to-date with your evolving requirements.
  </Accordion>

  <Accordion title="Rule Activation/Deactivation" icon="toggle-on">
    Toggle the status of blocking rules to temporarily enable or disable them as needed, without losing their configurations.
  </Accordion>
</AccordionGroup>

<h2 id="rule-types">
  Rule Types
</h2>

Blocking rules support three distinct types to provide comprehensive security coverage:

<CardGroup cols={3}>
  <Card title="Code Vulnerability" icon="code">
    Blocks pull requests based on **security vulnerabilities**, **code-quality findings**, or both.

    Configure by:

    * Selecting an issue type: All, Vulnerabilities, or Code Quality
    * Selecting specific CWE (Common Weakness Enumeration) categories
    * Setting urgency/severity levels

    Use this to prevent issues like SQL injection, XSS, insecure cryptography, and other code-level vulnerabilities.
  </Card>

  <Card title="Dependency Vulnerability" icon="box">
    Blocks pull requests based on **vulnerable dependencies** found by software composition analysis (SCA).

    Configure by:

    * Setting urgency/severity levels (Critical, High, Medium, Low)
    * Or setting an inclusive CVSS score range from 0.0 to 10.0
    * Optionally narrowing by [reachability](#reachability) (CI rules only)

    Use this to prevent the introduction of packages with known security vulnerabilities, ensuring your supply chain remains secure.
  </Card>

  <Card title="License Compliance" icon="file-contract">
    Blocks pull requests or CI pipelines when a dependency uses a denied license.

    Configure by:

    * Selecting one or more license families: Copyleft, Permissive, or Commercial
    * Entering specific SPDX license IDs, such as `AGPL-3.0`

    Use this to enforce your organization's open-source and commercial license policy.
  </Card>
</CardGroup>

## How it Works with GitHub

<Info>
  **Prerequisite** You must have installed and configured the [Corgea GitHub App](github) with appropriate repository permissions.
</Info>

<Steps>
  <Step title="Pull Request Submission">
    Developer submits a pull request with code changes
  </Step>

  <Step title="Automated Analysis">
    System analyzes code changes against active blocking rules
  </Step>

  <Step title="Rule Validation">
    If violations are found, pull request is automatically blocked

    <Frame>
      <img src="https://mintcdn.com/corgea/uxLuQR4653lM43Tj/images/blocking_rules_pr_blocked.png?fit=max&auto=format&n=uxLuQR4653lM43Tj&q=85&s=39013c8f8163f96d432b0f9bd4abbc05" style={{ borderRadius: '0.5rem' }} width="2776" height="1034" data-path="images/blocking_rules_pr_blocked.png" />
    </Frame>
  </Step>

  <Step title="Developer Notification">
    Developer receives detailed notification about rule violations

    <Frame>
      <img src="https://mintcdn.com/corgea/uxLuQR4653lM43Tj/images/blocking_rules_pr_details.png?fit=max&auto=format&n=uxLuQR4653lM43Tj&q=85&s=4ac0e073341d12a425db9a4412e55b3e" style={{ borderRadius: '0.5rem' }} width="3078" height="1834" data-path="images/blocking_rules_pr_details.png" />
    </Frame>
  </Step>

  <Step title="Resolution">
    Developer must fix violations and mark them as Fixed, or mark them as False Positive or Accepted Risk before merge is allowed
  </Step>
</Steps>

## How it Works with Azure DevOps

<Info>
  **Prerequisite** Make sure the [Azure DevOps integration](azure_devops) with Corgea is configured and you have the necessary permissions.
</Info>

<Steps>
  <Step title="Pull Request Submission">
    A developer submits a pull request with code changes in Azure DevOps.
  </Step>

  <Step title="Automated Analysis">
    The system evaluates the code changes against the active blocking rules set in Corgea.
  </Step>

  <Step title="Rule Validation">
    If violations are found, the pull request is automatically blocked.

    <Frame>
      <img src="https://mintcdn.com/corgea/uxLuQR4653lM43Tj/images/azure_blocking_rules_pr_blocked.png?fit=max&auto=format&n=uxLuQR4653lM43Tj&q=85&s=a85aa91d3cea8d9572197b863bafa4e4" style={{ borderRadius: '0.5rem' }} width="966" height="512" data-path="images/azure_blocking_rules_pr_blocked.png" />
    </Frame>

    Developer cannot merge the PR until it is resolved.

    <Frame>
      <img src="https://mintcdn.com/corgea/uxLuQR4653lM43Tj/images/azure-devops_merging_blocked.png?fit=max&auto=format&n=uxLuQR4653lM43Tj&q=85&s=1ecb01eb911476a19b0265a3b56dad72" style={{ borderRadius: '0.5rem' }} width="2900" height="2630" data-path="images/azure-devops_merging_blocked.png" />
    </Frame>
  </Step>

  <Step title="Developer Notification">
    The developer receives a link to view detailed information about the failed issues on the Corgea Scan page.

    <Frame>
      <img src="https://mintcdn.com/corgea/uxLuQR4653lM43Tj/images/azure_see_details_of_issues.png?fit=max&auto=format&n=uxLuQR4653lM43Tj&q=85&s=e5e94b8c2fec2b7abab7eb76a37533b1" style={{ borderRadius: '0.5rem' }} width="2696" height="1556" data-path="images/azure_see_details_of_issues.png" />
    </Frame>
  </Step>

  <Step title="Resolution">
    The developer must resolve the violations by fixing them or marking them as False Positive or Accepted Risk before the merge can proceed.
  </Step>
</Steps>

## Usage Guide

### Creating a New Blocking Rule

<Steps>
  <Step title="Initiate Creation">
    Click the "Add Blocking Rule" button
  </Step>

  <Step title="Choose Rule Type">
    Select the type of blocking rule:

    * **Code Vulnerability**: Block pull requests based on code security issues (SAST findings)
    * **Dependency Vulnerability**: Block pull requests based on vulnerable dependencies (SCA findings)
    * **License Compliance**: Block dependencies based on denied SPDX licenses or license families

    <Frame>
      <img src="https://mintcdn.com/corgea/vl87stO-uNzXPjoi/images/blocking_rule_create.png?fit=max&auto=format&n=vl87stO-uNzXPjoi&q=85&s=8dcdba40b68a4f557b9af9b596629262" style={{ borderRadius: '0.5rem' }} alt="Add Blocking Rule modal with Applies To, rule types, and Issue Type" width="459" height="969" data-path="images/blocking_rule_create.png" />
    </Frame>
  </Step>

  <Step title="Basic Information">
    Enter the rule name and description, then choose **Applies To**:

    * **Pull Requests** automatically enforces the rule in pull request checks.
    * **CI** enforces the rule only when a pipeline names it with `corgea scan --block-on <slug>`. CI rules do not block pull requests.

    New rules default to **Pull Requests**. Corgea generates the slug from the rule name and displays it in the rules list.

    <Frame>
      <img src="https://mintcdn.com/corgea/vl87stO-uNzXPjoi/images/blocking_rule_create_ci_license.png?fit=max&auto=format&n=vl87stO-uNzXPjoi&q=85&s=218cc233de7f4711f466cb92303eaf8c" style={{ borderRadius: '0.5rem' }} alt="Add Blocking Rule modal with CI selected and License Compliance configured" width="469" height="946" data-path="images/blocking_rule_create_ci_license.png" />
    </Frame>
  </Step>

  <Step title="Configure Settings">
    For **Code Vulnerability** rules: Choose an **Issue Type** to apply the rule to **All** findings, **Vulnerabilities** only, or **Code Quality** findings only. **All** is the default and preserves the behavior of existing rules. Then select urgency levels (Critical, High, Medium, or Low) and/or target CWEs; at least one of these must be defined for the rule to be valid.

    For **Dependency Vulnerability** rules: Choose whether to filter by severity or CVSS score. Select urgency levels (Critical, High, Medium, or Low), or enter a minimum and maximum CVSS score from 0.0 to 10.0 to block vulnerable dependencies within that inclusive range. If the rule applies to CI, you can also select one or more **Reachability** states to narrow it further — see [Filtering by Reachability](#reachability).

    For **License Compliance** rules: Select at least one denied license family (Copyleft, Permissive, or Commercial) or enter one or more SPDX license IDs. A dependency is blocked when any reported license matches a selected family or specific ID.
  </Step>

  <Step title="Set Scope">
    Choose applicable projects and/or project tags (optional). A rule applies when a project is selected directly or has any selected tag. If no projects or tags are selected, the rule applies to all projects.
  </Step>

  <Step title="Save">
    Review and click "Create"
  </Step>
</Steps>

### Managing Existing Rules

Use search to find rules by name or settings, or filter the list by project tag or **Applies To** target. The rules table shows each rule's slug in the **ID** column and surfaces the project scope, rule type, and **Pull Requests** or **CI** target under **Triggers On**. Select a slug to copy it for use in a CI command. Rules without a project or tag scope apply to all projects, and longer scope lists are grouped behind a **+N more** tooltip.

<Frame>
  <img src="https://mintcdn.com/corgea/vl87stO-uNzXPjoi/images/blocking_rules_list.png?fit=max&auto=format&n=vl87stO-uNzXPjoi&q=85&s=fde00215e97e017b81af0100480d9ad4" style={{ borderRadius: '0.5rem' }} alt="Blocking rules list showing slug, Triggers On chips, and CI badge" width="1684" height="426" data-path="images/blocking_rules_list.png" />
</Frame>

### Enforcing Rules in CI

Create an active rule with **Applies To** set to **CI**, then pass its slug to the scan command. Name rules for the condition that trips them — for example `criticals`, not `no-criticals` — so `--block-on` reads as a direct assertion. `--block-on` requires Corgea CLI 1.10.0 or later.

```bash theme={null}
corgea scan --block-on criticals
```

To enforce multiple CI rules, provide their slugs as a comma-separated list. The command fails when a finding violates any named rule. An unknown slug, inactive rule, or rule that applies to pull requests is treated as a configuration error rather than being skipped. `--block-on` is supported only by the BLAST scanner and cannot be combined with `--fail` or `--fail-on`.

<Tabs>
  <Tab title="Edit Rule">
    1. Locate rule in table
    2. Click "Edit" button
    3. Modify settings as needed
    4. Click "Update" to save
  </Tab>

  <Tab title="Toggle Status">
    1. Find rule in table
    2. Click "Toggle Status"
    3. Confirm status change
  </Tab>

  <Tab title="View Details">
    1. Click on rule name
    2. Review comprehensive information
    3. Close modal when done
  </Tab>
</Tabs>

### Viewing Rules on scans

You can view blocking rules that apply to your scans in two places:

1. On the scan details page, you'll see a "Blocking Rules" section showing all rules that were evaluated:

<Frame>
  <img src="https://mintcdn.com/corgea/uxLuQR4653lM43Tj/images/blocking_rules_scan_details.png?fit=max&auto=format&n=uxLuQR4653lM43Tj&q=85&s=a132f7927273e0eaf8bdb84065bbcbf4" style={{ borderRadius: '0.5rem' }} width="1518" height="1082" data-path="images/blocking_rules_scan_details.png" />
</Frame>

2. For individual issues, you can see which blocking rules were triggered in the issue details:

<Frame>
  <img src="https://mintcdn.com/corgea/uxLuQR4653lM43Tj/images/blocking_rule_issue_details.png?fit=max&auto=format&n=uxLuQR4653lM43Tj&q=85&s=433dd74d99f714b953608a1e59ac973a" style={{ borderRadius: '0.5rem' }} width="3072" height="1124" data-path="images/blocking_rule_issue_details.png" />
</Frame>

This makes it easy to understand which rules are affecting your scans and specific issues, helping you identify why certain changes may be blocked.

<h2 id="reachability">
  Filtering by Reachability
</h2>

Most vulnerable dependencies in a project are never actually exercised by your code. Reachability filtering lets a **Dependency Vulnerability** rule block only the findings that matter, so a critical CVE in a package you never call does not fail your pipeline.

<Info>
  **Available for CI rules only** Reachability is analyzed on scans you start yourself with `corgea scan`, not on the scans triggered automatically when a pull request opens. Set **Applies To** to **CI** to use this filter; the option is hidden for Pull Request rules, and reference the rule from your pipeline with `corgea scan --block-on <slug>`.
</Info>

<Info>
  **Prerequisite** Reachability requires **AI-Native SCA** to be enabled for your organization. Without it no dependency is analyzed, so a rule using this filter never blocks anything. The rule editor warns you when the setting is off.
</Info>

<Frame>
  <img src="https://mintcdn.com/corgea/gpJCGMHYx471xVvQ/images/blocking_rule_create_ci_reachability.png?fit=max&auto=format&n=gpJCGMHYx471xVvQ&q=85&s=571c043010e6323e09fc1523cfd8a5b3" style={{ borderRadius: '0.5rem' }} alt="Add Blocking Rule modal with CI and Dependency Vulnerability selected and Reachable checked under Reachability" width="447" height="884" data-path="images/blocking_rule_create_ci_reachability.png" />
</Frame>

Select one or more of the following states:

| State                 | Meaning                                                               |
| --------------------- | --------------------------------------------------------------------- |
| **Reachable**         | The vulnerable function is reachable from your application code.      |
| **Not Reachable**     | The dependency is used, but the vulnerable function is not reachable. |
| **Unused Dependency** | The dependency is declared but not used anywhere in the codebase.     |
| **Unknown**           | The dependency was analyzed but reachability could not be determined. |

The reachability filter is **combined with** the severity, CVSS, or Malicious filter rather than replacing it, so a finding must match both. A rule set to Critical severity and Reachable blocks only critical vulnerabilities that are also reachable. Leaving reachability empty keeps the rule's existing behavior of blocking regardless of reachability.

### Waiting for Analysis

Reachability analysis runs after the scan itself completes, so `corgea scan` keeps polling while it finishes rather than reporting a result immediately. Analysis is done once every direct dependency has been analyzed, typically a few minutes and at most 30.

This filter **fails open**. If analysis cannot finish — the 30-minute window elapses, analysis fails, or AI-Native SCA is disabled — the rule reports no violation instead of failing your build. A pipeline is only ever blocked on reachability that Corgea actually determined, never on missing analysis.

<Warning>
  `corgea scan` fails closed on its own deadline. Corgea CLI 1.12.0 and later allow 35 minutes, comfortably outlasting the 30-minute analysis window. On an earlier CLI the deadline is 15 minutes, which can expire while Corgea is still analyzing and fail the pipeline. Either upgrade the CLI or raise the deadline with `CORGEA_BLOCKING_RULES_TIMEOUT_SECONDS`:

  ```bash theme={null}
  CORGEA_BLOCKING_RULES_TIMEOUT_SECONDS=2100 corgea scan --block-on reachable-criticals
  ```
</Warning>

## Examples

<AccordionGroup>
  <Accordion title="Blocking Insecure Cryptography" icon="lock">
    **Rule Type:** Code Vulnerability

    Create a rule targeting CWE-326 (Inadequate Encryption Strength) and CWE-327 (Use of a Broken or Risky Cryptographic Algorithm) with "Critical" urgency to prevent weak encryption usage.
  </Accordion>

  <Accordion title="Enforcing Code Quality" icon="code">
    **Rule Type:** Code Vulnerability

    Select **Code Quality** as the issue type, then set up a rule for CWE-398 (Indicator of Poor Code Quality) and CWE-477 (Use of Obsolete Functions) with "Medium" urgency to maintain code standards.
  </Accordion>

  <Accordion title="Blocking Critical Dependency Vulnerabilities" icon="box">
    **Rule Type:** Dependency Vulnerability

    Create a rule with "Critical" and "High" urgency levels selected to automatically block any pull request that introduces dependencies with critical or high-severity vulnerabilities. This ensures your supply chain remains secure and prevents known vulnerable packages from entering your codebase.
  </Accordion>

  <Accordion title="Blocking Dependencies by CVSS Range" icon="gauge">
    **Rule Type:** Dependency Vulnerability

    Create a rule that filters by CVSS score, such as 7.0 to 10.0, to block pull requests that introduce vulnerable dependencies within that score range.
  </Accordion>

  <Accordion title="Blocking Only Reachable Critical Vulnerabilities" icon="diagram-project">
    **Rule Type:** Dependency Vulnerability — **Applies To:** CI

    Select "Critical" and "High" urgency levels, then select **Reachable** under Reachability. The rule fails a pipeline only when a critical or high-severity vulnerability is reachable from your application code, so unused and unreachable packages do not interrupt developers. This is a good first reachability rule because it narrows an existing severity rule rather than widening what blocks.
  </Accordion>

  <Accordion title="Blocking Unused Dependencies" icon="broom">
    **Rule Type:** Dependency Vulnerability — **Applies To:** CI

    Select **Unused Dependency** under Reachability on its own, with no severity or CVSS filter. The rule fails a pipeline that introduces vulnerable packages nothing in the codebase uses, prompting developers to remove the dependency instead of upgrading it.
  </Accordion>

  <Accordion title="Blocking Copyleft Dependencies" icon="file-contract">
    **Rule Type:** License Compliance

    Select the **Copyleft** family to block dependencies whose reported licenses belong to that family. Add specific SPDX IDs when your policy needs a narrower denylist.
  </Accordion>
</AccordionGroup>

## Best Practices

<Card title="Implementation Tips" icon="lightbulb">
  * Start with essential rules and gradually expand
  * For **Dependency Vulnerability rules**, begin with Critical severity only or a focused CVSS range, then expand as your team adjusts
  * On **CI rules**, add a **Reachable** reachability filter to an existing severity rule to cut noise without weakening coverage of the vulnerabilities that are actually exploitable
  * For **Code Vulnerability rules**, focus on the most impactful CWEs first (e.g., injection flaws, authentication issues)
  * Regular review and updates
  * Clear documentation and team training
  * Encourage feedback and collaboration
  * Strategic use of urgency levels
  * Consider project tags when the same rule should cover a group of related projects
</Card>

## Troubleshooting

<Warning>If a pull request is unexpectedly blocked, verify the active rules and their configurations first.</Warning>

<AccordionGroup>
  <Accordion title="Common Issues" icon="bug">
    * Unexpected blocking behavior
    * Rule targeting issues
    * Project scope problems
  </Accordion>

  <Accordion title="Resolution Steps" icon="wrench">
    * Check rule configurations
    * Verify CWE targeting
    * Confirm project settings
    * Contact support if needed
  </Accordion>
</AccordionGroup>
