How can you customize Code Scanning to focus on specific files or paths?

Prepare for the GitHub Advanced Security Certification Test. Practice with multiple choice questions, detailed explanations, and hints. Achieve success on your first attempt!

Multiple Choice

How can you customize Code Scanning to focus on specific files or paths?

Explanation:
Narrowing the analysis scope is the key idea: you can focus Code Scanning on the files or directories you care about. This can be done by applying path filtering in suppression notes, or by tailoring CodeQL queries to only consider specific paths, and by configuring the workflow to run in those targeted areas. Suppression notes can include a path filter so findings outside the chosen folders are hidden, letting you concentrate on the relevant code. Alternatively, adjusting the CodeQL queries to restrict their scope to particular directories or files makes the analysis itself only examine those paths. You can also set the workflow triggers so the Code Scanning step runs only when changes occur in the desired paths. This approach gives precise control over what gets scanned and reported, and there’s no need to edit SARIF manually or rely solely on file-extension filters.

Narrowing the analysis scope is the key idea: you can focus Code Scanning on the files or directories you care about. This can be done by applying path filtering in suppression notes, or by tailoring CodeQL queries to only consider specific paths, and by configuring the workflow to run in those targeted areas. Suppression notes can include a path filter so findings outside the chosen folders are hidden, letting you concentrate on the relevant code. Alternatively, adjusting the CodeQL queries to restrict their scope to particular directories or files makes the analysis itself only examine those paths. You can also set the workflow triggers so the Code Scanning step runs only when changes occur in the desired paths. This approach gives precise control over what gets scanned and reported, and there’s no need to edit SARIF manually or rely solely on file-extension filters.

Subscribe

Get the latest from Passetra

You can unsubscribe at any time. Read our privacy policy