Skip to content

fix(ci): Address audit concerns and hardening (1 of 3) - #22

Merged
OSXLich-Doug merged 2 commits into
mainfrom
fix/ci-workflow-hardening
Jul 10, 2026
Merged

OSXLich-Doug merged 2 commits into
mainfrom
fix/ci-workflow-hardening

Conversation

@OSXLich-Doug

@OSXLich-Doug OSXLich-Doug commented Jul 10, 2026 •

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • New Features

    • Added automated PowerShell test validation for relevant code changes.
  • Bug Fixes

    • Improved reliability of RSpec preflight checks by defaulting to test execution when file detection fails.
    • Improved Ruby syntax validation for changed files, including safer handling of filenames.
  • Security

    • Restricted workflow permissions to read-only repository contents.
    • Prevented checkout steps from persisting credentials.

@coderabbitai

coderabbitai Bot commented Jul 10, 2026 •

Copy link
Copy Markdown

Review Change Stack

Important

Review skipped

Auto 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: e25e358e-dca1-40fe-a83b-92600b8fc61c

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

Walkthrough

Adds a Pester GitHub Actions workflow and hardens existing Ruby CI workflows with read-only permissions, non-persisted checkout credentials, resilient RSpec preflight handling, and safer changed-file syntax checks.

Changes

Continuous integration workflows

Layer / File(s) Summary
Pester test workflow
.github/workflows/pester_tests.yaml
Adds Windows-based Pester 6.0.0 execution for PowerShell-related changes and pushes to main.
RSpec preflight fallback
.github/workflows/rspec_tests.yaml
Adds read-only permissions, runs RSpec when preflight detection fails, and conditionally performs checkout based on the preflight result.
Ruby workflow hardening
.github/workflows/rubocop.yaml, .github/workflows/ruby_syntax.yaml
Restricts permissions, disables persisted checkout credentials, and safely checks newline-separated changed Ruby files.

Estimated code review effort: 3 (Moderate) | ~20 minutes

🚥 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 accurately reflects the CI hardening and audit-focused workflow changes in this PR.
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/ci-workflow-hardening

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

@OSXLich-Doug OSXLich-Doug changed the title fix(all): Address audit concerns and hardening (1 of 3) fix(ci): Address audit concerns and hardening (1 of 3) Jul 10, 2026
@OSXLich-Doug

Copy link
Copy Markdown
Contributor Author

@coderabbitai - review

@coderabbitai

coderabbitai Bot commented Jul 10, 2026 •

Copy link
Copy Markdown

@OSXLich-Doug: Sure, I'll review the changes in this PR now.

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
.github/workflows/ruby_syntax.yaml (1)

37-44: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Good, quote-safe rewrite.

Newline-delimited read loop with ruby -c -- "$file" correctly avoids word-splitting/glob issues from the previous for-loop approach. Relies on GitHub Actions' implicit bash -e default for a failing ruby -c to fail the step; consider an explicit set -e at the top of the script for readability/defensiveness independent of runner defaults.

🧹 Optional defensive addition
         run: |
+          set -euo pipefail
           while IFS= read -r file; do
             [ -z "$file" ] && continue
             ruby -c -- "$file"
           done <<< "$CHANGED_FILES"
🤖 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/ruby_syntax.yaml around lines 37 - 44, Add an explicit
`set -e` at the beginning of the shell script in the “Run Ruby syntax check on
changed scripts” step, before the `while` loop, so any failing `ruby -c` command
reliably fails the workflow independently of runner defaults.
🤖 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.

Inline comments:
In @.github/workflows/rspec_tests.yaml:
- Around line 56-58: Add the pull-requests: read permission alongside contents:
read in the workflow-level permissions block of the RSpec workflow, enabling
github.rest.pulls.listFiles and preserving the intended preflight skip behavior.

---

Nitpick comments:
In @.github/workflows/ruby_syntax.yaml:
- Around line 37-44: Add an explicit `set -e` at the beginning of the shell
script in the “Run Ruby syntax check on changed scripts” step, before the
`while` loop, so any failing `ruby -c` command reliably fails the workflow
independently of runner defaults.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 5c9f639c-2ccc-46e0-aab5-02021ca0bd92

📥 Commits

Reviewing files that changed from the base of the PR and between 8274f2b and 5df448f.

📒 Files selected for processing (4)
  • .github/workflows/pester_tests.yaml
  • .github/workflows/rspec_tests.yaml
  • .github/workflows/rubocop.yaml
  • .github/workflows/ruby_syntax.yaml

Comment thread .github/workflows/rspec_tests.yaml
@OSXLich-Doug
OSXLich-Doug merged commit e907953 into main Jul 10, 2026
4 checks passed
@OSXLich-Doug
OSXLich-Doug deleted the fix/ci-workflow-hardening branch July 10, 2026 19:27
@OSXLich-Doug
OSXLich-Doug restored the fix/ci-workflow-hardening branch July 10, 2026 20:28
@OSXLich-Doug
OSXLich-Doug deleted the fix/ci-workflow-hardening branch July 14, 2026 12:59
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.

1 participant