Skip to main content

Responsible generation of regular expressions with Copilot secret scanning

Learn about the capabilities and limitations of the 정규식 생성기 in helping you to define custom patterns to extend the capabilities of secret scanning.

누가 이 기능을 사용할 수 있나요?

Copilot 비밀 검사은 다음 리포지토리에 사용할 수 있습니다.

  • GitHub Advanced Security를 사용하도록 설정된 GitHub Enterprise Cloud를 사용하는 조직의 퍼블릭, 프라이빗, 내부 리포지토리

About generating regular expressions with Copilot 비밀 검사

Secret scanning scans repositories for a predefined set of secrets from our partner program, as well as custom patterns that are user-defined. Custom patterns are formatted as regular expressions.

Note

Copilot 비밀 검사의 정규식 생성기을(를) 사용하는 데에는 GitHub Copilot에 대한 구독이 필요하지 않습니다. GitHub Advanced Security에 대한 라이선스가 있는 GitHub Enterprise Cloud 엔터프라이즈의 프라이빗 리포지토리에서 Copilot 비밀 검사 기능을 사용할 수 있습니다.

Regular expressions can be challenging for people to write. Copilot 비밀 검사's 정규식 생성기 makes it possible for you to define your custom patterns without knowledge of regular expressions. Within the existing custom pattern page, you can launch a generative AI experience where you input a text description of what pattern you would like to detect, include optional example strings that should be detected, and get matching regular expressions in return.

Input processing

Users input a text description of what they would like to detect, and optional example strings that should be detected.

Response generation and output formatting

Copilot 비밀 검사's 정규식 생성기 uses GPT-3.5-Turbo and the GitHub Copilot API to generate regular expressions that match your input.

The model returns up to three regular expressions for you to review. You can click on the regular expression to get an AI-generated plain language description of the regular expression.

Some results may be quite similar, and some results may not find every instance of the secret that the pattern is intended to detect. It is also possible that the regular expression generator may produce results which are invalid or inappropriate.

When you click Use result on a regular expression, the expression and any examples inputted will be copied over to the main custom pattern form. There, you can perform a dry run of the pattern to see how it performs across your repository or organization. For more information on how to define a custom pattern for your repository or organization, see "비밀 검사를 위한 사용자 지정 패턴 정의."

Improving performance when generating regular expressions with AI

To enhance performance and address some of the limitations of Copilot 비밀 검사's 정규식 생성기, there are various measures that you can adopt. For more information on the limitations of the 정규식 생성기, see "Limitations of generating regular expressions with AI."

Use Copilot 비밀 검사's 정규식 생성기 as a tool, not a replacement

While the 정규식 생성기 is a powerful tool to create custom patterns without you having to write regular expressions yourself, it is important to use it as a tool rather than a replacement for manual input. You should carefully validate the performance of the results by performing a dry run across your organization or repository. It's a good idea to run the pattern on a repository (or repositories) that are representative of the repositories in your organization. In some cases, it may be beneficial to modify a generated regular expression to more fully meet your needs. You remain ultimately responsible for any custom patterns you decide to use.

Limitations of generating regular expressions with AI

Depending on factors such as your input description and examples, you may experience different levels of performance when using Copilot 비밀 검사's 정규식 생성기. You need to be as specific as possible with your description, and provide different types of examples of tokens that match your pattern, to be sure that the regular expression encompasses all the patterns you want secret scanning to search for.

Also, the model used by the 정규식 생성기 has been trained on natural language content written predominantly in English. As a result, you may notice differing performance when providing the generator with natural language input prompts in languages other than English.

Note that Copilot 비밀 검사's 정규식 생성기 is only suitable for creating regular expressions to detect structured patterns.

Next steps

Further reading