Skip to content

ci: scan fork pull requests with CodeQL - #220

Merged
synackd merged 1 commit into
mainfrom
ci/fix-codeql
Oct 26, 2026
Merged

synackd merged 1 commit into
mainfrom
ci/fix-codeql

Conversation

@synackd

@synackd synackd commented Oct 23, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Fork pull requests can wait indefinitely for CodeQL results: GitHub's default setup excludes forks, while this repository's Pass CI before merge ruleset requires CodeQL analysis. PR #214 exhibited this behavior without any CodeQL run for its head or merge commit.

Add an explicit CodeQL workflow that scans Go, Python, and GitHub Actions on pull requests targeting main, pushes to main, and a weekly schedule. Allow manual runs to refresh the baseline. Use pull_request so fork scans can upload results with a read-only token, install Go from go.mod, build all Go packages, and pin actions to commit hashes.

Add .github/workflows/codeql.md alongside the workflow to explain the cause, migration to advanced setup, baseline verification, and recovery steps for existing fork PRs.

Deployment

  1. In Settings → Advanced Security → CodeQL analysis, switch to advanced setup and disable default setup; default setup blocks custom CodeQL uploads.
  2. Merge this workflow and verify all three analyses succeed on main to establish the baseline. The initial migration may require the existing administrator bypass if CodeQL blocks it.
  3. Update existing fork PR branches with main and approve contributor workflow runs when prompted.

Keep the existing CodeQL ruleset requirement enabled. No additional fork token permissions are needed.

Validation

  • Workflow YAML parsing, SPDX checks (reuse lint-file), and git diff --check passed.
  • Actionlint could not run because downloading it failed with a DNS error.
  • Full CodeQL analysis and fork uploads must be verified on GitHub after switching to advanced setup; repository settings have not been changed.
  • No Go source changes or new unit tests. The migration and fork PR recovery steps are documented in .github/workflows/codeql.md.

Checklist

  • My code follows the style guidelines of this project
  • I have added/updated comments where needed
  • I have added tests that prove my fix is effective or my feature works
  • I have run make test (or equivalent) locally and all tests pass
  • I have updated the relevant documentation (CLI examples, man pages, README, other docs, etc.)
  • DCO Sign-off: All commits are signed off (git commit -s) with my real name and email
  • REUSE Compliance:
    • Each new/modified source file has SPDX copyright and license headers
    • Any non-commentable files include a <filename>.license sidecar (not applicable)
    • All referenced licenses are present in the LICENSES/ directory

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update
  • Dependency update
  • Build system/CI

seantronsen
seantronsen previously approved these changes Oct 26, 2026

@seantronsen seantronsen 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.

🪨

Comment thread .github/workflows/codeql.yml Resolved
@seantronsen

Copy link
Copy Markdown
Contributor

This might be good to add into the actions repo at some point. I've created OpenCHAMI/github-actions#57 to track it, but I have to focus on getting v4 and the signing stuff out the door first.

Replace default setup with an explicit workflow so fork pull requests
produce the CodeQL results required by the merge ruleset. Default setup
excludes forks, leaving their code scanning gate waiting indefinitely.

Scan Go, Python, and GitHub Actions on pull requests and main pushes,
and schedule weekly scans to refresh results as queries evolve. Allow
manual runs to establish or refresh the main branch baseline.

Build Go packages with the toolchain declared in go.mod. Pin actions to
commit hashes and use the pull_request event so fork analysis can upload
results with a read-only token without privileged fork execution.

Add the setup guide beside the workflow to explain the migration to
advanced setup, baseline verification, and recovery of existing fork
pull requests. Disable default setup during deployment because it blocks
uploads from explicit CodeQL workflows.

Signed-off-by: Devon Bautista <17506592+synackd@users.noreply.github.com>
Comment thread .github/workflows/codeql.md Resolved

@seantronsen seantronsen 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.

🪨 take-two

@synackd

synackd commented Oct 26, 2026

Copy link
Copy Markdown
Collaborator Author

Whew... Third time is the charm retrying the coverage job. Anyhow, thanks for the review!

@synackd
synackd merged commit 7582113 into main Oct 26, 2026
19 of 21 checks passed
@synackd
synackd deleted the ci/fix-codeql branch October 26, 2026 18:29
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