GH-500 Practice Test Questions

75 Questions


Configure and Use Dependency Management

Which key is required in the update settings of the Dependabot configuration file?


A. rebase-strategy


B. commit-message


C. assignees


D. package-ecosystem





D.
  package-ecosystem

Explanation:
The Dependabot configuration file (dependabot.yml) is used to automate dependency updates. Its structure is defined by specific, required keys that tell Dependabot what to update and how. Among the options, one key is fundamental and must be present in every updates entry for Dependabot to function, as it specifies the source of the dependencies.

Correct Option:

D. package-ecosystem:
This is the required key that identifies the package manager (e.g., npm, bundler, github-actions) Dependabot should monitor for a given directory. Without specifying the package-ecosystem, Dependabot cannot know which dependencies to check for updates.

Incorrect Options:

A. rebase-strategy:
This is an optional key that controls whether Dependabot should automatically rebase pull requests. It is not required for the basic configuration.

B. commit-message:
This is an optional key for customizing the commit message Dependabot uses. The configuration file has defaults and does not require this.

C. assignees:
This is an optional key used to specify GitHub users who should be assigned to the pull requests Dependabot creates. It is not a mandatory setting.

Reference:
GitHub documentation, "Configuration options for the dependabot.yml file," explicitly lists package-ecosystem as a required key under the updates section, while the other options are listed under "configuration-options" as optional.

The autobuild step in the CodeQL workflow has failed. What should you do?


A. Remove specific build steps


B. Compile the source code.


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


D. Use CodeQL, which implicitly detects the supported languages in your code base.





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

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."

When does Dependabot alert you of a vulnerability in your software development process?


A. When a pull request adding a vulnerable dependency is opened


B. As soon as a vulnerable dependency is detected


C. As soon as a pull request is opened by a contributor


D. When Dependabot opens a pull request to update a vulnerable dependency





B.
  As soon as a vulnerable dependency is detected

Explanation:
Dependabot's primary security function is to automatically scan your repository's dependency manifest files (like package.json or Gemfile.lock) for known vulnerabilities listed in advisory databases. Its alerting mechanism is designed for immediate notification to enable swift remediation, not to wait for a specific development event like a pull request.

Correct Option:

B. As soon as a vulnerable dependency is detected.
Dependabot continuously monitors your dependencies against security advisories (e.g., GitHub Security Advisories, NVD). When a new vulnerability is published and matches a dependency in your repository, Dependabot generates an alert immediately in the repository's "Security" tab and can notify configured maintainers.

Incorrect Options:

A. When a pull request adding a vulnerable dependency is opened:
While Dependabot may block such pull requests if configured, the security alert is generated by the presence of the vulnerable dependency in the codebase, not by the act of proposing it.

C. As soon as a pull request is opened by a contributor:
This is unrelated to Dependabot's vulnerability alerting. Dependabot alerts are triggered by dependency scans, not by general pull request activity.

D. When Dependabot opens a pull request to update a vulnerable dependency:
This describes a remediation action, not the initial alert. Dependabot first creates an alert (option B), and then, if configured for auto-fixes, it may subsequently open a pull request to resolve it.

Reference:
GitHub documentation, "About Dependabot alerts," states: "Dependabot alerts are triggered whenever a new security advisory is published for a dependency you use... You can see all of the alerts for dependencies in your repository in your repository's Security tab."

Where can you use CodeQL analysis for code scanning? (Each answer presents part of the solution. Choose two.)


A. In a third-party Git repository


B. In a workflow


C. In an external continuous integration (CI) system


D. In the Files changed tab of the pull request





B.
  In a workflow

C.
  In an external continuous integration (CI) system

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.

Assuming that notification and alert recipients are not customized, what does GitHub do when it identifies a vulnerable dependency in a repository where Dependabot alerts are enabled? (Each answer presents part of the solution. Choose two.)


A. It generates a Dependabot alert and displays it on the Security tab for the repository.


B. It notifies the repository administrators about the new alert.


C. It generates Dependabot alerts by default for all private repositories.


D. It consults with a security service and conducts a thorough vulnerability review





A.
  It generates a Dependabot alert and displays it on the Security tab for the repository.

B.
  It notifies the repository administrators about the new alert.

Explanation:
When Dependabot is enabled for a repository, its default, automated behavior upon detecting a vulnerable dependency involves two key actions. It creates a visible record of the issue within the repository's security interface and proactively notifies the individuals responsible for maintaining the repository, ensuring they are aware of the security risk.

Correct Options:

