
Implementing GitHub Advanced Security
FreeAutomate code scanning and vulnerability detection at scale.
Free · Opens the source repo
What Implementing GitHub Advanced Security does
Implementing GitHub Advanced Security for Code Scanning provides a robust solution for integrating security into your software development lifecycle. This skill leverages CodeQL, a powerful static application security testing engine, to analyze code for vulnerabilities. By treating code as data, CodeQL enables a deeper semantic analysis that can identify issues such as SQL injection, cross-site scripting, and buffer overflows with reduced false positives compared to traditional scanners. This skill is essential for organizations looking to enhance their security posture through continuous integration and deployment workflows.
The skill is particularly useful for enterprises that require automated static analysis across multiple repositories. It supports both default and advanced setups, allowing teams to choose between quick deployment with minimal configuration or a more tailored approach that includes custom queries and CI integration. The default setup is ideal for rapid onboarding, while the advanced setup caters to complex environments, such as those with monorepos or specific security requirements.
Additionally, this skill facilitates organization-wide rollout of security practices, enabling administrators to manage code scanning settings across all repositories efficiently. With features like secret scanning, dependency review, and Dependabot alerts, it provides a comprehensive security framework that aligns with compliance needs and enhances overall software security. This makes it suitable for developers and security teams focused on shifting security left in their development processes.
By integrating this skill into your GitHub workflows, you can ensure that security is an integral part of your development process, helping to identify and mitigate vulnerabilities before they reach production.
When to use it
Use this skill when deploying GitHub Advanced Security for code scanning in your organization, especially when establishing security controls or improving security architecture.
When not to use it
This skill may not be suitable for teams without GitHub Enterprise or those not familiar with GitHub Actions workflow syntax, as it requires specific permissions and setup.
What you can build with it
Enterprise Security Rollout
Use this skill to configure GitHub Advanced Security across multiple repositories in an enterprise, ensuring consistent security practices.
Custom Security Assessments
Implement this skill to conduct security assessments that require tailored CodeQL queries and specific compliance controls.
Integrating Security into CI/CD
Utilize this skill to automate code scanning within your CI/CD pipelines, shifting security left and catching vulnerabilities early.
How to install Implementing GitHub Advanced Security
View source1. Install with the skills CLI
npx skills add mukul975/anthropic-cybersecurity-skills/implementing-github-advanced-security-for-code-scanning --agent claude-code2. Or install it manually
Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.
Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs
Inside SKILL.md
Written by mukul975Implementing GitHub Advanced Security for Code Scanning
Overview
GitHub Advanced Security (GHAS) integrates CodeQL-powered static application security testing directly into the GitHub development workflow. CodeQL treats code as data, enabling semantic analysis that identifies security vulnerabilities such as SQL injection, cross-site scripting, buffer overflows, and authentication flaws with significantly fewer false positives than traditional pattern-matching scanners. GHAS encompasses code scanning, secret scanning, dependency review, and Dependabot alerts to provide a comprehensive security posture for repositories.
When to Use
- When deploying or configuring implementing github advanced security for code scanning capabilities in your environment
- When establishing security controls aligned to compliance requirements
- When building or improving security architecture for this domain
- When conducting security assessments that require this implementation
Prerequisites
- GitHub Enterprise Cloud or GitHub Enterprise Server 3.0+ with GHAS license
- Repository admin or organization owner permissions
- Familiarity with GitHub Actions workflow syntax (YAML)
- Supported languages: C/C++, C#, Go, Java/Kotlin, JavaScript/TypeScript, Python, Ruby, Swift
Core Concepts
CodeQL Analysis Engine
CodeQL compiles source code into a queryable database, then executes security-focused queries against that database. The query suites ship with hundreds of checks mapped to CWE identifiers and cover OWASP Top 10, SANS Top 25, and language-specific vulnerability patterns. Custom queries can be authored using the CodeQL query language (QL) to detect organization-specific anti-patterns.
Default Setup vs. Advanced Setup
Default Setup enables code scanning with a single click from the repository's Code Security settings. GitHub automatically determines the languages present, selects appropriate query suites, and configures scanning triggers. This approach requires no workflow file and is ideal for rapid onboarding.
Advanced Setup generates a .github/workflows/codeql.yml workflow file that can be customized. Teams control scheduling, language matrices, build commands for compiled languages, additional query packs, and integration with third-party SARIF producers. Advanced setup is required when custom build steps, monorepo configurations, or private query packs are needed.
Organization-Wide Rollout
For enterprises managing hundreds of repositories, GHAS supports configuring code scanning at scale using the organization-level security overview. Administrators can enable default setup across all eligible repositories, define custom security configurations, and monitor adoption through the security coverage dashboard.
Workflow
Step 1 --- Enable GHAS on the Organization
- Navigate to Organization Settings > Code security and analysis
- Enable GitHub Advanced Security for all repositories or selected repositories
- Confirm license seat allocation (GHAS is billed per active committer)
Step 2 --- Configure Default Setup for Quick Wins
- Go to Repository Settings > Code security > Code scanning
- Click "Set up" in the CodeQL analysis row and select "Default"
- Review the auto-detected languages and query suite (default or extended)
- Click "Enable CodeQL" to activate scanning on push and pull request events
Step 3 --- Advanced Setup with Custom Workflow
Create .github/workflows/codeql-analysis.yml:
name: "CodeQL Analysis"
on:
push:
branches: [main, develop]
pull_request:
branches: [main]
schedule:
- cron: '30 2 * * 1' # Weekly Monday 2:30 AM UTC
jobs:
analyze:
name: Analyze (${{ matrix.language }})
runs-on: ubuntu-latest
permissions:
security-events: write
contents: read
actions: read
strategy:
fail-fast: false
matrix:
language: ['javascript-typescript', 'python', 'java-kotlin']
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
queries: +security-extended,security-and-quality
# For compiled languages, add build commands below
- name: Autobuild
uses: github/codeql-action/autobuild@v3
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{ matrix.language }}"
Step 4 --- Custom Query Packs
Install organization-specific query packs by referencing them in the workflow:
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: java-kotlin
packs: |
my-org/java-custom-queries@1.0.0
codeql/java-queries:cwe/cwe-089
Step 5 --- Configure Branch Protection Rules
- Navigate to Repository Settings > Branches > Branch protection rules
- Enable "Require status checks to pass" and add the CodeQL analysis check
- Enable "Require code scanning results" and set severity thresholds (e.g., block on High/Critical)
Step 6 --- Secret Scanning and Push Protection
- Enable secret scanning from Code security settings
- Activate push protection to block commits containing detected secrets
- Configure custom patterns for organization-specific secrets (API keys, internal tokens)
Step 7 --- Dependency Review and Dependabot
- Enable Dependabot alerts and security updates
- Configure
.github/dependabot.ymlfor automated dependency version updates - Enable dependency review enforcement on pull requests to block PRs that introduce known vulnerable dependencies
Query Suite Reference
| Suite | Description | Use Case |
|---|---|---|
default | High-confidence security queries | Production scanning with minimal false positives |
security-extended | Broader security queries including lower-severity findings | Comprehensive security coverage |
security-and-quality | Security plus code quality queries | Teams wanting both security and maintainability checks |
| Custom packs | Organization-authored queries | Detecting internal anti-patterns and compliance violations |
Integration with Security Workflows
SARIF Upload from Third-Party Tools
GHAS accepts SARIF (Static Analysis Results Interchange Format) uploads from external tools:
- name: Upload SARIF
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: results.sarif
category: "semgrep"
Security Overview Dashboard
The organization-level security overview provides:
- Risk view showing repositories with open alerts by severity
- Coverage view showing GHAS feature enablement across repositories
- Alert trends over time for tracking remediation progress
- Filter by team, language, and alert type for targeted review
Monitoring and Metrics
- Track mean time to remediate (MTTR) for code scanning alerts
- Monitor false positive rates and tune query configurations accordingly
- Review alert dismissal reasons to identify areas for developer training
- Use the API (
/repos/{owner}/{repo}/code-scanning/alerts) for custom reporting dashboards
Common Pitfalls
- Compiled language build failures --- CodeQL requires successful compilation for C/C++, Java, C#, Go, and Swift; ensure build dependencies are available in the Actions runner
- Ignoring scheduled scans --- Push/PR scanning misses vulnerabilities in dependencies; weekly scheduled scans catch newly disclosed CVEs in existing code
- Over-alerting with security-and-quality --- Start with
defaultsuite and expand gradually to avoid developer alert fatigue - Missing GHAS license seats --- Only active committers to GHAS-enabled repositories consume license seats; plan capacity accordingly
References
Frequently asked questions about Implementing GitHub Advanced Security
Similar skills
CodeQL Code Scanning
Streamline CodeQL setup and configuration for security analysis.
Security Review
AI-powered codebase security scanner for vulnerabilities.
Integrating SAST into GitHub Actions
Automate SAST scanning in GitHub Actions workflows.
Implementing Semgrep for Custom SAST Rules
Enhance code security with custom Semgrep rules.
Infrastructure as Code Security Scanning
Automate security checks for your IaC deployments.
Auditing Foundry Smart Contract Security
Ensure your Solidity contracts are secure before deployment.
