Skip to main content

Managing custom patterns

You can view, edit, and remove custom patterns, as well as enable push protection for custom patterns.

¿Quién puede utilizar esta característica?

Propietarios de repositorios, propietarios de organizaciones, administradores de seguridad y usuarios con el rol de administrador

Custom patterns are user-defined patterns that you can use to identify secrets that are not detected by the default patterns supported by secret scanning. For more information, see Defining custom patterns for secret scanning.

At the enterprise level, only the creator of a custom pattern can edit the pattern, and use it in a dry run. There are no similar restrictions for editing custom patterns at repository and organization level.

Editing a custom pattern

When you save a change to a custom pattern, this closes all the alertas de examen de secretos that were created using the previous version of the pattern.

  1. Navegar a donde se creó el patrón personalizado. Un patrón personalizado se puede crear en un repositorio, organización o cuenta empresarial.

  2. Under "Custom patterns", to the right of the custom pattern you want to edit, click .

  3. When you're ready to test your edited custom pattern, to identify matches without creating alerts, click Save and dry run.

  4. When you have reviewed and tested your changes, click Publish changes.

  5. Opcionalmente, para habilitar la protección de inserción para el patrón personalizado, haz clic en Habilitar.

    Nota:

    • La protección de inserción para patrones personalizados solo se aplicará a los repositorios que tengan secret scanning como protección de inserción habilitada. Para más información sobre cómo habilitar la protección de envío de cambios, consulta Acerca de la protección de inserción.
    • La habilitación de la protección de inserción para patrones personalizados que se encuentran habitualmente puede ser perjudicial para los colaboradores.

    Captura de pantalla de la página de patrones personalizados con el botón para habilitar la protección de inserción resaltado.

  6. Optionally, to disable push protection for your custom pattern, click Disable.

    Screenshot of the custom pattern page with the button to disable push protection highlighted with a dark orange outline.

Removing a custom pattern

When you remove a custom pattern, GitHub gives you the option to close the alertas de examen de secretos relating to the pattern, or keep these alerts.

  1. Navegar a donde se creó el patrón personalizado. Un patrón personalizado se puede crear en un repositorio, organización o cuenta empresarial.
  2. To the right of the custom pattern you want to remove, click .
  3. Review the confirmation, and select a method for dealing with any open alerts relating to the custom pattern.
  4. Click Yes, delete this pattern.

If you choose to close the alerts when removing a custom pattern, you need to be aware that the deletion process happens asynchronously in the background. For custom patterns that have generated a high volume of alerts (thousands or more), the deletion process may take several minutes to hours to complete. You can continue working while the process completes.

Enabling push protection for a custom pattern

You can enable secret scanning as a push protection for custom patterns stored at the enterprise, organization, or repository level.

Enabling push protection for a custom pattern stored in an enterprise

Nota:

  • Para habilitar la protección de inserción para patrones personalizados, secret scanning porque la protección de inserción debe habilitarse en el nivel empresarial. Para más información, consulta Acerca de la protección de inserción.
  • La habilitación de la protección de inserción para patrones personalizados que se encuentran habitualmente puede ser perjudicial para los colaboradores.

Before enabling push protection for a custom pattern at enterprise level, you must also test your custom patterns using dry runs. Solo puedes realizar un simulacro en repositorios a los que tengas acceso de administración. Si un propietario de empresa quiere acceso para realizar simulacros en cualquier repositorio de una organización, se le debe asignar el rol de propietario de la organización. Para más información, consulta Administración del rol en una organización que pertenece a la empresa.

  1. En la parte superior de la página, haz clic en Policies.

  2. En "Directivas", haz clic en Advanced Security.

  3. Under "Advanced Security", click Security features.

  4. En "Secret scanning", en "Patrones personalizados", haz clic en para seleccionar el patrón que te interese.

    Nota:

    At the enterprise level, you can only edit and enable push protection for custom patterns that you created.

  5. To enable push protection for your custom pattern, scroll down to "Push Protection", and click Enable.

    Nota:

    La opción para habilitar la protección de inserción solo es visible para los patrones publicados.

    Screenshot of the custom pattern page with the button to enable push protection highlighted with a dark orange outline.

Enabling secret scanning as a push protection in an organization for a custom pattern

Before enabling push protection for a custom pattern at organization level, you must ensure that you enable secret scanning for the repositories that you want to scan in your organization. To enable secret scanning on all repositories in your organization, see Administrar la configuración de seguridad y análisis de su organización.

  1. En la esquina superior derecha de GitHub, haz clic en la foto del perfil y luego en Your organizations.

  2. Junto a la organización, haga clic en Settings.

  3. In the "Security" section of the sidebar, select the Advanced Security dropdown menu, then click Global settings.

  4. Under "Custom patterns", click for the pattern of interest.

  5. To enable push protection for your custom pattern, scroll down to "Push Protection", and click Enable.

    Nota:

    • La opción para habilitar la protección de inserción solo es visible para los patrones publicados.
    • La protección de inserción para patrones personalizados solo se aplicará a los repositorios de tu organización que tengan secret scanning como protección de inserción habilitada. Para más información, consulta Acerca de la protección de inserción.
    • La habilitación de la protección de inserción para patrones personalizados que se encuentran habitualmente puede ser perjudicial para los colaboradores.

    Screenshot of the "Push protection" section of the custom pattern page. A button, labeled "Enable", is outlined in dark orange.

Enabling secret scanning as a push protection in a repository for a custom pattern

Before enabling push protection for a custom pattern at repository level, you must define the custom pattern for the repository, and test it in the repository. For more information, see Defining custom patterns for secret scanning.

  1. En GitHub, navegue hasta la página principal del repositorio.

  2. Debajo del nombre del repositorio, haz clic en Settings. Si no puedes ver la pestaña "Configuración", selecciona el menú desplegable y, a continuación, haz clic en Configuración.

    Captura de pantalla de un encabezado de repositorio en el que se muestran las pestañas. La pestaña "Configuración" está resaltada con un contorno naranja oscuro.

  3. En la sección "Security" de la barra lateral, haz clic en Advanced Security.

  4. Under "Secret Protection", under "Custom patterns", click for the pattern of interest.

  5. To enable push protection for your custom pattern, scroll down to "Push Protection", and click Enable.

    Nota:

    La opción para habilitar la protección de inserción solo es visible para los patrones publicados.

    Screenshot of the "Push protection" section of the custom pattern page. A button, labeled "Enable", is outlined in dark orange.