A. It generates a Dependabot alert and displays it on the Security tab for the repository.
This is the core function. The alert, containing details like the vulnerability severity, affected dependency, and patched versions, is created and listed in the repository's Security > Dependabot alerts tab for review and management.

B. It notifies the repository administrators about the new alert.
By default, GitHub sends email notifications to repository administrators and users with write permissions when a new Dependabot alert is detected. This ensures the team is proactively informed without requiring them to manually check the Security tab.

Incorrect Options:

C. It generates Dependabot alerts by default for all private repositories.
Dependabot alerts are a feature of GitHub Advanced Security (GHAS), which requires a license. For private repositories, GHAS (and thus Dependabot alerts) must be explicitly enabled by an organization owner or repository administrator; they are not enabled by default.

D. It consults with a security service and conducts a thorough vulnerability review.
This describes a manual, expert-driven process. Dependabot's process is fully automated. It consults its aggregated advisory databases (like GitHub Security Advisories and the National Vulnerability Database) and automatically generates the alert based on that data without human "consultation" or a custom "review."

Reference:
GitHub documentation, "About Dependabot alerts," states: "When Dependabot detects a vulnerable dependency in your repository, we generate a Dependabot alert and display it on the Security tab for your repository." It also notes under "Notification settings": "By default, you will receive Dependabot alerts... via email."

Which of the following features helps to prioritize secret scanning alerts that present an immediate risk?


A. Non-provider patterns


B. Push protection


C. Custom pattern dry runs


D. Secret validation





D.
  Secret validation

Explanation:
Prioritizing secret scanning alerts is crucial for efficient security response. A feature that can actively check if a detected secret is currently valid and active (e.g., by making an authenticated API call to the relevant service provider) helps distinguish between live, high-risk secrets and revoked, expired, or fake ones. This directly identifies alerts presenting an immediate risk.

Correct Option:

D. Secret validation:
This is a feature for supported secret types (like GitHub tokens or Slack webhooks) where GitHub can automatically make a secure, outbound call to the issuing service provider to check if the detected secret is currently valid. A validated, active secret is a confirmed immediate risk and should be prioritized for remediation.

Incorrect Options:

A. Non-provider patterns:
These are custom regex patterns used to detect secrets for services not natively supported by GitHub's secret scanning partners. While they increase detection coverage, they do not inherently help with prioritization, as these custom patterns cannot be automatically validated.

B. Push protection:
This is a preventive feature that blocks commits containing detected secrets from being pushed to the repository. It stops new secrets from being introduced but does not itself prioritize existing alerts in the Security tab.

C. Custom pattern dry runs:
This is a testing feature that allows you to trial custom regex patterns against your repository's history to see what they would detect before enabling them live. It is part of setup and configuration, not alert prioritization.

Reference:
GitHub documentation, "About secret scanning," specifically discusses the "Validation" feature: "For some partners, GitHub can check that the secret found is currently valid on the partner's service... Validating the secret helps you prioritize which alerts to investigate first."

Which CodeQL query suite provides queries of lower severity than the default query suite?


A. github/codeql-go/ql/src@main


B. github/codeql/cpp/ql/src@main


C. security-extended





C.
  security-extended

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."

Which Dependabot configuration fields are required? (Each answer presents part of the solution. Choose three.)


A. directory


B. package-ecosystem


C. milestone


D. schedule.interval


E. allow





A.
  directory

B.
  package-ecosystem

D.
  schedule.interval

Explanation:
The dependabot.yml configuration file must specify essential information for Dependabot to operate. This includes what to update (the package manager), where to look for it (the directory containing the manifest file), and when to check (the frequency). These three pieces of information form the minimal required configuration for each entry under the updates key.

Correct Options:

A. directory:
This is a required field that specifies the location of the package manifest file (e.g., / for the root, /backend for a subdirectory). Dependabot needs to know where to find the dependencies to update.

B. package-ecosystem:
This is a required field that identifies the package manager (e.g., npm, bundler, github-actions) for the update entry. It tells Dependabot which ecosystem's versioning and manifest files to inspect.

D. schedule.interval:
This is a required field that defines how often Dependabot checks for updates (e.g., daily, weekly, monthly). The schedule object must contain an interval to define the update frequency.

Incorrect Options:

C. milestone:
This is an optional field used to associate Dependabot's pull requests with a specific GitHub milestone. It is not required for the basic function of checking and updating dependencies.

E. allow:
This is an optional field used to specify which dependencies are allowed to be updated, typically used to define an allowlist or to permit major version updates. The configuration works without this field, in which case Dependabot uses its default behavior.

