Skip to content

Add PSScriptAnalyzer and OpenGrep security workflows#1776

Open
SamErde wants to merge 5 commits into
mainfrom
samerde/scaling-meme
Open

Add PSScriptAnalyzer and OpenGrep security workflows#1776
SamErde wants to merge 5 commits into
mainfrom
samerde/scaling-meme

Conversation

@SamErde
Copy link
Copy Markdown
Contributor

@SamErde SamErde commented May 12, 2026

Summary

Adds two new code scanning workflows to address gaps in static analysis coverage identified during a review of open code scanning alerts.

File Trigger Purpose
.github/workflows/psscriptanalyzer.yml push/PR to main (PowerShell paths only), weekly schedule, manual PowerShell SAST — closes a gap left by CodeQL, which does not support PowerShell
.github/workflows/opengrep.yml workflow_dispatch only Secondary SAST for JS/TS/YAML/etc., manual evaluation phase before any automatic trigger is considered

Why PSScriptAnalyzer

CodeQL does not support PowerShell, so the existing codeql.yml (which scans actions + javascript-typescript) leaves the bulk of the project — the PowerShell module under powershell/, plus build/tooling scripts under build/ and tools/ — without static analysis. PSScriptAnalyzer is Microsoft's official open-source PowerShell linter and supports SARIF output for native GitHub code scanning integration.

Path-filtered triggers: the workflow only runs on push/PR to main when files matching **/*.ps1, **/*.psm1, **/*.psd1, or **/*.ps1xml change (or the workflow itself), keeping CI noise low. The recursive scan from the repo root naturally covers powershell/, tools/, build/, and any future PowerShell anywhere in the repo, since PSScriptAnalyzer ignores non-PowerShell files automatically.

Why OpenGrep (and why manual-only)

OpenGrep is an LGPL 2.1 fork of Semgrep CE, created in early 2025 and backed by a consortium of 10+ AppSec vendors (Aikido, Endor Labs, Orca, Mobb, Jit, Phoenix, etc.) after Semgrep moved key engine features behind a commercial license. It is rule-compatible with Semgrep — the same p/security-audit, p/javascript, p/typescript, and p/github-actions rule packs run unchanged — so swapping back to Semgrep later is a one-line change if needed.

For an open-source security project like Maester, OpenGrep's purely-open-source mission is a closer philosophical fit. The workflow is gated to workflow_dispatch only so we can evaluate signal-to-noise before committing to automatic runs on every PR. Inputs let you pick the OpenGrep version and rule set per run.

Conventions

Both workflows follow existing repo patterns:

  • All third-party actions pinned to commit SHAs with # vX.Y.Z comments
  • permissions: {} default-deny at workflow level, with minimal per-job grants
  • Concurrency groups with cancel-in-progress on PRs (PSScriptAnalyzer)
  • SARIF upload via the same github/codeql-action/upload-sarif@<sha> action already used by scorecard.yml

Related alerts

Helps address Scorecard SAST coverage signals and reduces the PowerShell static-analysis blind spot that has not been previously visible in code scanning.


Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com

Adds two new code scanning workflows to close gaps identified in the

open Scorecard SAST alert and the lack of PowerShell static analysis:

- psscriptanalyzer.yml (active): Runs PSScriptAnalyzer on push/PR to

  main when PowerShell files (*.ps1, *.psm1, *.psd1, *.ps1xml) change,

  on a weekly schedule, and on demand. CodeQL does not support

  PowerShell, so this fills the gap for the module's core code under

  powershell/, tools/, and build/.

- opengrep.yml (manual eval only): Runs OpenGrep (LGPL fork of

  Semgrep CE) via workflow_dispatch with configurable rule packs and

  version. Workflow is disabled from automatic triggers while we

  evaluate signal vs. noise; switching to Semgrep is a one-line change

  if needed (rule-compatible).

Both workflows follow existing repo conventions: SHA-pinned actions

with version comments, 'permissions: {}' default-deny with per-job

grants, and concurrency groups.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 12, 2026 16:42
@SamErde SamErde requested a review from a team as a code owner May 12, 2026 16:42
@codacy-production
Copy link
Copy Markdown

codacy-production Bot commented May 12, 2026

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds two new GitHub code scanning workflows to expand static analysis coverage: PSScriptAnalyzer for PowerShell (auto-triggered with path filters + schedule) and OpenGrep as a manual-only evaluation workflow for broader SAST rulesets.

Changes:

  • Introduces a PSScriptAnalyzer workflow that runs on PRs/pushes affecting PowerShell files, plus a weekly schedule, and uploads SARIF to Code Scanning.
  • Introduces a manual workflow_dispatch OpenGrep workflow that installs OpenGrep, runs selected rule packs, and uploads SARIF results.

Reviewed changes

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

File Description
.github/workflows/psscriptanalyzer.yml Adds a PowerShell-focused SARIF-producing scan on PR/push (path-filtered), schedule, and manual trigger.
.github/workflows/opengrep.yml Adds a manual-only OpenGrep scan with configurable version/ruleset and SARIF upload to GitHub code scanning.

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

Comment thread .github/workflows/opengrep.yml Outdated
Comment thread .github/workflows/opengrep.yml Outdated
Comment thread .github/workflows/opengrep.yml Outdated
Comment thread .github/workflows/psscriptanalyzer.yml Outdated
@github-advanced-security
Copy link
Copy Markdown
Contributor

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.

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented May 12, 2026

Deploying maester with  Cloudflare Pages  Cloudflare Pages

Latest commit: e4e5f8c
Status: ✅  Deploy successful!
Preview URL: https://5f0b7f1d.maester.pages.dev
Branch Preview URL: https://samerde-scaling-meme.maester.pages.dev

View logs

SamErde and others added 3 commits May 12, 2026 13:50
- psscriptanalyzer.yml: use POSIX path '.' (not '.\') since job runs on ubuntu-latest

- opengrep.yml: replace 'curl | bash' installer with pinned release binary download from GitHub Releases (better supply-chain integrity)

- opengrep.yml: use bash array for --config args (avoid word-splitting)

- opengrep.yml: replace '|| true' with continue-on-error + if: always() and hashFiles guard on SARIF upload

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

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

Comment thread .github/workflows/opengrep.yml Outdated
Comment thread .github/workflows/opengrep.yml
- Update opengrep_version description to reflect the pinned default
  rather than incorrectly suggesting that a blank value installs latest.
- Add opengrep_sha256 input and a built-in checksum for the default
  v1.21.0 release. The install step now verifies the downloaded binary
  with sha256sum before executing it, and refuses to install an
  overridden version unless the caller also supplies a matching SHA256.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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