Skip to content

chore(ci): Harden GitHub Actions#400

Merged
rhamzeh merged 4 commits into
openfga:mainfrom
step-security-bot:chore/GHA-070423-stepsecurity-remediation
May 7, 2026
Merged

chore(ci): Harden GitHub Actions#400
rhamzeh merged 4 commits into
openfga:mainfrom
step-security-bot:chore/GHA-070423-stepsecurity-remediation

Conversation

@step-security-bot

@step-security-bot step-security-bot commented May 7, 2026

Copy link
Copy Markdown
Contributor

This pull request is created by StepSecurity at the request of @rhamzeh.

Summary

This pull request is created by StepSecurity at the request of @rhamzeh. Please merge the Pull Request to incorporate the requested changes. Please tag @rhamzeh on your message if you have any questions related to the PR.

Summary

This pull request is created by StepSecurity at the request of @rhamzeh. Please merge the Pull Request to incorporate the requested changes. Please tag @rhamzeh on your message if you have any questions related to the PR.

Security Fixes

Least Privileged GitHub Actions Token Permissions

The GITHUB_TOKEN is an automatically generated secret to make authenticated calls to the GitHub API. GitHub recommends setting minimum token permissions for the GITHUB_TOKEN.

Harden Runner

Harden-Runner is an open-source security agent for the GitHub-hosted runner to prevent software supply chain attacks. It prevents exfiltration of credentials, detects tampering of source code during build, and enables running jobs without sudo access. See how popular open-source projects use Harden-Runner here.

Harden runner usage

You can find link to view insights and policy recommendation in the build log

Please refer to documentation to find more details.

Keeping your actions up to date with Dependabot

With Dependabot version updates, when Dependabot identifies an outdated dependency, it raises a pull request to update the manifest to the latest version of the dependency. This is recommended by GitHub as well as The Open Source Security Foundation (OpenSSF).

Detect Vulnerabilities with SAST Workflow

Static Code Analysis (also known as Source Code Analysis) is usually performed as part of a Code Review (also known as clear-box testing) and is carried out at the Implementation phase of a Security Development Lifecycle (SDL). Static Code Analysis commonly refers to the running of Static Code Analysis tools that attempt to highlight possible vulnerabilities within ‘static’ (non-running) source code by using techniques such as Taint Analysis and Data Flow Analysis.

Add Dependency Review Workflow

The Dependency Review Workflow enforces dependency reviews on your pull requests. The action scans for vulnerable versions of dependencies introduced by package version changes in pull requests, and warns you about the associated security vulnerabilities. This gives you better visibility of what's changing in a pull request, and helps prevent vulnerabilities being added to your repository.

Maintain Code Quality with Pre-Commit

Pre-commit is a framework for managing and maintaining multi-language pre-commit hooks. Hooks can be any scripts, code, or binaries that run at any stage of the git workflow. Pre-commit hooks are useful for enforcing code quality, code formatting, and detecting security vulnerabilities.

Feedback

For bug reports, feature requests, and general feedback; please create an issue in step-security/secure-repo or contact us via our website.

Signed-off-by: StepSecurity Bot [email protected]

Summary by CodeRabbit

  • Chores
    • Implemented automated security scanning and vulnerability detection in the CI/CD pipeline
    • Enabled automated daily dependency updates for example projects
    • Added pre-commit hooks for code quality, secret detection, and file validation
    • Enhanced all CI/CD workflows with security hardening and network egress auditing

Signed-off-by: StepSecurity Bot <[email protected]>
@step-security-bot
step-security-bot requested a review from a team as a code owner May 7, 2026 04:23
@coderabbitai

coderabbitai Bot commented May 7, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 8f629724-f98f-4312-b3bd-550833000325

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Walkthrough

Adds security scanning workflows (CodeQL and dependency review), configures pre-commit hooks (gitleaks, eslint, whitespace fixers), updates Dependabot to manage example directory dependencies, and hardens GitHub Actions runners by auditing outbound network calls across multiple CI jobs.

Changes

Security & CI Infrastructure

Layer / File(s) Summary
New Security Workflows
.github/workflows/codeql.yml, .github/workflows/dependency-review.yml
CodeQL workflow analyzes JavaScript and TypeScript on push/PR/weekly schedule; dependency-review workflow scans PR changes for known vulnerabilities. Both include runner hardening with egress audit policy.
Runner Hardening
.github/workflows/main.yaml, .github/workflows/scorecard.yml, .github/workflows/pr-title-conventional-commit.yml
Adds step-security/harden-runner with egress-policy: audit to build, test, audit, publish, create-release, scorecard, and PR validation jobs for network egress monitoring.
Pre-Commit & Dependency Configuration
.pre-commit-config.yaml, .github/dependabot.yaml
Pre-commit hooks configured for gitleaks (secret detection), eslint (code quality), and whitespace fixes. Dependabot daily checks added for npm dependencies in four example subdirectories (/example/api-executor, /example/example1, /example/opentelemetry, /example/streamed-list-objects).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • openfga/js-sdk#245: Adds the initial Scorecard workflow that this PR updates with runner hardening.
  • openfga/js-sdk#353: Originally introduced the PR title conventional commit workflow that this PR now harddens with runner security steps.

