Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .github/workflows/semver-checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Semver Checks

on:
pull_request:
branches:
- master
workflow_dispatch:

permissions:
contents: read

jobs:
semver-checks:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Setup Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@02be93da58aa71fb456aa9c43b301149248829d8 # v1.15.1

- name: Install cargo-semver-checks
run: cargo install cargo-semver-checks

- name: Run semver checks
run: cargo semver-checks

Choose a reason for hiding this comment

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

reported by reviewdog 🐶
[opengrep] GitHub Actions workflow is missing permissions declaration at the top-level or job-level.

Without explicit permissions, workflows may have excessive default permissions, violating the principle of least privilege.

According to GitHub's security best practices, you should explicitly define permissions to limit the scope of access tokens.

Valid permission scopes include: actions, attestations, checks, contents, deployments, discussions, id-token, issues, models, packages, pages, pull-requests, security-events, statuses

👍 Good examples:

Top-level: permissions: { contents: read, pull-requests: write }
Job-level: jobs: build: permissions: { contents: read }
Restrict all: permissions: {}

👎 Bad:

No permissions defined in the workflow

GitHub Security Hardening Guide


Source: https://github.com/brave/security-action/blob/main/assets/opengrep_rules/services/github-workflow-missing-permissions.yaml


Cc @thypon @kdenhartog

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@copilot address this issue