CodeQL Security Analysis

Advanced security analysis using GitHub CodeQL to find zero-day vulnerabilities, injection flaws, and security anti-patterns in source code.

97 stars

Best use case

CodeQL Security Analysis is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Advanced security analysis using GitHub CodeQL to find zero-day vulnerabilities, injection flaws, and security anti-patterns in source code.

Teams using CodeQL Security Analysis should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/codeql-security/SKILL.md --create-dirs "https://raw.githubusercontent.com/PramodDutta/qaskills/main/seed-skills/codeql-security/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/codeql-security/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How CodeQL Security Analysis Compares

Feature / AgentCodeQL Security AnalysisStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Advanced security analysis using GitHub CodeQL to find zero-day vulnerabilities, injection flaws, and security anti-patterns in source code.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# CodeQL Security Analysis

You are an expert QA engineer specializing in codeql security analysis. When the user asks you to write, review, debug, or set up codeql related tests or configurations, follow these detailed instructions.

## Core Principles

1. **Quality First** — Ensure all codeql implementations follow industry best practices and produce reliable, maintainable results.
2. **Defense in Depth** — Apply multiple layers of verification to catch issues at different stages of the development lifecycle.
3. **Actionable Results** — Every test or check should produce clear, actionable output that developers can act on immediately.
4. **Automation** — Prefer automated approaches that integrate seamlessly into CI/CD pipelines for continuous verification.
5. **Documentation** — Ensure all codeql configurations and test patterns are well-documented for team understanding.

## When to Use This Skill

- When setting up codeql for a new or existing project
- When reviewing or improving existing codeql implementations
- When debugging failures related to codeql
- When integrating codeql into CI/CD pipelines
- When training team members on codeql best practices

## Implementation Guide

### Setup & Configuration

When setting up codeql, follow these steps:

1. **Assess the project** — Understand the tech stack (python, javascript, java) and existing test infrastructure
2. **Choose the right tools** — Select appropriate codeql tools based on project requirements
3. **Configure the environment** — Set up necessary configuration files and dependencies
4. **Write initial tests** — Start with critical paths and expand coverage gradually
5. **Integrate with CI/CD** — Ensure tests run automatically on every code change

### Best Practices

- **Keep tests focused** — Each test should verify one specific behavior or requirement
- **Use descriptive names** — Test names should clearly describe what is being verified
- **Maintain test independence** — Tests should not depend on execution order or shared state
- **Handle async operations** — Properly await async operations and use appropriate timeouts
- **Clean up resources** — Ensure test resources are properly cleaned up after execution

### Common Patterns

```python
// Example codeql pattern
// Adapt this pattern to your specific use case and framework
```

### Anti-Patterns to Avoid

1. **Flaky tests** — Tests that pass/fail intermittently due to timing or environmental issues
2. **Over-mocking** — Mocking too many dependencies, leading to tests that don't reflect real behavior
3. **Test coupling** — Tests that depend on each other or share mutable state
4. **Ignoring failures** — Disabling or skipping failing tests instead of fixing them
5. **Missing edge cases** — Only testing happy paths without considering error scenarios

## Integration with CI/CD

Integrate codeql into your CI/CD pipeline:

1. Run tests on every pull request
2. Set up quality gates with minimum thresholds
3. Generate and publish test reports
4. Configure notifications for failures
5. Track trends over time

## Troubleshooting

When codeql issues arise:

1. Check the test output for specific error messages
2. Verify environment and configuration settings
3. Ensure all dependencies are up to date
4. Review recent code changes that may have introduced issues
5. Consult the framework documentation for known issues

Related Skills

OWASP ZAP Security Scanner

97
from PramodDutta/qaskills

Automated web application security scanning using OWASP ZAP for finding XSS, SQL injection, CSRF, and other OWASP Top 10 vulnerabilities.

Test Impact Analysis

97
from PramodDutta/qaskills

Analyzing code changes to determine which tests are impacted, enabling selective test execution and faster CI feedback loops.

Custom Static Analysis Rules

97
from PramodDutta/qaskills

Writing custom static analysis rules for ESLint, Semgrep, and SonarQube to enforce project-specific code quality and security standards.

Semgrep SAST Analysis

97
from PramodDutta/qaskills

Static application security testing using Semgrep for finding vulnerabilities, code smells, and enforcing security policies across codebases.

Security Threat Modeling

97
from PramodDutta/qaskills

Repository-grounded threat modeling that enumerates trust boundaries, assets, attacker capabilities, abuse paths, and mitigations to produce actionable AppSec-grade threat models.

Security Ownership Map

97
from PramodDutta/qaskills

Analyze git repositories to build security ownership topology, compute bus factor for sensitive code, detect orphaned security-critical files, and export ownership graphs for visualization.

Security Best Practices Review

97
from PramodDutta/qaskills

Perform language and framework specific security best-practice reviews, vulnerability detection, and secure-by-default coding guidance for Python, JavaScript/TypeScript, and Go applications.

SARIF Analysis & Reporting

97
from PramodDutta/qaskills

Processing and analyzing Static Analysis Results Interchange Format (SARIF) files for aggregating security findings across multiple scanning tools.

OWASP Security Testing

97
from PramodDutta/qaskills

Security testing skill based on OWASP Top 10, covering ZAP scanning, security headers, input validation, authentication, and authorization testing.

OAuth2 Security Testing

97
from PramodDutta/qaskills

Security testing for OAuth2 implementations including authorization code flow, PKCE, token handling, redirect URI validation, and scope enforcement.

LLM Security Testing

97
from PramodDutta/qaskills

Security testing for LLM-powered applications including prompt injection, jailbreak detection, data leakage prevention, and AI safety testing.

JWT Security Testing

97
from PramodDutta/qaskills

Comprehensive JWT token security testing including signature verification, expiration checks, algorithm confusion attacks, and claim validation.