Skip to content

GitHub Advanced Security Practice Questions

Prepare for GH-500 with more than an answer.

232 questions in the full set20 sample questionsUpdated Jan 25, 2026
Exam fee
$99 USD
Level
Intermediate
Valid for
2 years
Domains covered on the exam 5
  1. Describe the GHAS security features and functionality15%
  2. Configure and use secret scanning15%
  3. Configure and use Dependabot and Dependency Review35%
  4. Configure and use Code Scanning with CodeQL25%
  5. Describe GitHub Advanced Security best practices, results, and how to take corrective measures10%
  1. 1

    Which statements accurately describe how GitHub Advanced Security (GHAS) features differ between public repositories on GitHub.com and private repositories with a GHAS license? (Select TWO)

    Show answer details

    Correct answer: A, B

    GitHub provides secret scanning for free on all public repositories to protect the open-source ecosystem. For private repositories, it is part of the paid GitHub Advanced Security license and must be explicitly enabled at the organization or repository level.

    Dependabot alerts, which notify you of known vulnerabilities in your dependencies, are available for all repositories, public and private, even on the free plan. GHAS is not required for this core security feature.

  2. 2

    A developer dismisses a code scanning alert, marking it as a 'false positive'. What is the long-term implication of this action for future scans?

    Show answer details

    Correct answer: B

    When an alert is dismissed, GitHub remembers the code pattern and location. The alert will remain dismissed in subsequent scans of the same branch as long as the code that triggered it remains unchanged. However, if the code is significantly modified, CodeQL may reopen the alert because the context has changed and the original dismissal reason may no longer be valid.

  3. 3

    A company wants to detect its own internal API key format, which follows the pattern CORP-PROD-[32-character-alphanumeric-string]. How can they configure secret scanning to find these specific keys?

    Show answer details

    Correct answer: B

    GitHub secret scanning can be extended with custom patterns to detect proprietary or internal secret formats. Administrators can define these patterns at the organization or repository level by providing a name and a regular expression that matches the secret format, such as CORP-PROD-[A-Za-z0-9]{32}.

  4. 4

    A Dependabot security update pull request has been opened, but the automated tests in the CI pipeline are failing. The developer needs to make changes to the code to fix the incompatibility caused by the dependency update. What is the standard procedure for applying these fixes?

    Show answer details

    Correct answer: C

    Dependabot PRs are created from a branch in the repository, just like any other PR. If the update causes failures, the correct procedure is to fetch and check out that branch (e.g., dependabot/npm_and_yarn/my-app/lodash-4.17.21), make the required compatibility fixes, and push the changes back to the same branch. This updates the pull request, triggers the CI checks again, and keeps the entire history of the remediation in a single PR.

  5. 5

    An organization wants to enforce a policy that all pull requests targeting the main branch MUST pass both the CodeQL analysis and the Dependency Review checks before they can be merged. Administrators must not be able to override this rule. What is the most robust way to enforce this policy?

    flowchart TD A[PR to main] --> B{Ruleset Applies?}; B -->|Yes| C{Required Checks}; C --> D[CodeQL Status Check]; C --> E[Dependency Review Check]; D --> F{All Pass?}; E --> F; F -->|Yes| G([Merge Allowed]); F -->|No| H([Merge Blocked]); B -->|No| I[No Enforcement];

    Show answer details

    Correct answer: C

    While branch protection rules can require status checks, they have an option to 'Allow administrators to override'. Repository rulesets are a more powerful and flexible evolution of this. They can be targeted to multiple branches or tags, and critically, they can be configured so that no one, including administrators, can bypass the required checks, making them the most robust method for policy enforcement.

  6. 6

    A financial services company is implementing GitHub Advanced Security for their new Go-based microservices application. The security team requires that any new dependency added to a pull request must be checked against a list of pre-approved licenses. If a non-approved license is detected, the pull request must be blocked from merging. Which GitHub feature and configuration should be used to enforce this policy?

    Show answer details

    Correct answer: B

    The Dependency Review feature, implemented as a GitHub Actions workflow (dependency-review-action), is specifically designed for this purpose. It runs on pull requests and can be configured with allow-licenses or deny-licenses to check for license compliance. By making this workflow a required status check, it can effectively block pull requests that introduce dependencies with non-compliant licenses. The dependabot.yml file is for configuring Dependabot updates, not for license checks on pull requests. Repository rulesets can enforce that the workflow runs, but the license logic is within the action itself. Secret scanning does not handle dependency licenses.

  7. 7

    A DevOps team manages a large monorepo containing multiple microservices, each in its own directory with a different package ecosystem (e.g., /app-a uses npm, /app-b uses Maven, /app-c uses pip). The team wants to enable Dependabot security updates but is concerned about being overwhelmed by pull requests. They want to group all npm updates and all Maven updates into separate, single weekly pull requests. How should the dependabot.yml file be configured to achieve this? (Select TWO)

    Show answer details

    Correct answer: B, C

    For a monorepo with multiple ecosystems, you must define a separate block for each package-ecosystem and specify its directory. This tells Dependabot where to find the manifest files for each service.

    The groups key is the correct mechanism for bundling multiple dependency updates into a single pull request, reducing PR noise. You would define a group for npm and another for Maven within their respective ecosystem blocks.

  8. 8

    A security engineer is troubleshooting a CodeQL workflow for a compiled language (Java) that runs successfully on pushes to the main branch but fails consistently on pull requests from feature branches. The error occurs during the Initialize CodeQL step. The workflow is triggered by on: [push, pull_request]. What is the most probable reason for this discrepancy?

    Show answer details

    Correct answer: B

    Workflows triggered by pull_request from forks run in a restricted context with a read-only token and no access to secrets. This can cause the Initialize CodeQL step to fail if it needs to access certain resources or if the analysis is complex. To analyze code from forks securely, the workflow should be changed to use the pull_request_target event, which runs in the context of the base repository but checks out the code from the pull request's HEAD commit. This is a common and critical distinction for securing workflows that run on code from external contributors.

  9. 9

    True or False: When secret scanning push protection is enabled for a repository, a user with admin permissions can push a commit containing a detected secret without bypassing the protection.

    Show answer details

    Correct answer: B

    Push protection applies to all users, regardless of their permissions. A user, including an administrator, must explicitly bypass the block by providing a reason. The protection is not automatically disabled for administrators; they are subject to the same initial block as any other contributor.

  10. 10

    An organization wants to enforce a policy where all pull requests targeting the main branch must have a successful CodeQL analysis and a successful Dependency Review check before they can be merged. No administrator should be able to override this requirement. What is the most effective way to implement this strict enforcement?

    Show answer details

    Correct answer: B

    While branch protection rules can require status checks, administrators can typically override them. Repository rulesets provide a more powerful and flexible way to enforce policies. By creating a ruleset that targets the main branch and requires the specific status checks, you can enforce the policy across the repository or organization. Crucially, rulesets have an explicit option to prevent even administrators from bypassing the rules, which meets the stated requirement.

Create an account to continue.