GitHub Advanced Security (GH-500) · Domain 4 · 14% of exam

Configure and use Code Security

Drill 19 practice questions focused entirely on Configure and use Code Security for the GitHub GH-500 exam. Tap an answer for instant feedback and a full explanation — no sign-up, always free.

Verified answer19 questions
Question 1 of 19

A security engineer maintains a repository where two separate CodeQL analysis workflows run against the same branch: one performs a fast, targeted scan on every pull request, and another runs a deeper, extended-query scan on a nightly schedule. Both workflows upload SARIF results to GitHub code scanning. After enabling the nightly workflow, the engineer notices that the nightly results are overwriting the pull request scan results, causing alerts to appear and disappear inconsistently. What is the correct way to ensure both sets of results are tracked independently without overwriting each other?

Reviewed for accuracy · Report an issue
Question 2 of 19

You are configuring the default CodeQL workflow for a repository that receives frequent pull requests to the `main` branch. The security team wants alerts raised as early as possible on incoming changes, but they are also concerned about newly disclosed CodeQL query updates surfacing vulnerabilities in code that hasn't changed in weeks. The repository has a limited GitHub Actions minutes budget, so running a full analysis on every push to every feature branch is undesirable. Which combination of triggers in the CodeQL workflow best satisfies these requirements?

Reviewed for accuracy · Report an issue
Question 3 of 19

A security engineer is triaging CodeQL code scanning alerts in a repository. One alert flags a SQL injection risk, but after review the engineer confirms the flagged input is fully sanitized by an internal wrapper that CodeQL's model does not recognize, so the alert does not represent a real vulnerability. The engineer wants to dismiss the alert in a way that accurately reflects this determination and helps improve future triage reporting. Which dismissal reason should be selected?

Reviewed for accuracy · Report an issue
Question 4 of 19

A developer opens a pull request that introduces a SQL injection vulnerability. CodeQL code scanning flags the alert on the PR and displays a suggested code change generated by CodeQL autofix. The developer wants to apply the fix as efficiently and safely as possible. What is the recommended way to handle the autofix suggestion?

Reviewed for accuracy · Report an issue
Question 5 of 19

A team maintains a large Java service and wants to add CodeQL analysis via GitHub Actions advanced setup. Their build system uses a proprietary Gradle plugin that frequently fails in the default autobuild step, causing the CodeQL database creation to error out before analysis. They want CodeQL to analyze the Java code without executing their build. Which configuration change should they make in the CodeQL workflow?

Reviewed for accuracy · Report an issue
Question 6 of 19

Your security team maintains a shared CodeQL query pack published to GitHub Packages that contains organization-specific security queries. You are using advanced setup and want the code scanning workflow for a JavaScript repository to run the built-in security-and-quality suite PLUS your custom query pack, while excluding one noisy built-in query by its query ID. Which approach correctly accomplishes all three requirements?

Reviewed for accuracy · Report an issue
Question 7 of 19

A security engineer is reviewing a CodeQL alert flagged as 'SQL query built from user-controlled sources'. The alert view shows a series of connected steps from an HTTP request parameter through several variable assignments and finally into a database execution call. A developer argues the alert is a false positive because the input is validated. Which aspect of the CodeQL alert should the engineer examine to determine whether the reported vulnerability path is actually exploitable?

Reviewed for accuracy · Report an issue
Question 8 of 19

A security engineer enabled CodeQL default setup on a repository to get scanning running quickly. Later, the team needs to add a custom CodeQL query pack maintained by their organization and adjust which build steps run before analysis. The engineer opens the repository's code scanning configuration but cannot find a way to specify custom queries or build commands. What is the correct action to enable these customizations?

Reviewed for accuracy · Report an issue
Question 9 of 19

Your organization runs CodeQL analysis on a self-hosted Jenkins pipeline instead of GitHub Actions because your build toolchain is highly customized. After the CodeQL CLI produces a `results.sarif` file, the team needs those results to appear as code scanning alerts in the repository's Security tab on GitHub.com. Which approach correctly delivers the SARIF results into GitHub code scanning?

Reviewed for accuracy · Report an issue
Question 10 of 19