Suggested reviewers

  • rhamzeh
  • emilic
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'chore(ci): Harden GitHub Actions' clearly and concisely describes the main objective of the changeset—hardening GitHub Actions security through runner hardening, workflow additions, and security configurations.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

Review ran into problems

🔥 Problems

Git: Failed to clone repository. Please run the @coderabbitai full review command to re-trigger a full review. If the issue persists, set path_filters to include or exclude specific files.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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

🧹 Nitpick comments (1)
.github/workflows/scorecard.yml (1)

36-39: 🏗️ Heavy lift

Audit-only mode doesn't enforce egress blocking.

egress-policy: audit logs outbound traffic without blocking; connections are still allowed to proceed. For exfiltration prevention on high-sensitivity jobs, consider moving to egress-policy: block with an allowlist after baselining to confirm which endpoints are required.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/scorecard.yml around lines 36 - 39, The workflow currently
uses step-security/harden-runner with egress-policy: audit which only logs
outbound calls and does not block them; change the configuration to use
egress-policy: block (e.g., update the step-security/harden-runner invocation)
and add an explicit allowlist of required endpoints (after running audit
baseline) so only approved egress is permitted; ensure you update the
step-security/harden-runner step and include the allowlist parameters supported
by that action to avoid breaking required integrations.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In @.github/workflows/scorecard.yml:
- Around line 36-39: The workflow currently uses step-security/harden-runner
with egress-policy: audit which only logs outbound calls and does not block
them; change the configuration to use egress-policy: block (e.g., update the
step-security/harden-runner invocation) and add an explicit allowlist of
required endpoints (after running audit baseline) so only approved egress is
permitted; ensure you update the step-security/harden-runner step and include
the allowlist parameters supported by that action to avoid breaking required
integrations.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: ded38a1f-c2b9-45a9-bce5-35901ac5457f

📥 Commits

Reviewing files that changed from the base of the PR and between 6b03882 and cd9c4ce.

📒 Files selected for processing (7)
  • .github/dependabot.yaml
  • .github/workflows/codeql.yml
  • .github/workflows/dependency-review.yml
  • .github/workflows/main.yaml
  • .github/workflows/pr-title-conventional-commit.yml
  • .github/workflows/scorecard.yml
  • .pre-commit-config.yaml

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.59%. Comparing base (6b03882) to head (cd9c4ce).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #400   +/-   ##
=======================================
  Coverage   85.59%   85.59%           
=======================================
  Files          26       26           
  Lines        1270     1270           
  Branches      250      250           
=======================================
  Hits         1087     1087           
  Misses        110      110           
  Partials       73       73           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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

rhamzeh
rhamzeh previously approved these changes May 7, 2026
@rhamzeh
rhamzeh added this pull request to the merge queue May 7, 2026
Copilot AI review requested due to automatic review settings May 7, 2026 06:49

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 setup by tightening default workflow token permissions, adding runner egress auditing, and introducing additional supply-chain/security automation (CodeQL, dependency review, Dependabot entries, and pre-commit hooks).

Changes:

  • Added step-security/harden-runner (egress audit mode) to multiple workflows and set least-privilege GITHUB_TOKEN permissions where applicable.
  • Introduced new security workflows: CodeQL scanning and Dependency Review on PRs.
  • Added Dependabot updates for example projects and introduced a baseline .pre-commit-config.yaml.

Reviewed changes

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

Show a summary per file
File Description
.pre-commit-config.yaml Adds gitleaks, ESLint, and whitespace hooks via pre-commit.
.github/workflows/scorecard.yml Adds runner hardening before checkout for scorecard runs.
.github/workflows/pr-title-conventional-commit.yml Adds top-level token permissions and runner hardening for PR-title validation workflow.
.github/workflows/main.yaml Adds runner hardening to CI jobs.
.github/workflows/dependency-review.yml New workflow to block/flag vulnerable dependency changes in PRs.
.github/workflows/codeql.yml New CodeQL code scanning workflow for JS/TS.
.github/dependabot.yaml Enables daily npm updates for multiple example directories.

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

Comment thread .github/workflows/codeql.yml
Comment thread .pre-commit-config.yaml Outdated
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch May 7, 2026
@rhamzeh
rhamzeh enabled auto-merge May 7, 2026 20:27
@rhamzeh
rhamzeh added this pull request to the merge queue May 7, 2026
Merged via the queue into openfga:main with commit 1ea8634 May 7, 2026
10 checks passed
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.

6 participants