Schedule icon
Script icon
If icon
Create icon
SlackIncomingWebhook icon
Log icon

GitHub CodeQL Code Scanning Critical Alert Sentinel

Monitor GitHub CodeQL code scanning security alerts with Kestra. Query GitHub REST API, open AppSec tracking issues, and alert Slack.

Categories
CoreInfrastructure

GitHub Advanced Security and CodeQL static application security testing (SAST) continuously scan source code for SQL injection, remote code execution (RCE), cross-site scripting (XSS), and path traversal vulnerabilities. When developers merge branches without addressing security findings, critical flaws reach production deployments. This blueprint queries GitHub's Code Scanning API daily, aggregates unresolved Critical and High vulnerabilities, generates an automated GitHub AppSec tracking ticket with file locations and rule descriptions, and notifies security engineering teams via Slack.

How it works

  1. daily_code_scanning_audit (io.kestra.plugin.core.trigger.Schedule) initiates the audit daily at 07:00 UTC (shipped disabled for safe verification).
  2. probe_codeql_alerts (io.kestra.plugin.scripts.python.Script) interrogates the GitHub Code Scanning API (GET /repos/{owner}/{repo}/code-scanning/alerts), filtering for open alerts with severity critical or high.
  3. branch_on_security_findings (io.kestra.plugin.core.flow.If) evaluates whether any critical or high alerts exist (has_critical == true):
    • then: Automatically files a GitHub tracking issue via create_appsec_incident_issue (io.kestra.plugin.github.issues.Create) and alerts the Slack channel via alert_appsec_slack (io.kestra.plugin.slack.notifications.SlackIncomingWebhook).
    • else: Emits an informational log entry (log_repo_compliant) confirming clean security posture.
  4. log_audit_complete (io.kestra.plugin.core.log.Log) records the final audit outcome.
  5. The errors block alerts Slack if GitHub API limits are reached or tokens expire.

What you get

  • Automated, scheduled auditing of repository application security posture.
  • Zero ignored CodeQL alerts lingering across production microservice repos.
  • Consolidated GitHub incident tickets with rule IDs, source code paths, and lines.
  • Real-time Slack notifications with direct ticket hyperlinks.

Who it's for

  • Application Security (AppSec) and DevSecOps Engineers governing repository code health.
  • Platform Engineering leads enforcing secure coding standards before production releases.
  • Software Development Managers tracking vulnerability resolution velocity.

Why orchestrate this with Kestra

Kestra coordinates external API polling, vulnerability data extraction, conditional escalation, and chat alerting inside a single declarative workflow. It manages personal access tokens securely, provides complete execution history, and eliminates the need for separate standalone monitoring daemons.

Prerequisites

  • A GitHub repository with GitHub Code Scanning (CodeQL or third-party SARIF scanner) enabled.
  • A GitHub Personal Access Token or GitHub App token with security_events:read and repo permissions.
  • A Slack incoming webhook URL for notifications.

Secrets

  • GITHUB_TOKEN: GitHub token used to query code scanning alerts and open tracking issues.
  • SLACK_WEBHOOK: Incoming Webhook URL for security alerts.

Inputs

  • repository (STRING, default my-org/production-api): Target GitHub repository (owner/repo) to audit.
  • target_issue_repository (STRING, default my-org/appsec-operations): Target repository where security tracking issues will be filed.

Outputs

  • outputs.probe_codeql_alerts.vars.critical_count: Count of open critical-severity alerts.
  • outputs.probe_codeql_alerts.vars.high_count: Count of open high-severity alerts.
  • outputs.probe_codeql_alerts.vars.total_alerts: Total number of unresolved findings.

Quick start

  1. Configure GITHUB_TOKEN and SLACK_WEBHOOK in your Kestra namespace.
  2. Import this flow and set repository to match an active scanned codebase.
  3. Run the flow manually to verify alert extraction and Slack notification delivery.
  4. Enable the daily_code_scanning_audit trigger for continuous code security monitoring.

How to extend

  • Add an automated branch protection or deployment gate to block production merges if critical alerts remain open.
  • Integrate with Jira or ServiceNow to create enterprise vulnerability tickets.
  • Loop over all repositories in an organization using io.kestra.plugin.core.flow.Loop.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.