Microsoft certification · Exam GH-500

GH-500 Mock Exam Page 2

GitHub Advanced Security Exam

Free GH-500 mock exam questions 11–20, each with the answer and an explanation.

20 questions · 30 minutes · free, no sign-up

Free GH-500 questions

11–20 of 24 free
Question 11 Choose 1
The autobuild step in the CodeQL workflow has failed. What should you do?
Show answerHide answer

Correct answer: C Remove the autobuild step from your code scanning workflow and add specific build steps.

Explanation

Explanation:
The CodeQL analysis workflow's autobuild step automatically attempts to compile your code for languages like C/C++, C#, and Java. If it fails, it means the automatic process could not determine the correct build commands. The proper resolution is to replace the generic autobuild with explicit, manual build steps that you know will successfully compile your codebase.

Correct Option:

C. Remove the autobuild step from your code scanning workflow and add specific build steps.
This is the direct and correct solution. By removing the failing autobuild action and replacing it with your own run: steps that execute the necessary build commands (e.g., make, msbuild, dotnet build), you give CodeQL the compiled code it needs to analyze.

Incorrect Options:

A. Remove specific build steps:
This is illogical, as the failure is with the generic autobuild. If there were already specific build steps, the autobuild likely wouldn't be needed or used.

B. Compile the source code.
While compiling is necessary, this option is too vague and is not an actionable step within the GitHub Actions workflow. It describes the goal but not the method to fix the failing workflow step.

D. Use CodeQL, which implicitly detects the supported languages in your code base.
Language detection is a separate, initial step in the CodeQL workflow and is not the cause of an autobuild failure. The failure occurs after languages are detected, during the compilation phase.

Reference:
GitHub documentation on troubleshooting CodeQL, specifically "Autobuild failed" scenarios, recommends: "If CodeQL fails to build your code... you may need to replace the autobuild step with custom build steps in your workflow."
Question 12 Choose 2
Where can you use CodeQL analysis for code scanning? (Each answer presents part of the solution. Choose two.)
Show answerHide answer

Correct answer: B, C In a workflowIn an external continuous integration (CI) system

Explanation

Explanation:
CodeQL analysis for GitHub code scanning can be executed in two primary environments. The native and most common method is within a GitHub Actions workflow directly on GitHub. Additionally, CodeQL analysis can be integrated into external, third-party CI/CD systems, with results then uploaded to GitHub for display and management within the repository's security features.

Correct Options:

B. In a workflow: This is the standard, integrated method.
You add the github/codeql-action to a GitHub Actions workflow file (.github/workflows/codeql.yml). This workflow runs the full CodeQL analysis pipeline—from building the code to querying it and uploading results to the repository's Security tab.

C. In an external continuous integration (CI) system:
CodeQL CLI can be run in external CI systems like Jenkins, Azure DevOps, or CircleCI. You manually run the codeql database create and codeql database analyze commands in your external pipeline and then use the github/codeql-action/upload-sarif action or the REST API to upload the SARIF results to GitHub.

Incorrect Options:

A. In a third-party Git repository:
CodeQL analysis is a feature of GitHub Advanced Security, which is only available on GitHub.com and GitHub Enterprise Server. It cannot analyze code hosted in a third-party Git repository (e.g., GitLab, Bitbucket) unless that code is also mirrored or pulled into a GitHub repository for analysis.

D. In the Files changed tab of the pull request:
The Files changed tab displays the diff of the code changes. While CodeQL code scanning results (showing alerts introduced by the PR) are displayed in the PR interface (e.g., in the Conversation tab or a dedicated Security section), the analysis itself is not run there. It is executed in a workflow or external CI system, and the results are posted to the PR.

Reference:
GitHub documentation, "About CodeQL code scanning," states you can set it up "using GitHub Actions" or "using the CodeQL CLI in a third-party CI/CD system." It explicitly lists support for systems like Jenkins, Azure Pipelines, and CircleCI.
Question 13 Choose 1
Which CodeQL query suite provides queries of lower severity than the default query suite?
Show answerHide answer

Correct answer: C security-extended

Explanation

Explanation:
CodeQL query suites are predefined groups of queries with different security focuses and severity thresholds. The default suite (security-and-quality) includes high and critical severity security queries plus quality queries. To expand analysis coverage, other suites include additional queries, some of which are intentionally of lower severity or precision to catch more potential issues.

Correct Option:

C. security-extended:
This suite extends the default suite by including additional queries of lower severity and precision. It is designed to find more potential security issues, including those that might be less severe or have a higher false-positive rate, providing a more thorough security audit.

Incorrect Options:

A. github/codeql-go/ql/src@main:
This is not a query suite; it is a path to the entire CodeQL query library for the Go language. Using this path would run all Go queries (including experimental and deprecated ones), not a curated set focused on security severity.

B. github/codeql/cpp/ql/src@main:
Similar to option A, this is a path to the entire C/C++ query library, not a defined query suite. It is too broad and unspecific for the purpose of selecting queries based on severity.

Reference:
GitHub documentation, "CodeQL query suites for code scanning," explicitly lists the purpose of each suite. It states: "The security-extended suite includes queries from the default suite, plus additional queries with lower severity and precision."
Question 14 Choose 3
Which of the following steps should you follow to integrate CodeQL into a third-party continuous integration system? (Each answer presents part of the solution. Choose three.)
Show answerHide answer

