GH-500 — GitHub Advanced Security Cheat Sheet
Compact Cheat sheet for GitHub Advanced Security (GH-500): code scanning, CodeQL, secret scanning, Dependabot, dependency review, governance, and exam decision points.
This Cheat Sheet is independent review support for candidates preparing for the GitHub Advanced Security (GH-500) exam from GitHub. Use it to connect exam scenarios to the right GitHub Advanced Security feature, configuration pattern, and troubleshooting path.
Use the tables for a quick pre-exam check. Expand a topic’s notes for explanations, examples, and additional distinctions.
Scope and study context
The exam is likely to test whether you can choose the right GitHub Advanced Security capability for a scenario, configure it correctly, interpret alerts, and avoid unsafe defaults in real repositories and organizations. Focus less on memorizing product slogans and more on decision-making: Which feature solves the problem? Who can configure it? What happens in a pull request? What alert should be triaged first?
Use this Cheat Sheet as a compressed map, then move into IT Mastery practice:
- Start with topic drills for code scanning, secret scanning, dependency security, and administration.
- For every missed original practice question, identify the decision point you missed.
- Read the detailed explanations, especially for similar-sounding features.
- Build a short error log with traps such as “used Dependabot alert when dependency review was needed.”
- Finish with mixed mock exams so you practice switching contexts quickly.
Practical next step: take a focused GH-500 question bank drill on one weak area, review every explanation, then return to this checklist and confirm you can explain the correct feature choice in your own words.
Core GitHub Advanced Security feature map
| Area | Primary purpose | Typical signal | Best used for | Common exam trap |
|---|---|---|---|---|
| Code scanning | Find code vulnerabilities and coding errors | Code scanning alerts, PR annotations, SARIF results | Secure coding issues, data-flow flaws, custom static analysis | It is not dependency/SCA scanning and not runtime detection |
| CodeQL | GitHub’s semantic code analysis engine | CodeQL-generated code scanning alerts | Deep source analysis, custom queries, variant analysis | Default setup is easier; advanced setup is needed for custom builds/queries |
| Third-party SARIF upload | Bring external static analysis results into GitHub | SARIF code scanning alerts | Centralizing external tool findings in GitHub | SARIF upload needs correct workflow permissions and commit/branch context |
| Secret scanning | Detect secrets committed to repositories | Secret scanning alerts | Leaked tokens, keys, credentials | It detects known/custom patterns; it does not prove no secret exists |
| Push protection | Block supported secrets before they enter the repository | Blocked push or bypass request | Preventing new secret leaks | It does not clean historical secrets already committed |
| Dependency graph | Inventory dependencies from manifests/lockfiles/submissions | Dependency inventory | Foundation for Dependabot alerts and dependency review | If dependencies are not represented/submitted, alerts may be missing |
| Dependabot alerts | Identify vulnerable dependencies | Security alert | Known vulnerable package versions | Alerting requires dependency visibility and advisory data |
| Dependabot security updates | Open PRs to fix vulnerable dependencies | Security update PR | Remediating Dependabot alerts | Not the same as scheduled version updates |
| Dependabot version updates | Keep dependencies current on a schedule | Maintenance PR | Reducing lag and future upgrade risk | Not vulnerability-driven by itself |
| Dependency review | Evaluate dependency changes in PRs | PR check/failure/comment | Blocking risky new dependencies before merge | It reviews PR deltas; it is not a full repository scan |
| Security overview | Organization/enterprise security posture view | Aggregated coverage and alerts | Governance, prioritization, reporting | It summarizes; it does not replace feature-level triage |
| Repository security advisories | Coordinate disclosure and fixes for a project vulnerability | Advisory draft/published advisory | Maintainer-managed vulnerability disclosure | Different from Dependabot alerts raised against consumers |
| SECURITY.md | Publish security policy/contact process | Security policy file | Directing reporters and contributors | A policy does not enable scanning by itself |
| Audit log | Record security-relevant admin/user activity | Audit events | Investigating changes, bypasses, settings | Use for “who changed/bypassed” questions, not code vulnerability discovery |
Fast scenario-to-feature selection
| Scenario keyword | Choose | Why |
|---|---|---|
| “Find SQL injection, XSS, path traversal, unsafe deserialization in source” | Code scanning with CodeQL | Semantic/code-flow analysis |
| “Use organization-specific insecure API pattern” | Custom CodeQL query or query pack | Encodes custom rules beyond default queries |
| “Existing SAST tool already produces results” | Upload SARIF to code scanning | Centralizes findings in GitHub UI |
| “Block a personal access token before it is pushed” | Secret scanning push protection | Preventive control at push time |
| “Detect internal token format not known to GitHub” | Secret scanning custom pattern | Adds organization-specific regex detection |
| “Find vulnerable npm/Maven/Python package version already in repo” | Dependency graph + Dependabot alerts | Matches dependency inventory to advisories |
| “Open PR automatically to fix a vulnerable dependency” | Dependabot security updates | Remediation PRs for alerts |
| “Keep GitHub Actions or package versions current weekly/monthly” | Dependabot version updates | Scheduled maintenance updates |
| “Fail a PR that introduces a critical dependency vulnerability” | Dependency review action / dependency review policy | PR-time dependency risk gate |
| “See which repositories have GHAS features enabled” | Security overview / security configurations | Governance and coverage |
| “Standardize security settings for new repositories” | Organization security configurations | Apply consistent feature enablement |
| “Need who bypassed push protection or disabled scanning” | Audit log | Administrative/event investigation |
| “Project maintainer needs private vulnerability coordination” | Repository security advisory + private fork | Coordinated disclosure and patch workflow |
Enablement, permissions, and governance reference
| Level | What is commonly managed there | Exam-oriented notes |
|---|---|---|
| Enterprise | GHAS availability, enterprise-wide policies, audit visibility, security posture | Enterprise settings can constrain organization and repository choices. Do not assume a repository admin can override enterprise policy. |
| Organization | Security configurations, default feature enablement, security managers, custom secret patterns, overview views | Use organization-level controls for consistency across many repositories. |
| Repository | Feature toggles when permitted, workflow files, CodeQL config, Dependabot config, alert triage | Repository settings are best for repo-specific tuning, but may be governed from above. |
| Branch/ruleset controls | Required checks, review requirements, merge restrictions | Use with CodeQL/dependency review checks to prevent insecure changes from merging. |
| Security manager role | Manage security alerts and settings across an organization without full owner privileges | High-yield least-privilege answer when broad security administration is needed. |
| Repository admin/maintainer/developer roles | Configure workflows, triage alerts, fix findings depending on permission model | Exact visibility/action depends on repository permissions and organization policy. |
Notes and examples
Security configurations vs workflow files
| Need | Better fit |
|---|---|
| Enable GHAS features consistently across many repositories | Organization security configuration |
| Customize CodeQL build commands, query suites, paths, languages | CodeQL workflow/config file |
| Enforce that new repositories start with selected security settings | Default security configuration |
| Standardize scanner behavior for many repositories with similar build | Reusable workflow plus organization policy |
| Tune a single monorepo with special generated-code exclusions | Repository-specific CodeQL config |
High-yield workflow: detect, prevent, triage, govern
flowchart LR
A[Repository code and dependencies] --> B[Prevent]
B --> B1[Push protection]
B --> B2[Dependency review]
B --> B3[Required checks/rulesets]
A --> C[Detect]
C --> C1[Code scanning/CodeQL]
C --> C2[Secret scanning]
C --> C3[Dependabot alerts]
C1 --> D[Triage alerts]
C2 --> D
C3 --> D
D --> E[Fix, dismiss with reason, or document risk]
E --> F[Govern]
F --> F1[Security overview]
F --> F2[Security configurations]
F --> F3[Audit log]
Code scanning and CodeQL
Code scanning setup choices
| Setup path | Use when | Strengths | Watch for |
|---|---|---|---|
| Default setup | Repository has supported languages and standard build needs | Fast enablement, low maintenance, GitHub-managed workflow behavior | Limited customization; may not fit complex monorepos or special build steps |
| Advanced setup | Need custom queries, paths, build commands, workflow triggers, matrices, or permissions | Full workflow control | Misconfigured builds lead to incomplete analysis |
| CodeQL CLI | Analysis occurs outside GitHub Actions or in custom CI | Portable, scriptable, useful for advanced pipelines | Must create/analyze databases and upload SARIF correctly |
| Third-party SARIF | Existing scanner is preferred or required | Unified alerts in GitHub code scanning | SARIF quality and mapping affect alert usefulness |
| Variant analysis | Need to search for variants of a known issue pattern across codebases | Powerful for security research and organization-wide patterns | Not a replacement for continuous scanning |
Notes and examples
Code scanning event selection
| Trigger | Use for | Notes |
|---|---|---|
pull_request | Preventing new issues before merge | High-value for PR annotations and required checks |
push to default/protected branches | Updating baseline alerts after merge | Common baseline scan trigger |
schedule | Re-scan without code changes, pick up query improvements | Useful even when code is stable |
workflow_dispatch | Manual/ad hoc scans | Good for troubleshooting and one-off validation |
| External CI + SARIF upload | Non-GitHub Actions pipelines | Requires correct commit SHA/ref and upload permissions |
Minimal advanced CodeQL workflow pattern
Use advanced setup when you need workflow control. Keep permissions least-privilege and add build steps only when required by the language/build system.
name: CodeQL
on:
pull_request:
push:
branches: [main]
schedule:
- cron: "30 2 * * 1"
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: [javascript-typescript]
steps:
- uses: actions/checkout@v4
- uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
queries: +security-extended,security-and-quality
# Add manual build steps here when autobuild is insufficient.
- uses: github/codeql-action/analyze@v3
CodeQL build decision table
| Repository/build characteristic | Prefer | Why |
|---|---|---|
| JavaScript/TypeScript, Python, Ruby with normal layout | Default setup or advanced setup with no custom build | Many interpreted ecosystems do not need a compile step for useful analysis |
| Compiled language with standard project | Default setup or autobuild | Lower maintenance if GitHub can infer build |
| Compiled language with custom build, private dependencies, generated sources, monorepo | Advanced setup with manual build commands | Ensures CodeQL observes the correct compilation/database |
| Multiple languages | Matrix or multiple language entries | Keeps analysis organized and avoids missing languages |
| Multiple independent projects in one repo | Path filters, custom build, or separate jobs/categories | Avoids scanning noise and result overwrites |
| External scanner | SARIF upload | Code scanning UI can ingest compatible results |
CodeQL configuration file reference
A CodeQL config file is useful when you want reusable path/query configuration separate from the workflow.
name: codeql-config
queries:
- uses: security-extended
- uses: security-and-quality
paths:
- src
paths-ignore:
- test
- docs
- "**/*.generated.*"
| Configuration item | Use for | Trap |
|---|---|---|
queries | Add standard suites or custom packs | More queries can mean more findings and longer analysis |
paths | Limit analysis to relevant source | Overly narrow paths can hide vulnerable code |
paths-ignore | Exclude generated/test/vendor code | Do not exclude code that ships to production |
| Manual build steps | Make database accurate for compiled languages | A successful workflow can still produce poor results if the wrong build ran |
| Matrix languages | Analyze multiple languages cleanly | A language not listed may not be analyzed in advanced setup |
security-events: write | Upload code scanning results | Missing permission is a common SARIF/analyze failure |
CodeQL query and pack distinctions
| Term | Meaning | Exam use |
|---|---|---|
| Query | A CodeQL rule that finds a pattern | Add custom detection for a vulnerability class |
| Query suite | A curated set of queries | Select security-extended or security-and-quality based on signal goals |
| Query pack / QL pack | Packaged queries and dependencies | Share custom queries across repositories |
| CodeQL database | Extracted representation of code for analysis | Created during CodeQL analysis or with CodeQL CLI |
| Modeling | Teaching CodeQL about frameworks/libraries | Improves data-flow results for custom APIs |
| Variant analysis | Running a query to find related issue variants | Useful after discovering a specific bug pattern |
CodeQL CLI pattern
Use the CLI when analysis is performed outside GitHub Actions or when building custom automation.
codeql database create codeql-db \
--language=javascript-typescript \
--source-root=.
codeql database analyze codeql-db \
--format=sarif-latest \
--output=codeql-results.sarif \
codeql/javascript-queries
Then upload the SARIF through a GitHub Actions workflow or API-supported process with appropriate permissions.
SARIF upload reference
- uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: results.sarif
category: third-party-sast
| SARIF issue | Likely cause | Fix |
|---|---|---|
| Upload denied | Missing security-events: write or policy restriction | Set workflow permissions or adjust policy |
| Alerts attached to wrong branch/commit | SARIF uploaded from wrong ref/SHA | Upload in workflow context matching analyzed commit |
| Results overwrite each other | Same tool/category for multiple analyses | Use distinct categories for different tools/languages |
| Alerts lack useful locations | Poor SARIF mapping | Ensure results include file paths, regions, rule IDs |
| PR annotations missing | Scan not triggered on PR or paths not changed/mapped | Add PR trigger and confirm SARIF locations map to diff |
Code scanning triage
| Action | Use when | Notes |
|---|---|---|
| Fix | Alert represents a real issue | Preferred for exploitable or reachable code |
| Dismiss as false positive | Tool finding is incorrect | Include rationale; avoid hiding similar real issues |
| Dismiss as used in tests | Intentional vulnerable pattern in test-only code | Better long-term fix may be excluding test paths or using safe fixtures |
| Dismiss as won’t fix / accepted risk | Business decision accepts risk | Should be documented and reviewable |
| Reopen | Dismissed issue becomes relevant or reintroduced | Alerts may reappear when code changes or analysis improves |
What code scanning does
Code scanning helps identify vulnerabilities and coding errors in a repository. With GitHub Advanced Security, the most commonly tested engine is CodeQL, but code scanning can also ingest compatible third-party static analysis results through SARIF upload.
Think of code scanning as answering:
- Does this code contain a known insecure pattern?
- Did this pull request introduce a new alert?
- Is a vulnerability still present on the default branch?
- Should an alert be fixed, dismissed, or investigated further?
CodeQL analysis flow
| Step | What happens | Exam-relevant point |
|---|---|---|
| Initialize | CodeQL prepares analysis for selected languages | Language detection and configuration matter |
| Build or extract | CodeQL creates a database representation of the code | Compiled languages may need accurate build information |
| Analyze | Queries run against the CodeQL database | Query suite choice affects alert coverage |
| Upload results | Results appear as code scanning alerts | SARIF category and branch context can affect display |
| Triage | Developers fix, dismiss, or investigate alerts | Dismissal should be justified, not used as cleanup |
Default setup
Default setup is appropriate when the repository fits GitHub’s supported automatic configuration model. It is valuable for broad rollout because it reduces workflow maintenance.
High-yield points:
- It is designed for fast enablement.
- It uses GitHub-managed configuration choices.
- It may not be enough for custom build requirements.
- It is usually not the right answer when the scenario demands custom queries, custom schedules, special build commands, or complex language handling.
Advanced setup
Advanced setup uses a GitHub Actions workflow for CodeQL. Choose it when you need control.
Common reasons to use advanced setup:
- Custom build commands.
- Custom query suites.
- Custom CodeQL packs or organization-authored queries.
- Specific workflow triggers.
- Matrix builds for multiple languages.
- Integration with a more complex CI process.
CodeQL query suites
| Query suite idea | What to remember |
|---|---|
| Default security coverage | Baseline security analysis suitable for many repositories |
| Extended security coverage | Broader security detection, often more alerts |
| Security and quality coverage | Includes quality-oriented findings in addition to security-oriented findings |
| Custom queries | Useful for organization-specific rules, frameworks, or internal secure-coding requirements |
Exam trap: More queries is not always better. Broader query suites can increase coverage but may also increase triage effort. In a scenario about reducing noise, do not blindly select the broadest suite.
CodeQL custom queries
You do not need to become a full CodeQL developer for a quick review, but you should understand the concepts.
| Concept | Meaning |
|---|---|
| Database | CodeQL’s structured representation of the source code |
| Query | Logic that searches the database for patterns |
| Source | Where untrusted or sensitive data originates |
| Sink | Dangerous operation where that data may cause harm |
| Sanitizer | Validation or transformation that makes data safer |
| Path problem | Alert type that can show a flow path from source to sink |
| Query pack | Packaged CodeQL queries that can be reused and versioned |
Common exam pattern: a scenario describes tainted user input reaching a dangerous API. The right mental model is source → flow steps → sanitizer check → sink.
SARIF upload
SARIF upload allows compatible third-party static analysis results to appear in GitHub code scanning.
Use SARIF when:
- The organization already uses another scanner.
- The language or framework is better covered by a specialized tool.
- Results should be centralized in GitHub code scanning.
- A CI workflow generates analysis results outside CodeQL.
Common traps:
- SARIF upload does not mean the tool is CodeQL.
- Multiple tools or categories should be distinguished clearly so alerts do not overwrite or confuse each other.
- Uploading results is not the same as fixing alerts.
Code scanning alert lifecycle
| Status or action | Meaning | Good candidate behavior |
|---|---|---|
| Open | Alert is currently detected | Prioritize by severity, exploitability, and affected code |
| Fixed | The issue is no longer detected | Confirm the fix is merged into the relevant branch |
| Dismissed | The alert is intentionally closed without code change | Use only with a valid reason and documentation |
| Reopened | The issue appears again or was not truly resolved | Investigate regression or incomplete remediation |
Decision rule: Fix when the finding is valid and reachable. Dismiss only when you can justify why the alert is not actionable.
Secret scanning and push protection
Secret scanning decision table
| Need | Use | Why |
|---|---|---|
| Detect known provider tokens already committed | Secret scanning alerts | Scans repository content for supported secret patterns |
| Prevent supported secrets from being pushed | Push protection | Blocks at push time before secret lands |
| Detect internal credential format | Custom secret scanning pattern | Adds organization/repository-specific regex |
| Reduce false positives before rollout | Test/dry-run custom pattern where available | Validates pattern against real repositories |
| Investigate whether a bypass occurred | Audit log and alert metadata | Tracks user/admin security-relevant actions |
| Remove exposed credential risk | Revoke/rotate secret, then remediate code/history as needed | Deleting code alone may not invalidate the secret |
Notes and examples
Secret scanning vs push protection
| Capability | Secret scanning | Push protection |
|---|---|---|
| Detects historical committed secrets | Yes | No |
| Blocks new pushes containing supported secrets | No | Yes |
| Creates alerts for triage | Yes | Yes, when bypassed or detected depending on flow |
| Supports custom patterns | Yes | May apply depending on configuration and support |
| Requires developer action before push succeeds | No | Yes |
| Best control type | Detective | Preventive |
Push protection response choices
| Developer sees blocked push | Best response | Exam reasoning |
|---|---|---|
| Real secret accidentally committed | Remove secret from commit and rotate/revoke it | Secret may already be exposed locally or in attempted workflow |
| False positive test value | Replace with clearly fake value that does not match real pattern | Avoid repeated bypasses |
| Business-critical urgent push | Bypass only if policy allows and reason is valid | Bypass creates governance/audit concern |
| Secret needed by app | Store in GitHub Actions secrets, environment secrets, or external secret manager | Do not hard-code secrets in source |
Custom secret pattern checklist
- Define the secret format precisely enough to avoid broad matches.
- Add surrounding context when possible, such as a prefix, key name, or delimiter.
- Test against representative repositories before broad enablement.
- Publish/apply at the narrowest level that meets the need.
- Monitor false positives and tune the pattern.
- Pair detection with an incident response process: revoke, rotate, remove, document.
Secret alert triage
| Status/action | Use when | Important distinction |
|---|---|---|
| Open | Needs investigation or remediation | Do not leave real credentials open after rotation |
| Resolved as revoked/rotated | Credential is invalidated | Preferred for real secrets |
| Resolved as false positive | Match is not actually a secret | Tune custom pattern if repeated |
| Resolved as used in tests | Non-production test credential is intentional | Safer to use fake values that cannot authenticate |
| Accepted risk / will not fix | Organization explicitly accepts exposure risk | Should be rare and documented |
| Reopen | Credential is still valid or reintroduced | Reassess scope and rotation |
Secret scanning basics
Secret scanning detects credentials such as tokens, keys, and other secrets in repository content. It may detect provider-specific patterns and, where configured, custom patterns created by the organization.
Secret scanning helps answer:
- Has a secret already been committed?
- Which repository, commit, file, or surface exposed it?
- Is the detected secret likely active or valid?
- Who needs to rotate or revoke it?
- Should a custom pattern be added for internal secrets?
Push protection
Push protection acts earlier than ordinary alerting. It can block a push or commit flow when a supported secret is detected before the secret lands in the repository.
| Feature | Main purpose | Timing |
|---|---|---|
| Secret scanning alerts | Detect exposed secrets already present | After detection in repository content |
| Push protection | Prevent supported secrets from being pushed | Before or during push |
| Custom patterns | Detect organization-specific secret formats | Depends on configuration and rollout |
| Bypass review or audit | Manage exceptions | After a user attempts to bypass |
Common exam trap: Push protection is preventive; secret scanning alerts are detective. They complement each other.
Secret scanning response process
| Step | What to do | Why it matters |
|---|---|---|
| Validate context | Check where the secret appeared and what it can access | Not all secrets have equal blast radius |
| Revoke or rotate | Disable the exposed credential and issue a replacement if needed | Removing code history alone is not enough |
| Remove exposure | Delete or rewrite the secret from code, config, or docs as appropriate | Prevents repeated exposure |
| Investigate use | Review logs or provider activity | Detects possible compromise |
| Close alert with reason | Document the outcome | Maintains auditability |
Critical trap: Deleting the secret from the repository does not automatically make the secret safe. Rotation or revocation is usually the key security action.
Custom secret patterns
Custom patterns are useful when your organization has internal token formats that GitHub’s built-in partner patterns may not recognize.
| Design point | Good practice | Trap |
|---|---|---|
| Regex specificity | Match the actual token structure | Overly broad regex creates noisy alerts |
| Context requirements | Use surrounding text or format rules where helpful | Matching random strings as secrets |
| Dry run or test mode | Evaluate alert volume before broad rollout | Enabling noisy patterns everywhere immediately |
| Ownership | Define who triages alerts | Creating alerts with no response process |
| Exclusions | Keep narrow and documented | Excluding large paths to hide noise |
Alert triage priorities
Use severity, exploitability, reachability, and business context together. The highest numeric severity is important, but exam scenarios may include additional context that changes priority.
| Factor | Why it matters |
|---|---|
| Severity | Indicates potential technical impact |
| Exposure | Public-facing code or internal-only code changes priority |
| Reachability | Vulnerable code that is actually invoked is more urgent |
| Secret validity | Active credentials require immediate action |
| Asset criticality | Production authentication service matters more than a demo repo |
| Fix availability | Available patches or clear code fixes accelerate remediation |
| Age and recurrence | Long-lived or repeated alerts suggest process issues |
Quick rule: Active leaked secret in a production system is usually urgent even if a static severity label is not present.
Dependency security and supply chain
Dependency feature relationships
flowchart LR
A[Manifest, lockfile, or submitted dependencies] --> B[Dependency graph]
B --> C[Dependabot alerts]
C --> D[Dependabot security updates]
B --> E[Dependency review on PRs]
F[dependabot.yml schedule] --> G[Dependabot version updates]
Notes and examples
Dependency feature decision matrix
| Feature | Detects/does | Trigger | Output | Use when |
|---|---|---|---|---|
| Dependency graph | Identifies dependencies | Repository files or dependency submission | Dependency inventory | You need visibility into what packages are used |
| Dependency submission API | Adds build-resolved dependencies not visible in manifests | CI/build submission | Enriched dependency graph | Ecosystem/build system is not fully represented by checked-in files |
| Dependabot alerts | Matches dependencies to advisories | Dependency graph + advisory data | Security alert | You need vulnerability awareness |
| Dependabot security updates | Opens PRs to remediate vulnerable dependencies | Dependabot alert with available fix path | Security PR | You want automated vulnerability remediation |
| Dependabot version updates | Opens PRs for newer versions on a schedule | dependabot.yml schedule | Maintenance PR | You want regular dependency freshness |
| Dependency review | Reviews dependency changes in PRs | Pull request | PR check/comment/failure | You want to block newly introduced vulnerable dependencies |
Dependabot alerts vs updates
| Item | Dependabot alerts | Dependabot security updates | Dependabot version updates |
|---|---|---|---|
| Primary goal | Notify about vulnerable dependency | Fix vulnerability | Keep dependency current |
| Vulnerability-driven | Yes | Yes | No |
| Opens PR | No | Yes | Yes |
Requires dependabot.yml | Not always for alerting | Not always for security updates, but config may tune behavior | Yes |
| Best exam phrase | “Identify vulnerable dependency” | “Automatically create remediation PR” | “Scheduled update PRs” |
Dependabot configuration pattern
version: 2
updates:
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "weekly"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
| Config choice | Use for | Trap |
|---|---|---|
package-ecosystem | Select npm, Maven, pip, GitHub Actions, etc. | Wrong ecosystem means no updates |
directory | Location of manifest | Monorepos often need multiple entries |
schedule | Cadence for version update checks | Version updates are maintenance, not vulnerability alerting |
| Groups | Combine related updates | Over-grouping can make PRs harder to review |
| Private registry config | Allow Dependabot to access private packages | Dependabot secrets are separate from GitHub Actions secrets |
| Ignore rules | Suppress specific versions/dependencies | Can hide needed security fixes if too broad |
Dependency review action pattern
name: Dependency Review
on:
pull_request:
permissions:
contents: read
pull-requests: read
jobs:
dependency-review:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/dependency-review-action@v4
with:
fail-on-severity: high
| Dependency review question | Answer |
|---|---|
| “When does it run?” | On pull requests |
| “What does it evaluate?” | Dependency changes introduced by the PR |
| “How can it block merges?” | Fail the PR check and require the check through rulesets/branch protection |
| “What does it depend on?” | Dependency graph and recognizable dependency manifests/lockfiles |
| “Is it the same as Dependabot alerts?” | No. Alerts report known vulnerabilities; review gates PR changes |
Dependency triage
| Finding | Best first action | Notes |
|---|---|---|
| Vulnerable direct dependency with patch available | Accept Dependabot security update PR or manually upgrade | Direct upgrades are usually straightforward |
| Vulnerable transitive dependency | Upgrade parent dependency or override if ecosystem supports it | Understand dependency chain before dismissing |
| No fixed version available | Mitigate usage, monitor advisory, document risk | Do not invent a fix |
| Package unused in runtime | Remove dependency or dismiss with clear rationale | “Not used” should be verified |
| Private package not detected | Use dependency submission or registry configuration | Visibility problem, not necessarily no risk |
Dependency graph
The dependency graph identifies dependencies declared in supported manifest and lock files. It is foundational because other features use dependency information.
Think of the dependency graph as an inventory layer:
- What packages does the repository depend on?
- Which versions are declared or resolved?
- Which ecosystems are involved?
- Are manifests and lock files accurate?
Trap: The dependency graph itself is not the same as a fix. It provides dependency visibility.
Dependabot alerts
Dependabot alerts identify dependencies with known vulnerabilities based on advisory data and version ranges.
| Concept | Meaning |
|---|---|
| Affected package | Package with a known vulnerability |
| Affected range | Vulnerable version range |
| Patched version | Version that addresses the vulnerability, if available |
| Severity | Risk indicator, often based on vulnerability scoring and context |
| Manifest location | Where the dependency is declared |
Common exam decision: If a repository already contains a vulnerable dependency, think Dependabot alert. If a pull request introduces a vulnerable dependency, think dependency review.
Dependabot security updates
Dependabot security updates can open pull requests to update vulnerable dependencies when an upgrade path is available.
Remember:
- Security updates are remediation-oriented.
- They are not the same as version updates for routine freshness.
- They may not work automatically if the ecosystem, version constraints, private registry authentication, or compatibility issues prevent a clean update.
- Generated pull requests still need review and testing.
Dependency review
Dependency review evaluates dependency changes in pull requests. It can help prevent new vulnerable or disallowed dependencies before merge.
| Scenario | Best answer |
|---|---|
| PR adds a package with a known critical vulnerability | Dependency review |
| Existing default branch has vulnerable package versions | Dependabot alerts |
| Need automated PR to upgrade a vulnerable dependency | Dependabot security updates |
| Need inventory of repository dependencies | Dependency graph |
| Need organization-wide visibility into vulnerable repos | Security overview |
Common trap: Dependency review is PR-centered. It is not primarily a historical scanner for all existing dependency debt.
GitHub Actions security for GHAS workflows
| Situation | Secure pattern | Trap |
|---|---|---|
| CodeQL or SARIF upload | Grant security-events: write only where needed | Overly broad workflow permissions |
| Analyze private dependencies | Use least-privilege credentials/secrets | Hard-coding tokens to make build work |
| PRs from forks | Be careful with secrets and privileged triggers | pull_request_target can be dangerous with untrusted code |
| Dependabot PR runs workflow | Use Dependabot-aware permissions/secrets | Dependabot does not automatically get normal Actions secrets |
| Required security gates | Require CodeQL/dependency review status checks | A scanner that only reports after merge is not a preventive gate |
| Reusable workflows | Standardize GHAS scanning across repos | Still need repo-specific language/build tuning |
Repository security and disclosure
| Capability | Use when | Key distinction |
|---|---|---|
| SECURITY.md | You want to tell users how to report vulnerabilities | Documentation/policy only |
| Private vulnerability reporting | You want external reporters to privately report issues | Intake mechanism |
| Repository security advisory | Maintainer coordinates fix and disclosure | Advisory workflow for the affected project |
| Temporary private fork | Patch collaboration without public exposure | Used during advisory remediation |
| CVE request/publishing support | Public vulnerability disclosure needs standardized identifier | Do not confuse with scanner-generated alerts |
| Dependabot alert | Your repository consumes a vulnerable dependency | Consumer-side notification |
Security overview, campaigns, and prioritization
| View/control | Use for | Practical exam angle |
|---|---|---|
| Security overview | See alert counts, feature coverage, risk across repositories | Best answer for organization/enterprise posture questions |
| Security coverage | Identify repos missing code scanning, secret scanning, Dependabot, etc. | Helps roll out GHAS consistently |
| Repository risk views | Prioritize repositories with more severe/open alerts | Supports remediation planning |
| Security configurations | Apply standard security settings | Governance at scale |
| Security campaigns / remediation tracking where available | Coordinate fixing selected alert groups | Useful for focused remediation, not initial detection |
| Audit log | Investigate settings changes, bypasses, admin actions | Governance and accountability |
Notes and examples
Prioritization reference
| Highest priority | Why |
|---|---|
| Exposed valid production secret | Immediate credential compromise risk; rotate/revoke first |
| Critical reachable dependency vulnerability with exploit path | Known vulnerable component in use |
| Code scanning alert in internet-facing/auth-sensitive path | Application exploit risk |
| PR introducing new high/critical vulnerable dependency | Prevent before merge |
| Repeated push protection bypasses | Indicates training or policy enforcement gap |
| Repositories with no security coverage | Blind spot; enable baseline controls |
Alert lifecycle quick reference
| Step | Code scanning | Secret scanning | Dependabot |
|---|---|---|---|
| Detect | CodeQL/third-party SARIF scan | Pattern match in repository or push | Advisory match against dependency graph |
| Notify | Alert, PR annotation, check | Alert/block/bypass event | Alert and optional PR |
| Triage | Confirm exploitability/reachability | Determine whether credential is real/valid | Determine affected package path and fix availability |
| Remediate | Code fix, safe API, validation, sanitization | Revoke/rotate, remove secret, purge if needed | Upgrade, remove, override, or mitigate |
| Close | Fixed by scan result or dismissed | Resolved with reason | Fixed, dismissed, or no longer detected |
| Govern | Required checks, security overview | Push protection, audit log | Dependency review, rulesets, security overview |
Common GH-500 traps
| Trap | Correct exam reasoning |
|---|---|
| “Enable secret scanning to block secrets from being pushed.” | Secret scanning detects; push protection blocks supported secrets at push time. |
| “Dependabot version updates fix vulnerabilities.” | They update versions on a schedule. Security updates are vulnerability-driven. |
| “Dependency review scans the whole repository.” | It evaluates dependency changes in a pull request. |
| “Code scanning finds vulnerable open-source packages.” | That is dependency security. Code scanning analyzes source code. |
| “Default CodeQL setup is always best.” | Use advanced setup for custom builds, queries, paths, triggers, or monorepos. |
| “Autobuild success means perfect analysis.” | The build may be incomplete or not representative. Manual build may be needed. |
| “Dismissed alerts are gone forever.” | They can reappear if code changes, analysis changes, or issue is reintroduced. |
| “Deleting a leaked secret from code fixes the incident.” | Rotate/revoke the credential; assume exposure. |
| “Actions secrets are available to Dependabot.” | Dependabot uses its own secret handling; configure accordingly. |
| “Security overview remediates issues.” | It provides posture and prioritization; fixes happen in repos/workflows/dependencies. |
| “SARIF upload just needs a file.” | It also needs correct permissions, commit/ref context, and useful locations/rules. |
| “A SECURITY.md enables vulnerability scanning.” | It documents reporting policy only. |
Quick troubleshooting table
| Symptom | Likely cause | Check/fix |
|---|---|---|
| CodeQL workflow passes but no alerts/results | Language not detected, wrong paths, no analyzable code, upload issue | Confirm language matrix, config paths, Security tab, workflow logs |
| CodeQL fails during build | Missing dependencies, wrong build command, private registry credentials | Add setup steps, credentials, or manual build |
| SARIF upload fails | Missing permission or invalid SARIF | Add security-events: write; validate SARIF |
| PR has no code scanning annotation | Scan not running on PR or finding not in changed lines | Add PR trigger; verify branch/ruleset behavior |
| Secret push not blocked | Push protection not enabled or pattern not covered | Enable push protection and/or custom pattern |
| Too many custom secret false positives | Regex too broad | Add prefix/context and test pattern |
| Dependabot opens no PR | No supported manifest, no update path, config directory wrong, access issue | Check dependency graph, dependabot.yml, private registry config |
| Dependency review does not fail PR | Action not installed, severity threshold too low, check not required | Configure action and require status check |
| Security overview shows missing coverage | Features not enabled or policies not applied | Apply security configuration or repo setting |
| Developers bypass push protection often | Training/policy issue or false-positive pattern | Review audit events and tune controls |
Final exam-day selection guide
| If the scenario asks for… | Answer with… |
|---|---|
| “Prevent new leaked secrets” | Secret scanning push protection |
| “Find existing leaked secrets” | Secret scanning |
| “Custom internal credential detection” | Custom secret scanning pattern |
| “Find source code vulnerabilities” | Code scanning with CodeQL |
| “Use custom static analysis results in GitHub” | SARIF upload |
| “Analyze complex compiled monorepo” | Advanced CodeQL setup with manual build |
| “Add organization-specific vulnerability pattern” | Custom CodeQL query/query pack |
| “Find vulnerable dependencies” | Dependency graph + Dependabot alerts |
| “Automatically create dependency fix PR” | Dependabot security updates |
| “Keep dependencies current” | Dependabot version updates |
| “Block PRs adding risky dependencies” | Dependency review with required check |
| “Standardize GHAS enablement across repos” | Security configurations |
| “View posture across organization/enterprise” | Security overview |
| “Investigate setting changes or bypasses” | Audit log |
| “Document how to report vulnerabilities” | SECURITY.md |
| “Coordinate disclosure for a project vulnerability” | Repository security advisory |
Notes and examples
Next step: practice applying these distinctions to GH-500 scenario questions, especially cases that mix CodeQL setup, secret scanning prevention, Dependabot remediation, and organization-level governance.
High-yield capability map
| Need | GitHub capability to think of first | What it helps detect or control | Common exam trap |
|---|---|---|---|
| Find vulnerable code patterns | Code scanning with CodeQL or SARIF upload | Security and quality issues in source code | Confusing CodeQL analysis with dependency vulnerability detection |
| Customize static analysis | Advanced CodeQL setup, query suites, custom queries, CodeQL packs | Language-specific analysis, custom policies, organization standards | Assuming default setup supports every custom build or query requirement |
| Block exposed credentials before they land | Secret scanning push protection | Supported secrets detected during push or web commit flows | Thinking secret scanning and push protection are the same thing |
| Find committed secrets already present | Secret scanning alerts | Tokens, keys, credentials, custom patterns | Treating a resolved alert as proof the secret was rotated |
| Review vulnerable dependencies | Dependabot alerts and dependency graph | Known vulnerable package versions | Confusing dependency graph inventory with remediation |
| Automatically propose dependency fixes | Dependabot security updates | Pull requests for vulnerable dependencies when possible | Assuming every alert can be automatically fixed |
| Stop risky dependencies in PRs | Dependency review | Newly introduced vulnerable or disallowed dependencies | Using it for historical repository-wide remediation |
| Centralize security visibility | Security overview and organization or enterprise views | Alert posture across repositories | Looking only at one repository when the scenario says organization-wide |
| Harden CI/CD | GitHub Actions permissions, reusable workflows, trusted actions, OIDC, environments | Workflow supply-chain and secret exposure risk | Using pull_request_target carelessly with untrusted code |
Core decision rules
Pick the feature by timing
| Timing of the problem | Best feature family | Example scenario |
|---|---|---|
| Before code is merged | Code scanning PR checks, dependency review, branch protection or rulesets, push protection | A pull request introduces SQL injection or a vulnerable package |
| During development workflow | GitHub Actions security controls, CodeQL workflow, Dependabot PRs | CI should run CodeQL and fail if severe issues appear |
| After code already exists | Code scanning alerts, secret scanning alerts, Dependabot alerts, security overview | A repository has accumulated unresolved alerts |
| Across many repositories | Organization or enterprise security settings, security configurations, security overview | Standardize scanning for all production repos |
Notes and examples
Pick default setup or advanced setup
| Situation | Prefer default setup | Prefer advanced setup |
|---|---|---|
| Standard repository with supported languages | Yes | Maybe not needed |
| Need custom CodeQL query suites or packs | No | Yes |
| Need custom build steps | No | Yes |
| Need custom workflow triggers | No | Yes |
| Need matrix strategy or multi-language tuning | Limited | Yes |
| Need quick baseline enablement across repositories | Yes | Sometimes, after standardization |
The exam commonly tests whether you know that default setup is fast and opinionated, while advanced setup gives control through a GitHub Actions workflow.
Administration, permissions, and rollout
Repository, organization, and enterprise thinking
GH-500 scenarios often describe the scope of the problem. Match the solution to that scope.
| Scope in scenario | What to consider |
|---|---|
| Single repository | Repository security settings, workflow configuration, branch protection, alert triage |
| Team-owned set of repositories | Organization security settings, security manager access, standard workflows |
| Many repositories | Security configurations, organization policies, security overview, rollout strategy |
| Enterprise-wide governance | Enterprise-level policies, visibility, standardized enablement approach |
Notes and examples
Security manager role and least privilege
Security work often requires alert visibility and configuration access without full administrative ownership of every repository. GitHub supports delegated security administration patterns, such as security-focused roles at the organization level.
Exam principle: Grant the minimum access needed to manage security alerts and settings. Do not make everyone an organization owner just to view or triage alerts.
Security overview
Security overview helps security teams monitor posture across repositories and organizations.
Use it to answer questions like:
- Which repositories have code scanning disabled?
- Which repositories have unresolved critical alerts?
- Which teams own the riskiest repositories?
- Are security features consistently enabled?
- Where should remediation work be prioritized?
Trap: If the scenario asks for broad visibility, a repository-level alert page is too narrow.
Standardizing enablement
For large environments, manual per-repository setup is error-prone. Look for centralized approaches when the scenario mentions scale, consistency, governance, or onboarding many repositories.
Good rollout sequence:
- Identify repository scope and ownership.
- Decide required security features.
- Apply standard settings or configurations.
- Validate that alerts are flowing.
- Assign triage owners.
- Monitor adoption and exceptions.
- Improve based on false positives and remediation time.
GitHub Actions security concepts
GitHub Advanced Security questions may connect scanning with CI/CD. Know the security implications of workflow design.
Workflow permission basics
| Control | Why it matters |
|---|---|
| Least-privilege GITHUB_TOKEN permissions | Reduces damage if a workflow is compromised |
| Explicit permissions at workflow or job level | Avoids overly broad defaults |
| Environment protection rules | Adds control for sensitive deployments |
| Secrets scoped to repositories, environments, or organizations | Limits who and what can access secrets |
| OIDC federation | Can reduce long-lived cloud credentials in GitHub secrets |
| Pinning actions | Reduces risk from unexpected third-party action changes |
Notes and examples
Pull request event traps
| Event pattern | Risk |
|---|---|
| Running untrusted fork code with write credentials | Can expose secrets or modify repository state |
| Using pull_request_target without care | Runs in the target repository context and can be dangerous with untrusted code |
| Checking out attacker-controlled code in privileged workflows | May allow workflow compromise |
| Broad token permissions in PR workflows | Increases blast radius |
Exam rule: If untrusted code is involved, be cautious with secrets, write tokens, privileged events, and checkout behavior.
Common GH-500 candidate mistakes
| Mistake | Correct thinking |
|---|---|
| Treating all GitHub security features as interchangeable | Identify whether the issue is code, secret, dependency, workflow, or governance |
| Choosing advanced setup for every CodeQL scenario | Default setup is often correct for fast standard enablement |
| Choosing default setup when custom builds or custom queries are required | Advanced setup is needed for control |
| Assuming a Dependabot alert automatically means a PR exists | Security updates may need to be enabled and may not always generate a clean fix |
| Using dependency review for historical vulnerable dependencies | Use Dependabot alerts for existing dependency vulnerabilities |
| Ignoring lock files | Resolved versions often matter for accurate dependency analysis |
| Dismissing code scanning alerts to reduce noise | Dismiss only with defensible rationale |
| Removing a committed secret but not rotating it | Rotation or revocation is the security-critical action |
| Giving broad admin access to security staff | Prefer delegated security roles and least privilege |
| Overlooking organization-wide visibility | Use security overview for cross-repository posture |
| Allowing powerful workflow tokens in untrusted PRs | Restrict permissions and avoid privileged execution of untrusted code |
| Forgetting SARIF upload | Third-party analysis can be centralized in code scanning |
Scenario shortcuts
If the scenario says “custom build”
Think: advanced CodeQL setup.
Why: CodeQL may need the project to be built in a specific way to analyze accurately.
If the scenario says “custom internal token format”
Think: secret scanning custom pattern.
Why: Built-in patterns may not know the organization’s private credential format.
If the scenario says “block secrets before commit or push”
Think: push protection.
Why: The goal is prevention before the secret is introduced.
If the scenario says “PR adds vulnerable library”
Think: dependency review.
Why: The problem is introduced in a pull request.
If the scenario says “repository already has vulnerable library”
Think: Dependabot alerts and possibly Dependabot security updates.
Why: The vulnerability already exists in the dependency inventory.
If the scenario says “single view across repositories”
Think: security overview.
Why: Repository-by-repository review does not scale.
If the scenario says “third-party static analysis results”
Think: SARIF upload to code scanning.
Why: SARIF is the interoperability format for code scanning results.
Rapid final checklist
Before your next GH-500 practice session, confirm you can answer these without notes:
- When should you choose CodeQL default setup instead of advanced setup?
- What CodeQL scenario requires custom workflow configuration?
- What is the difference between code scanning, secret scanning, and dependency scanning?
- What is the difference between secret scanning alerts and push protection?
- Why is secret rotation more important than simply deleting a committed key?
- When should you use custom secret patterns?
- What is the dependency graph used for?
- How do Dependabot alerts differ from Dependabot security updates?
- How does dependency review protect pull requests?
- When is SARIF upload the right answer?
- What does security overview provide that a repository alert page does not?
- Why is pull_request_target risky with untrusted code?
- How should GITHUB_TOKEN permissions be configured?
- What is the principle behind delegated security administration?
- When is dismissing an alert appropriate?