Reference:
GitHub documentation, "Configuration options for the dependabot.yml file," lists the required properties for each entry in the updates array as: package-ecosystem, directory, and schedule.interval. All other properties, like milestone and allow, are listed in the optional "configuration-options" section.

You have enabled security updates for a repository. When does GitHub mark a Dependabot alert as resolved for that repository?


A. When Dependabot creates a pull request to update dependencies


B. When you dismiss the Dependabot alert


C. When the pull request checks are successful


D. When you merge a pull request that contains a security update





D.
  When you merge a pull request that contains a security update

Explanation:
Dependabot alerts are tied to the presence of a specific vulnerable dependency version in a repository's default branch. The alert's status changes based on actions that remove that vulnerable version from the codebase. Simply creating a fix or dismissing the alert manually does not constitute an automatic, permanent resolution according to GitHub's automated tracking system.

Correct Option:

D. When you merge a pull request that contains a security update.
This is the primary automated resolution. When a pull request (whether from Dependabot or a developer) that updates the vulnerable dependency to a secure version is merged into the default branch, GitHub detects the fix and automatically marks the corresponding Dependabot alert as resolved.

Incorrect Options:

A. When Dependabot creates a pull request to update dependencies:
The alert remains open because the vulnerable code is still present in the default branch. The PR is a proposed fix, not an applied one.

B. When you dismiss the Dependabot alert:
Dismissing an alert manually changes its state to dismissed, not resolved. This is a manual administrative action, often used for false positives or accepted risks, and does not mean the vulnerability is fixed in the code.

C. When the pull request checks are successful:
Successful checks indicate the PR is ready to merge and passes tests, but the vulnerable dependency remains in the default branch until the PR is actually merged. The alert status is unaffected by CI/CD check results.

Reference:
GitHub documentation, "Viewing and updating Dependabot alerts," states: "Dependabot automatically closes Dependabot alerts when you... merge a pull request that contains a security update generated by Dependabot to your default branch." It distinguishes this from manually dismissing alerts.

Which of the following tasks can be performed by a security team as a proactive measure to help address secret scanning alerts? (Each answer presents a complete solution. Choose two.)


A. Dismiss alerts that are older than 90 days.


B. Configure a webhook to monitor for secret scanning alert events.


C. Enable system for cross-domain identity management (SCIM) provisioning for the enterprise.


D. Document alternatives to storing secrets in the source code.





B.
  Configure a webhook to monitor for secret scanning alert events.

D.
  Document alternatives to storing secrets in the source code.

Explanation:
Proactive measures taken by a security team aim to either improve the process of handling alerts or to prevent the secrets from being introduced in the first place. These measures focus on automation, awareness, and establishing better security practices before incidents occur.

Correct Options:

B. Configure a webhook to monitor for secret scanning alert events.
This is a proactive integration and automation measure. By setting up a webhook, the security team can receive real-time alerts in their internal security tools (like Slack channels, SIEMs, or ticketing systems), enabling faster triage and response workflows.

D. Document alternatives to storing secrets in the source code.
This is a proactive preventive and educational measure. By creating and sharing documentation on secure practices—such as using GitHub Secrets, environment variables, or dedicated secret managers—the security team helps developers avoid introducing secrets into the repository, thereby reducing future alerts.

Incorrect Options:

A. Dismiss alerts that are older than 90 days.
This is a reactive cleanup or maintenance task, not a proactive measure. It addresses a backlog but does nothing to improve the process or prevent new secrets. It could even be dangerous if done indiscriminately without verifying if old secrets are still valid.

C. Enable system for cross-domain identity management (SCIM) provisioning for the enterprise.
SCIM is related to user identity and access management (provisioning and deprovisioning accounts). It is a general IT security control but is not a specific, direct action that helps address secret scanning alerts.

Reference:
While the specific pairing is not in a single document, the proactive nature is supported by GitHub's best practices. Documentation for "Setting up notifications for secret scanning alerts" covers webhook integrations. The "About secret scanning" page and security best practices consistently recommend using secret managers as an alternative to hardcoding, which aligns with creating documentation for developers.

What role is required to change a repository's code scanning severity threshold that fails a pull request status check?


A. Maintain


B. Write


C. Triage


D. Admin





D.
  Admin

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.

What is a security policy?


A. An automatic detection of security vulnerabilities and coding errors in new or modified code


B. A security alert issued to a community in response to a vulnerability


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


D. An alert about dependencies that are known to contain security vulnerabilities





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

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.


Page 1 out of 7 Pages