Correct answer: B, C, D Analyze codeUpload scan results Install the CLI

Explanation

Explanation:
Integrating CodeQL into a third-party CI system involves using the standalone CodeQL CLI tool. The core process requires installing the CLI, using it to analyze the code by creating a database and running queries, and then uploading the results back to GitHub so they appear as code scanning alerts in the repository's Security tab.

Correct Options:

B. Analyze code:
This is the primary function. Using the CLI, you run codeql database analyze on a previously created CodeQL database. This executes the queries against your code to find potential security issues, generating a SARIF results file.

C. Upload scan results:
After analysis, you must upload the resulting SARIF file to GitHub. This is done using the github/codeql-action/upload-sarif action (even within external CI) or via the Code Scanning REST API to make the results visible in the repository's Security tab.

D. Install the CLI:
This is the foundational first step. You must download and install the CodeQL CLI bundle on your third-party CI runner to have the codeql command available for database creation and analysis.

Incorrect Options:

A. Process alerts:
This is a step performed by GitHub after results are uploaded. The third-party CI system's job ends with uploading the SARIF file. GitHub then processes that file to create, deduplicate, and display the code scanning alerts. The CI system does not process alerts itself.

E. Write queries:
While advanced users can write custom queries, this is not a required step for basic integration. The integration uses the standard, pre-written security queries provided in the CodeQL query packs (codeql/-queries). Writing new queries is an optional, advanced activity.

Reference:
GitHub documentation, "Using CodeQL code scanning with your existing CI system," outlines the three-step process: 1. Install the CodeQL CLI on your runner, 2. Use the CLI to analyze the code, 3. Upload the results to GitHub using the upload action.
Question 15 Choose 1
What role is required to change a repository's code scanning severity threshold that fails a pull request status check?
Show answerHide answer

Correct answer: D Admin

Explanation

Explanation:
Configuring a repository's code scanning analysis to fail a pull request status check is a security gate that affects the team's workflow. Changing this threshold requires permissions to modify high-level repository settings and security policies, as it directly impacts the repository's security posture and mandatory merge requirements.

Correct Option:

D. Admin:
The Admin role on a repository has the necessary permissions to change configuration settings for GitHub Advanced Security features, including the code scanning severity threshold that controls when a pull request check fails. This setting is part of the repository's security and analysis configuration.

Incorrect Options:

A. Maintain:
This role can write to the repository, manage issues and pull requests, and run workflows, but it does not have permission to change repository settings or GitHub Advanced Security configurations.

B. Write:
This role can push code, merge pull requests, and manage issues, but it cannot modify repository-level settings related to security analysis or change the code scanning configuration.

C. Triage:
This role is a more limited, read-focused role with permissions to manage issues and pull requests but cannot write code or change any repository settings.

Reference:
GitHub documentation, "Repository roles for an organization," specifies that the Admin role has permissions to "Manage security and analysis settings," which includes configuring code scanning. The "Managing code scanning alerts for your repository" documentation also notes that configuring the severity for pull request blocking is a security setting.
Question 16 Choose 1
What is a security policy?
Show answerHide answer

Correct answer: C A file in a GitHub repository that provides instructions to users about how to report a security vulnerability

Explanation

Explanation:
In the context of GitHub repositories, a security policy is a specific, user-facing document that establishes a clear and secure communication channel for security researchers and users to report potential vulnerabilities. Its primary purpose is to streamline the reporting process, not to describe automated detection or alerting systems.

Correct Option:

C. A file in a GitHub repository that provides instructions to users about how to report a security vulnerability.
This is the precise definition. It is typically a SECURITY.md file placed in the repository's root, .github, or docs directory. It outlines secure reporting procedures, often including a private disclosure email address or link.

Incorrect Options:

A. An automatic detection of security vulnerabilities and coding errors in new or modified code.
This describes code scanning (e.g., CodeQL) or secret scanning, which are automated analysis tools, not a policy document.

B. A security alert issued to a community in response to a vulnerability.
This describes a GitHub Security Advisory (GHSA), which is a published advisory about a vulnerability, often coordinated with maintainers.

D. An alert about dependencies that are known to contain security vulnerabilities.
This describes a Dependabot alert, which is an automated notification about a vulnerable dependency detected in a repository's manifest files.

Reference:
GitHub documentation, "Adding a security policy to your repository," states: "You can give your project's security policy to give people instructions for responsibly reporting security vulnerabilities in your project." It instructs users to create a SECURITY.md file.
Question 17 Choose 1
After investigating a code scanning alert related to injection, you determine that the input is properly sanitized using custom logic. What should be your next step?
Show answerHide answer

Correct answer: D Dismiss the alert with the reason "false positive."

Question 18 Choose 1
How many alerts are created when two instances of the same secret value are in the same repository?
Show answerHide answer

Correct answer: A 1

Question 19 Choose 1
Which of the following secret scanning features can verify whether a secret is still active?
Show answerHide answer

Correct answer: B Validity checks

Question 20 Choose 1
Secret scanning will scan:
Show answerHide answer

Correct answer: C The GitHub repository.

Full mock exam

Sit the GH-500 exam before exam day

Full-length mocks with the same number of questions and the same time limit as the real GH-500 exam. Every attempt draws a new set of questions from the full bank, so you can keep going until you pass comfortably.

Get full GH-500 mock exam
  • —questions per mock
  • —time limit
  • 75questions in the bank
  • Newmock on every attempt