A DevOps engineer maintains a monorepo containing services written in Go, JavaScript, and Java. They want to enable CodeQL code scanning via GitHub Actions so that each language is analyzed independently and failures in one language's analysis do not block the others. Which approach best achieves this within a single workflow file?

Reviewed for accuracy · Report an issue
Question 11 of 19

A security engineer wants their CodeQL code scanning workflow to run additional queries beyond the defaults, including lower-severity and lower-precision rules, to surface more potential issues during an internal audit. They are editing the CodeQL Action step in the workflow. Which configuration should they use to accomplish this?

Reviewed for accuracy · Report an issue
Question 12 of 19

Your security team ingests SARIF files produced by an external SAST tool into GitHub code scanning using the SARIF upload API. Some large SARIF uploads are being rejected or silently truncated, and developers complain that certain alerts never appear in the Security tab. Which characteristic of GitHub's SARIF ingestion should the team account for to ensure their results are reliably processed?

Reviewed for accuracy · Report an issue
Question 13 of 19

You maintain a large Java monorepo where the default CodeQL analysis workflow runs on GitHub-hosted runners. Recently the 'Perform CodeQL Analysis' step began failing intermittently with the runner terminating during the database build, and the logs show the process was killed after consuming all available memory. The team must keep using GitHub Actions for scanning. What is the most appropriate first step to resolve the failures while preserving analysis quality?

Reviewed for accuracy · Report an issue
Question 14 of 19

A platform team maintains a large repository with services written in Go, TypeScript, and a legacy COBOL component. They currently use CodeQL for the Go and TypeScript code but need static analysis for COBOL, which CodeQL does not support. Leadership wants all findings consolidated in the repository's Security tab alongside the existing CodeQL alerts. What is the most appropriate approach?

Reviewed for accuracy · Report an issue
Question 15 of 19

A platform team notices their CodeQL analysis workflow is frequently triggered multiple times in quick succession when developers push several commits to the same feature branch within minutes. This causes a backlog of queued CodeQL jobs, consuming Actions runner minutes and delaying results for the latest commit. The team wants to ensure that when a newer run starts for a branch, any in-progress or queued CodeQL runs for that same branch are automatically cancelled. Which change to the CodeQL workflow best achieves this?

Reviewed for accuracy · Report an issue
Question 16 of 19

Your team enabled CodeQL code scanning default setup for a repository, but you notice the code scanning results only include JavaScript alerts even though the repository also contains a substantial Python backend and some C# tooling scripts. You want CodeQL to analyze the Python code as well without abandoning the maintainability of default setup. What is the correct approach?

Reviewed for accuracy · Report an issue
Question 17 of 19

A platform team runs CodeQL with advanced setup on a large JavaScript repository. Their scan produces dozens of alerts in a checked-in `vendor/` directory and in minified `dist/` bundles that they never author or fix directly. These noisy alerts are cluttering the Security tab and slowing analysis. The team wants CodeQL to stop analyzing those directories entirely while continuing to scan the application source. What is the most appropriate way to achieve this?

Reviewed for accuracy · Report an issue
Question 18 of 19

A DevOps engineer maintains a CodeQL advanced-setup workflow for a large repository. Currently the workflow triggers only on a weekly schedule, and developers complain that vulnerabilities introduced in feature branches are not surfaced until long after merge. The team wants CodeQL to analyze code as it is proposed, blocking regressions before they reach the default branch, while keeping scheduled scans for baseline coverage. Which change to the workflow's trigger configuration best meets this goal?

Reviewed for accuracy · Report an issue
Question 19 of 19

Your team runs a proprietary static analysis tool in an external Jenkins pipeline, not on GitHub Actions. You want the tool's findings to appear as code scanning alerts in the GitHub Security tab of your repository, tracked alongside CodeQL results. The tool can export its findings to a standardized file format. What is the correct approach to get these findings into GitHub code scanning?

Reviewed for accuracy · Report an issue

More GH-500 practice

Keep going with the other GitHub Advanced Security (GH-500) domains, or take a full timed mock exam.

← Back to GH-500 overview