Skip to content

ci: harden GitHub Actions workflows and resolve code-scanning alerts - #284

Merged
jmeridth merged 2 commits into
mainfrom
gha-standards
Jul 12, 2026
Merged

jmeridth merged 2 commits into
mainfrom
gha-standards

Conversation

@jmeridth

Copy link
Copy Markdown
Member

What/Why

Apply least-privilege permissions, harden-runner egress auditing, and PR concurrency across all workflows, and rename them to .yaml, to meet the repo's GitHub Actions standards and clear open code-scanning alerts (#169, #178 missing workflow permissions on ci; #179 unsanitized github.base_ref).

Proof it works

actionlint reports no issues and make test passes. Workflow renames preserve every job id and name:, so the six required status checks (CI, Integration Tests, golang, markdown, auto_labeler / ..., lint_pr_title / ...) keep matching without touching the ruleset.

Risk + AI role

Low -- workflow config and .gitignore only, no application code. Each permission scope, concurrency choice, and the action version pins were reviewed by hand.

Review focus

  • post-merge.yaml contents: write scope for the BYOB badge action -- confirm it is actually required or can drop to read.
  • Concurrency on the pull_request_target workflows (auto-labeler, pr-title) and the intentional omission on release.yaml (releases must not be cancelled mid-run).

## What/Why

Apply least-privilege permissions, harden-runner egress auditing, and PR
concurrency across all workflows, and rename them to .yaml, to meet the repo's
GitHub Actions standards and clear open code-scanning alerts.

## Proof it works

actionlint clean, golangci-lint run 0 issues, make test passes. Renames
preserve every job id and name:, so the six required status checks keep
matching.

## Risk + AI role

Low -- workflow config only, no application code. AI-generated (Claude Opus 4.8)
with human review of each permission scope and concurrency decision.

## Review focus

- post-merge.yaml contents: write scope for the BYOB badge action -- confirm it
  is actually required.
- Concurrency on pull_request_target workflows and the intentional omission on
  release.yaml.

Resolves code-scanning alerts #169, #178 (missing workflow permissions on ci)
and #179 (unsanitized github.base_ref).

Signed-off-by: jmeridth <jmeridth@gmail.com>
@jmeridth jmeridth self-assigned this Jul 11, 2026
@jmeridth
jmeridth marked this pull request as ready for review July 11, 2026 03:07
@jmeridth
jmeridth requested review from a team and Copilot July 11, 2026 03:07

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

This PR hardens the repository’s GitHub Actions workflows by applying least-privilege permissions, adding runner egress auditing, introducing concurrency controls (where appropriate), and renaming workflows from .yml to .yaml to align with repository standards and address code-scanning findings.

Changes:

  • Apply default-deny workflow permissions (permissions: {}) and set job-scoped permissions per workflow needs.
  • Add step-security/harden-runner with egress-policy: audit and add PR concurrency to reduce redundant CI runs.
  • Rename pr-title workflow from .yml to .yaml, preserving job IDs/names for required checks.

Reviewed changes

Copilot reviewed 10 out of 11 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
.gitignore Ignore .worktrees/ directory for local git worktree usage.
.github/workflows/security-insights.yaml Add least-privilege permissions, concurrency, and harden-runner auditing.
.github/workflows/release.yaml Default-deny permissions at workflow level; minor hardening of $GITHUB_OUTPUT writes.
.github/workflows/pr-title.yml Rename/remove old .yml workflow file.
.github/workflows/pr-title.yaml Add renamed workflow with least-privilege permissions and concurrency.
.github/workflows/post-merge.yaml Default-deny permissions and add harden-runner; scope contents: write to the job.
.github/workflows/osps-security-assessment.yaml Default-deny permissions and add harden-runner auditing.
.github/workflows/lint.yaml Default-deny permissions, add concurrency, and add harden-runner auditing.
.github/workflows/integration.yaml Default-deny permissions, add concurrency, add harden-runner, and quote base ref usage.
.github/workflows/ci.yaml Default-deny permissions, add concurrency, add harden-runner, and quote base ref usage.
.github/workflows/auto-labeler.yaml Default-deny permissions and add concurrency for pull_request_target workflow.
Comments suppressed due to low confidence (2)

.github/workflows/osps-security-assessment.yaml:19

  • This job uploads artifacts via actions/upload-artifact, but the job-level permissions omit actions: write. With top-level permissions: {} this will make the upload step fail with insufficient token scopes.
    .github/workflows/auto-labeler.yaml:12
  • The concurrency group for this pull_request_target workflow is based on github.head_ref, which is PR-author-controlled and can collide across unrelated PRs (potentially cancelling other runs). Using the PR number makes the group stable and avoids cross-PR collisions.

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

Comment thread .github/workflows/pr-title.yaml Resolved
## What/Why

Address PR review: author-controlled github.head_ref can collide across
unrelated PRs that share a source branch name, cancelling each other's runs.
github.event.pull_request.number is unique per PR, so use it for the
pull_request_target workflows (pr-title, auto-labeler).

## Proof it works

actionlint clean on both changed workflows.

## Risk + AI role

Low -- concurrency group key only, pull_request_target workflows where the PR
number is always present. AI-generated (Claude Opus 4.8).

## Review focus

- Left the pull_request workflows on head_ref || ref, since they also run on
  push where the PR number does not exist.

Signed-off-by: jmeridth <jmeridth@gmail.com>
@jmeridth
jmeridth merged commit 255a398 into main Jul 12, 2026
12 checks passed
@jmeridth
jmeridth deleted the gha-standards branch July 12, 2026 04:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants