Skip to content

security: add CodeQL and Dependabot automation - #2

Merged
mkarson1997 merged 3 commits into
mainfrom
chore/security-automation
Sep 5, 2026
Merged

mkarson1997 merged 3 commits into
mainfrom
chore/security-automation

Conversation

@mkarson1997

@mkarson1997 mkarson1997 commented Sep 5, 2026

Copy link
Copy Markdown
Owner

Adds Windows-based CodeQL security-extended analysis for the WPF C# codebase, weekly Dependabot coverage for NuGet and GitHub Actions, and scopes CI permissions to the build job for least privilege.

Summary by Sourcery

Strengthen repository security automation and CI permission scoping.

New Features:

  • Add scheduled CodeQL security-extended analysis for the C# codebase on Windows.
  • Add weekly Dependabot updates for NuGet dependencies and GitHub Actions.

Enhancements:

  • Restrict CI workflow permissions to the build job with read-only repository access.

CI:

  • Run CodeQL checks on main pushes, pull requests, and a weekly schedule.

Copilot AI lite review requested due to automatic review settings September 5, 2026 12:05

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@sourcery-ai

sourcery-ai Bot commented Sep 5, 2026

Copy link
Copy Markdown

Reviewer's Guide

Introduces weekly Dependabot updates for NuGet and GitHub Actions, adds Windows/.NET 8 CodeQL security-extended scanning for C#, and applies least-privilege permissions to CI and analysis jobs.

File-Level Changes

Change Details Files
Add scheduled dependency update automation for application and workflow dependencies.
  • Configure weekly NuGet updates from the repository root with a five-PR limit.
  • Configure weekly GitHub Actions updates with a five-PR limit.
.github/dependabot.yml
Add Windows-based CodeQL analysis for the C# codebase across code changes and a weekly scheduled scan.
  • Run security-extended C# analysis on main pushes, main pull requests, and a weekly cron schedule.
  • Build with Windows, .NET 8, and CodeQL autobuild before publishing results.
  • Grant only contents read and security-events write permissions to the analysis job.
.github/workflows/codeql.yml
Scope CI workflow permissions to the build job instead of the workflow level.
  • Retain contents read access only for the Windows build job.
.github/workflows/ci.yml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've found 1 issue

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path=".github/workflows/codeql.yml" line_range="6-7" />
<code_context>
   pull_request:
     branches: [main]

</code_context>
<issue_to_address>
**issue (broader_impact):** CodeQL results from pull requests opened from forks are not uploaded because GitHub withholds `security-events: write` from forked workflows, so the workflow does not provide the advertised PR analysis coverage for external contributions.

**Triggers:** When a pull request originates from a fork.

**Suggested fix:** Add a safe, separately designed privileged reporting workflow or explicitly document that fork pull requests are analyzed without upload; do not switch blindly to `pull_request_target` while executing untrusted checkout code.

```suggestion
  # Fork pull requests are analyzed without uploading CodeQL results because
  # GitHub withholds security-events: write from forked workflows.
  pull_request:
    branches: [main]
```
</issue_to_address>

Sourcery assessment

Needs a human reviewer. 1 finding to address first, and if the workflow or Dependabot configuration is wrong, it could create incorrect dependency-update pull requests or persist inaccurate CodeQL findings and security metadata in GitHub. Reverting removes future automation, but already-created pull requests or findings would need to be closed or cleared separately; the impact is bounded and repairable.

Blocking findings: .github/workflows/codeql.yml:7


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Comment on lines +6 to +7
pull_request:
branches: [main]

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

issue (broader_impact): CodeQL results from pull requests opened from forks are not uploaded because GitHub withholds security-events: write from forked workflows, so the workflow does not provide the advertised PR analysis coverage for external contributions.

Triggers: When a pull request originates from a fork.

Suggested fix: Add a safe, separately designed privileged reporting workflow or explicitly document that fork pull requests are analyzed without upload; do not switch blindly to pull_request_target while executing untrusted checkout code.

Suggested change
pull_request:
branches: [main]
# Fork pull requests are analyzed without uploading CodeQL results because
# GitHub withholds security-events: write from forked workflows.
pull_request:
branches: [main]

@github-advanced-security

Copy link
Copy Markdown

You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool.

What Enabling Code Scanning Means:

  • The 'Security' tab will display more code scanning analysis results (e.g., for the default branch).
  • Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results.
  • You will be able to see the analysis results for the pull request's branch on this overview once the scans have completed and the checks have passed.

For more information about GitHub Code Scanning, check out the documentation.

@mkarson1997
mkarson1997 merged commit ae74a9e into main Sep 5, 2026
4 checks passed
@mkarson1997
mkarson1997 deleted the chore/security-automation branch September 5, 2026 12:10
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