Github Copilot · Free Practice Question Medium

Question 20

You are leading a development team on a financial software project with sensitive information (encryption keys, financial algorithms, user data) in the codebase. You want to use GitHub Copilot but need to prevent it from accessing certain files. Which approach is best for implementing content exclusions with GitHub Copilot?

  • A

    Use code comments to tell Copilot to exclude specific sections of code from its suggestions.

  • B

    Disable GitHub Copilot only for specific files or directories that contain sensitive information.

  • C

    Obfuscate sensitive data within the code to ensure Copilot doesn't understand it.

  • D

    Disable GitHub Copilot for the entire project to ensure all sensitive files are excluded.

Reveal correct answer

Correct answer: B

A.

Copilot does not currently support directives within comments that allow developers to mark sections of code to be excluded. All code, including comments, is processed unless the file itself is disabled in the Copilot settings.

B.

Disabling GitHub Copilot for specific files or directories ensures that sensitive data, such as encryption keys and proprietary algorithms, is not processed by Copilot while still allowing the tool to be used in other parts of the project. This approach gives you control over which parts of the project are exposed to Copilot’s suggestions and helps maintain privacy.

C.

Obfuscating sensitive data is not a secure or scalable method for excluding content. Copilot could still process the obfuscated data and might generate suggestions based on patterns found in it. It’s better to disable Copilot for specific files rather than rely on obfuscation.

D.

Disabling Copilot for the entire project may be too broad, as it prevents the team from using Copilot’s capabilities for less sensitive areas of the codebase. This could limit productivity and is unnecessary if only certain files need to be excluded from processing.

Discussion

Think the marked answer is wrong, or have a better explanation? Share it below — comments appear after review.

You must be logged in to post a comment.

Preparing For

Your Certification?

255+ certifications
Detailed explanations
Free PDF samples

Has All The Questions You Need