Skip to content

Add CodeQL#201

Closed
jschlyter wants to merge 1 commit into
mainfrom
feature/codeql
Closed

Add CodeQL#201
jschlyter wants to merge 1 commit into
mainfrom
feature/codeql

Conversation

@jschlyter
Copy link
Copy Markdown
Member

@jschlyter jschlyter commented Aug 15, 2025

Summary by CodeRabbit

  • Chores
    • Added a new GitHub Actions workflow (“CodeQL Advanced”) to run CodeQL analysis.
    • Triggers on pushes and pull requests to the main branch and via a weekly schedule.
    • Executes a matrix across Actions and Python, with appropriate runner selection.
    • Configures required permissions and runs initialization and analysis steps.
    • Includes guidance for manual build-mode scenarios.
    • No user-facing changes.

@jschlyter jschlyter requested a review from a team as a code owner August 15, 2025 07:46
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Aug 15, 2025

Walkthrough

Adds a new GitHub Actions workflow (.github/workflows/codeql.yml) named “CodeQL Advanced” to run CodeQL analysis on push, pull_request to main, and a weekly cron. It defines a single matrix job over languages (actions, python), initializes CodeQL with build-mode none, and runs the analyze step with appropriate permissions.

Changes

Cohort / File(s) Change Summary
CI/CD – CodeQL Workflow
.github/workflows/codeql.yml
Introduces a CodeQL analysis workflow with matrix over languages (actions, python), scheduled and event triggers, permissions setup, init/analyze steps, optional query configuration comments, and conditional guidance for manual build-mode.

Sequence Diagram(s)

sequenceDiagram
  participant Dev as Developer
  participant GH as GitHub Actions
  participant Init as CodeQL Init Action
  participant Build as Build-Mode Check
  participant Analyze as CodeQL Analyze Action
  participant Sec as Security Events

  Dev->>GH: Push/PR to main or weekly cron
  GH->>Init: Initialize CodeQL (language matrix, build-mode: none)
  Init-->>GH: Setup complete
  GH->>Build: Check for manual build-mode
  Build-->>GH: Skip (build-mode none)
  GH->>Analyze: Run CodeQL analyze with category
  Analyze-->>Sec: Upload SARIF security results
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~7 minutes

Poem

I thump my paws—secure and keen,
New scans patrol our code unseen.
On nightly winds the queries flow,
They sniff the burrows, high and low.
With whiskers twitch, I proudly tell:
Our warren’s safe—thanks, CodeQL! 🐰🛡️

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/codeql

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-advanced-security
Copy link
Copy Markdown

This pull request sets up GitHub code scanning for this repository. Once the scans have completed and the checks have passed, the analysis results for this pull request branch will appear on this overview. Once you merge this pull request, the 'Security' tab will show more code scanning analysis results (for example, for the default branch). Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results. For more information about GitHub code scanning, check out the documentation.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (5)
.github/workflows/codeql.yml (5)

14-21: Add manual trigger for operational flexibility (workflow_dispatch)

Enabling manual runs is useful for ad-hoc investigations or validating CodeQL config changes without pushing/PRs.

Apply this diff to add a manual trigger:

 on:
   push:
     branches: [ "main" ]
   pull_request:
     branches: [ "main" ]
   schedule:
     - cron: '23 23 * * 6'
+  workflow_dispatch:

30-30: Simplify runs-on expression

Since the matrix currently contains only actions and python, the Swift condition is unnecessary noise. Simplify to ubuntu-latest.

-    runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
+    runs-on: ubuntu-latest

31-41: Tighten permissions slightly (drop packages: read unless using private CodeQL packs)

If you aren't pulling private packs from GitHub Packages, you can remove packages: read to reduce scope. Keep contents: read (needed for checkout) and actions: read (needed for Actions analysis, especially in private repos).

     permissions:
       # required for all workflows
       security-events: write

-      # required to fetch internal or private CodeQL packs
-      packages: read
-
       # only required for workflows in private repositories
       actions: read
       contents: read

59-61: Fetch more history for better PR baselines

Fetching at least the merge base improves CodeQL’s ability to attribute and suppress alerts accurately on pull requests.

 - name: Checkout repository
   uses: actions/checkout@v4
+  with:
+    # Fetch enough history to compute accurate PR baselines (0 = full history)
+    fetch-depth: 2

68-80: Enable extended and quality queries

Broaden coverage by including security-extended and security-and-quality query suites. Prefix with + to merge with any future config file.

       with:
         languages: ${{ matrix.language }}
         build-mode: ${{ matrix.build-mode }}
         # If you wish to specify custom queries, you can do so here or in a config file.
         # By default, queries listed here will override any specified in a config file.
         # Prefix the list here with "+" to use these queries and those in the config file.
 
         # For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
-        # queries: security-extended,security-and-quality
+        queries: +security-extended,security-and-quality
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between f870ee2 and db4197f.

📒 Files selected for processing (1)
  • .github/workflows/codeql.yml (1 hunks)
🔇 Additional comments (3)
.github/workflows/codeql.yml (3)

22-29: Solid baseline: matrix job, least-privilege permissions, and v3 CodeQL actions look good

Nice, clean setup for multi-language analysis with sensible defaults. Using v3 actions and job-level permissions is aligned with current best practices.


97-101: Analyze step is correctly configured

Category scoping per language and v3 action are correct.


42-50: CodeQL matrix OK — only Actions + Python needed

Scanned the repo: 12 Python files; 0 JavaScript/TypeScript, Go, Ruby, Java/Kotlin, C/C++, Rust, or Swift files. No package.json/package-lock.json/yarn.lock/pnpm-lock.yaml/tsconfig.json/go.mod/Cargo.toml/pom.xml/build.gradle(.kts)/Gemfile/Package.swift found.

  • Workflows present: .github/workflows/container.yml, .github/workflows/test.yml, .github/workflows/codeql.yml
  • File under review: .github/workflows/codeql.yml — current matrix (actions + python) is correct; no changes required.

@jschlyter jschlyter closed this Aug 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants