Skip to content

Add CodeQL config file to only run the scan for production code#1680

Draft
anupsdf wants to merge 2 commits into
stellar:mainfrom
anupsdf:codeql
Draft

Add CodeQL config file to only run the scan for production code#1680
anupsdf wants to merge 2 commits into
stellar:mainfrom
anupsdf:codeql

Conversation

@anupsdf

@anupsdf anupsdf commented Apr 17, 2026

Copy link
Copy Markdown
Contributor

What

Add CodeQL config file to only run the scan for production code

Why

Current CodeQL scan has tagged a lot of test files that we can ignore

Copilot AI review requested due to automatic review settings April 17, 2026 18:24
@anupsdf
anupsdf enabled auto-merge April 17, 2026 18:25
pull_request:
branches: [main]
schedule:
- cron: "0 6 * * 1"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Runs at 6:00 every Monday.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds a GitHub CodeQL workflow and configuration intended to reduce noise by limiting scanning to “production” Rust source directories (excluding tests/benches/fuzz/etc.).

Changes:

  • Introduces a new .github/workflows/codeql.yml CodeQL workflow for Rust and Actions.
  • Adds .github/codeql/codeql-config.yml to restrict CodeQL scanning to selected crate src directories and ignore non-production paths.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
.github/workflows/codeql.yml New CodeQL workflow that initializes and runs CodeQL analysis, with a manual Rust build step and a shared config file.
.github/codeql/codeql-config.yml CodeQL configuration limiting scanned paths to specific Rust crate src directories and ignoring non-production directories.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +7 to +15
paths:
- soroban-builtin-sdk-macros/src
- soroban-env-common/src
- soroban-env-guest/src
- soroban-env-host/src
- soroban-env-macros/src
- soroban-simulation/src
- soroban-synth-wasm/src
- soroban-test-wasms/src

Copilot AI Apr 17, 2026

Copy link

Choose a reason for hiding this comment

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

The workflow matrix includes language: actions, but the referenced CodeQL config-file restricts paths to Rust crate */src directories only. That likely excludes .github/workflows/**, so the Actions CodeQL run may analyze zero files. Consider either adding .github/workflows (or .github) to paths, or splitting per-language configs / removing the actions language entry.

Copilot uses AI. Check for mistakes.
Comment on lines +3 to +7
on:
pull_request:
branches: [main]
schedule:
- cron: "0 6 * * 1"

Copilot AI Apr 17, 2026

Copy link

Choose a reason for hiding this comment

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

This workflow only runs on push to main and on a schedule. If you want CodeQL results to show up on pull requests before merge (as the Rust CI does), add a pull_request (and possibly merge_group) trigger.

Copilot uses AI. Check for mistakes.

- name: Build (Rust)
if: matrix.language == 'rust'
run: cargo build --workspace --all-features

Copilot AI Apr 17, 2026

Copy link

Choose a reason for hiding this comment

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

For consistency with the repo’s CI (e.g., .github/workflows/rust.yml uses --locked), consider running the CodeQL build step with cargo build --locked ... so the analysis fails if Cargo.lock is out of date instead of silently updating dependencies.

Suggested change
run: cargo build --workspace --all-features
run: cargo build --locked --workspace --all-features

Copilot uses AI. Check for mistakes.
@anupsdf
anupsdf marked this pull request as draft April 17, 2026 21:34
auto-merge was automatically disabled April 17, 2026 21:34

Pull request was converted to draft

@kanwalpreetd

Copy link
Copy Markdown

https://github.com/stellar/rs-soroban-env/actions/runs/24580520681/job/71876873614?pr=1680 is failing because default setup needs to be removed for advanced setup to run: Go to Settings->Advanced Security->Code Security->CodeQL analysis and select Switch to Advanced

name: "CodeQL"

on:
pull_request:

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is for testing if the job runs. Final version will just have a cron job.

@anupsdf

anupsdf commented Apr 20, 2026

Copy link
Copy Markdown
Contributor Author

https://github.com/stellar/rs-soroban-env/actions/runs/24580520681/job/71876873614?pr=1680 is failing because default setup needs to be removed for advanced setup to run: Go to Settings->Advanced Security->Code Security->CodeQL analysis and select Switch to Advanced

Looks like I don't have permissions to Advanced Security under Settings tab of the Repo. @kanwalpreetd, Maybe you have permissions to change it?

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.

3 participants