|
| 1 | +--- |
| 2 | +title: Disabling autofix for code scanning |
| 3 | +shortTitle: Disable autofix |
| 4 | +intro: You can choose to disallow {% data variables.product.prodname_code_scanning %} autofix for an enterprise or disable autofix at the organization and repository level. |
| 5 | +product: '{% data reusables.rai.code-scanning.gated-feature-autofix %}' |
| 6 | +versions: |
| 7 | + feature: code-scanning-autofix |
| 8 | +type: how_to |
| 9 | +topics: |
| 10 | + - Advanced Security |
| 11 | + - Code scanning |
| 12 | + - CodeQL |
| 13 | + - AI |
| 14 | +--- |
| 15 | + |
| 16 | +{% data reusables.rai.code-scanning.beta-autofix %} |
| 17 | + |
| 18 | +## About disabling autofix for {% data variables.product.prodname_code_scanning %} |
| 19 | + |
| 20 | +{% data variables.product.prodname_code_scanning_caps %} autofix is a {% data variables.product.prodname_copilot %}-powered expansion of {% data variables.product.prodname_code_scanning %} that provides users with targeted recommendations to help them fix {% data variables.product.prodname_code_scanning %} alerts in pull requests so they can avoid introducing new security vulnerabilities. To learn more about autofix for code scanning, see "[AUTOTITLE](/code-security/code-scanning/managing-code-scanning-alerts/about-autofix-for-codeql-code-scanning)." |
| 21 | + |
| 22 | +{% data variables.product.prodname_code_scanning_caps %} autofix is allowed by default in an enterprise and enabled for every repository that uses {% data variables.product.prodname_codeql %}, regardless of whether it uses default or advanced setup for {% data variables.product.prodname_code_scanning %}. Administrators at the enterprise, organization and repository levels can choose to opt-out and disable autofix. |
| 23 | + |
| 24 | +Note that disabling autofix at any level will close all open autofix comments from all open pull requests at the level that was disabled. If autofix is disabled and then subsequently enabled, autofix won't automatically suggest any fixes for pull requests that are already open. The suggestions will only be generated for pull requests that are opened after autofix is enabled, or after re-running {% data variables.product.prodname_codeql %} analysis on existing pull requests. |
| 25 | + |
| 26 | +## Blocking use of autofix for an enterprise |
| 27 | + |
| 28 | +Enterprise administrators can disallow autofix for their enterprise. If you disallow autofix for an enterprise, autofix cannot be enabled for any organizations or repositories within the enterprise. |
| 29 | + |
| 30 | +Note that allowing autofix for an enterprise does not enforce enablement of autofix, but means that organization and repository administrators will have the option to enable or disable autofix. |
| 31 | + |
| 32 | +Disallowing autofix at the enterprise level will remove all open autofix comments from open pull requests across all repositories of all organizations within the enterprise. |
| 33 | + |
| 34 | +{% data reusables.enterprise-accounts.access-enterprise %} |
| 35 | +{% data reusables.enterprise-accounts.policies-tab %} |
| 36 | +{% data reusables.enterprise-accounts.code-security-and-analysis-policies %} |
| 37 | +1. Under "Autofix for {% data variables.product.prodname_codeql %} {% data variables.product.prodname_code_scanning %}", use the dropdown menu to choose "Not allowed." |
| 38 | + |
| 39 | +## Disabling autofix for an organization |
| 40 | + |
| 41 | +If autofix is allowed at the enterprise level, organization administrators have the option to disable autofix for an organization. If you disable autofix for an organization, autofix cannot be enabled for any repositories within the organization. |
| 42 | + |
| 43 | +Note that disabling autofix at the organization level will remove all open autofix comments from open pull requests across all repositories in the organization. |
| 44 | + |
| 45 | +{% data reusables.profile.access_org %} |
| 46 | +{% data reusables.profile.org_settings %} |
| 47 | +{% data reusables.organizations.security-and-analysis %} |
| 48 | +1. Under the "{% data variables.product.prodname_code_scanning_caps %}" section, deselect **Autofix for {% data variables.product.prodname_codeql %}**. |
| 49 | + |
| 50 | +## Disabling autofix for a repository |
| 51 | + |
| 52 | +If autofix is allowed at the enterprise level and enabled at the organization level, repository administrators have the option to disable autofix for a repository. Disabling autofix at the repository level will remove all open autofix comments from all open pull requests across the repository. |
| 53 | + |
| 54 | +{% data reusables.repositories.navigate-to-repo %} |
| 55 | +{% data reusables.repositories.sidebar-settings %} |
| 56 | +{% data reusables.user-settings.security-analysis %} |
| 57 | +1. In the "{% data variables.product.prodname_code_scanning_caps %}" section, deselect **Autofix for {% data variables.product.prodname_codeql %}**. |
0 commit comments