Skip to content

chore(BytePort): workflow hardening -- ubuntu-24.04, SHA pins#138

Open
KooshaPari wants to merge 7 commits into
mainfrom
chore/byteport-workflow-hardening
Open

chore(BytePort): workflow hardening -- ubuntu-24.04, SHA pins#138
KooshaPari wants to merge 7 commits into
mainfrom
chore/byteport-workflow-hardening

Conversation

@KooshaPari
Copy link
Copy Markdown
Owner

@KooshaPari KooshaPari commented May 28, 2026

User description

Summary

  • Pin all GitHub Actions to specific SHA commits (no @v4/@main floating refs)
  • Replace ubuntu-latest with ubuntu-24.04 for reproducibility
  • Ensure minimal permissions blocks on all workflows

Test plan

  • Verify all workflows parse correctly
  • Confirm no ubuntu-latest or @v4/@main refs remain in .github/workflows/

🤖 Generated with Claude Code


Note

Low Risk
Changes are mostly CI supply-chain and runner pinning plus a no-op Go import cleanup; remaining ubuntu-latest jobs are a minor consistency gap, not runtime risk.

Overview
CI and security workflows are tightened across .github/workflows/: most jobs move from ubuntu-latest to ubuntu-24.04, timeout-minutes are added per job, workflow-level permissions now include actions: read where missing, and common steps (notably actions/checkout, setup-go, Scorecard/CodeQL upload actions) are pinned to full commit SHAs with version comments instead of floating @v4 / @main refs. OpenSSF Scorecard gains proper concurrency, job-level timeout, updated action SHAs, and removes a misplaced top-level timeout under on:.

Non-CI changes: README adds the Sladge badge; backend/byteport/main.go drops unused OpenTelemetry imports so go vet/build pass without behavior change; root Cargo.toml workspace resolver goes from 2 to 3; new docs/sessions/20260507-byteport-sladge-main-current/ records the Sladge refresh and validation notes.

Incomplete hardening: ci.yml vet and release-drafter.yml still use ubuntu-latest; some workflows (e.g. go-ci, trufflehog) still use tag-less or partially unpinned checkout/setup refs.

Reviewed by Cursor Bugbot for commit 770ea7b. Bugbot is set up for automated code reviews on this repo. Configure here.


CodeAnt-AI Description

Harden CI checks and add the Sladge badge to BytePort

What Changed

  • CI workflows now run on ubuntu-24.04, use job timeouts, and request only the minimum access they need
  • Common workflow actions are pinned to fixed versions so checks are less likely to break from upstream changes
  • The README now shows the Sladge badge
  • Unused OpenTelemetry imports were removed from the BytePort backend so validation passes without changing runtime behavior

Impact

✅ Fewer flaky CI runs
✅ Safer workflow updates
✅ Clearer project branding

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

Phenotype Agent and others added 7 commits May 6, 2026 23:31
- Add explicit permissions blocks (contents: read, actions: read minimum)
- Add timeout-minutes to all jobs (test/build: 30, lint: 10, security: 20, deploy: 15)
- Pin all actions to commit SHAs instead of @vx tags

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
- Add explicit `permissions:` blocks with minimum scope to all workflows
- Add `timeout-minutes:` to every job (test/build: 30, lint: 10, security: 20, deploy: 15)
- Pin floating @vx action tags to full commit SHAs
- Fix scorecard.yml YAML structure with misplaced timeout-minutes

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Remove unused OTel imports that blocked BytePort backend validation.

Validation: git diff --check; rg -n "AI Slop Inside|sladge" README.md docs/sessions/20260507-byteport-sladge-main-current; git lfs status; env GOTOOLCHAIN=local GOCACHE=/tmp/byteport-go-build-cache-main-current /opt/homebrew/bin/go test -v ./...; env GOTOOLCHAIN=local GOCACHE=/tmp/byteport-go-build-cache-main-current /opt/homebrew/bin/go vet ./...; env GOTOOLCHAIN=local GOCACHE=/tmp/byteport-go-build-cache-main-current /opt/homebrew/bin/go build -buildvcs=false ./... from backend/byteport. Blocked: backend/nvms go test still fails on pre-existing import cycles, provider redeclarations, and spin-go-sdk export comment drift.

Co-authored-by: Codex <noreply@openai.com>
- Pin all actions to specific SHA commits (no @v4/@main floating refs)
- Replace ubuntu-latest with ubuntu-24.04 for reproducibility
- Ensure minimal permissions blocks present on all workflows
- SHA-pinned: checkout, setup-go, golangci-lint, codeql-action,
  scorecard, cargo-deny, cargo-machete, cargo-semver-checks,
  rustsec/audit-check, trufflehog, codecov, release, scorecard

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 28, 2026 11:27
@codeant-ai
Copy link
Copy Markdown

codeant-ai Bot commented May 28, 2026

CodeAnt AI is reviewing your PR.


Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@gemini-code-assist
Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@sonarqubecloud
Copy link
Copy Markdown

@codeant-ai codeant-ai Bot added the size:L This PR changes 100-499 lines, ignoring generated files label May 28, 2026
Copy link
Copy Markdown

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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Comment on lines +10 to +12
permissions:
contents: read
actions: read
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔴 Architect Review — CRITICAL

The Release Drafter workflow now sets the GITHUB_TOKEN to read-only (permissions: contents: read, actions: read) and does not override this at the job level, so the release-drafter step cannot create or update release drafts as intended.

Suggestion: Grant the update_release_draft job the minimal required write scope (e.g., permissions: { contents: write }), mirroring .github/workflows/release.yml:15-16, so the Release Drafter action can perform its release-draft mutations while keeping other workflows read-only.

Fix in Cursor | Fix in VSCode Claude

(Use Cmd/Ctrl + Click for best experience)

Prompt for AI Agent 🤖
This is an **Architect / Logical Review** comment left during a code review. These reviews are first-class, important findings — not optional suggestions. Do NOT dismiss this as a 'big architectural change' just because the title says architect review; most of these can be resolved with a small, localized fix once the intent is understood.

**Path:** .github/workflows/release-drafter.yml
**Line:** 10:12
**Comment:**
	*CRITICAL: The Release Drafter workflow now sets the GITHUB_TOKEN to read-only (`permissions: contents: read, actions: read`) and does not override this at the job level, so the `release-drafter` step cannot create or update release drafts as intended.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
If a suggested approach is provided above, use it as the authoritative instruction. If no explicit code suggestion is given, you MUST still draft and apply your own minimal, localized fix — do not punt back with 'no suggestion provided, review manually'. Keep the change as small as possible: add a guard clause, gate on a loading state, reorder an await, wrap in a conditional, etc. Do not refactor surrounding code or expand scope beyond the finding.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix

@codeant-ai
Copy link
Copy Markdown

codeant-ai Bot commented May 28, 2026

CodeAnt AI finished reviewing your PR.

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 5 potential issues.

Fix All in Cursor

Bugbot Autofix prepared fixes for all 5 issues found in the latest run.

  • ✅ Fixed: Release drafter permissions block breaks draft creation
    • Added contents:write and pull-requests:read permissions to the workflow-level permissions block.
  • ✅ Fixed: Vet job still uses ubuntu-latest runner
    • Changed runs-on from ubuntu-latest to ubuntu-24.04 for consistency with other jobs.
  • ✅ Fixed: Release drafter still uses ubuntu-latest runner
    • Changed runs-on from ubuntu-latest to ubuntu-24.04 to complete the ubuntu-latest removal.
  • ✅ Fixed: Cargo resolver changed from "2" to "3" unexpectedly
    • Reverted resolver from '3' back to '2' as this behavioral change was unrelated to the PR scope.
  • ✅ Fixed: Cargo audit missing checks: write permission breaks annotations
    • Added checks:write permission to enable the audit-check action to create check run annotations.

Create PR

Or push these changes by commenting:

@cursor push f4786ef6b0
Preview (f4786ef6b0)
diff --git a/.github/workflows/cargo-audit.yml b/.github/workflows/cargo-audit.yml
--- a/.github/workflows/cargo-audit.yml
+++ b/.github/workflows/cargo-audit.yml
@@ -17,6 +17,7 @@
 permissions:
   contents: read
   actions: read
+  checks: write
 
 jobs:
   audit:

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -18,7 +18,7 @@
 jobs:
   vet:
     name: Go Vet
-    runs-on: ubuntu-latest
+    runs-on: ubuntu-24.04
     timeout-minutes: 10
     permissions:
       contents: read

diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml
--- a/.github/workflows/release-drafter.yml
+++ b/.github/workflows/release-drafter.yml
@@ -8,12 +8,13 @@
   workflow_dispatch:
 
 permissions:
-  contents: read
+  contents: write
+  pull-requests: read
   actions: read
 jobs:
   update_release_draft:
     timeout-minutes: 15
-    runs-on: ubuntu-latest
+    runs-on: ubuntu-24.04
     steps:
       - uses: release-drafter/release-drafter@6a93d829887aa2e0748befe2e808c66c0ec6e4c7
         env:

diff --git a/Cargo.toml b/Cargo.toml
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,5 +1,5 @@
 [workspace]
-resolver = "3"
+resolver = "2"
 members = [
     "frontend/web/src-tauri",
 ]

You can send follow-ups to the cloud agent here.

Reviewed by Cursor Bugbot for commit 770ea7b. Configure here.


permissions:
contents: read
actions: read
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Release drafter permissions block breaks draft creation

High Severity

The newly added top-level permissions block grants only contents: read and actions: read, but the release-drafter action requires contents: write to create/update draft releases and pull-requests: read to categorize PRs. Since no job-level permissions override exists (unlike release.yml which correctly has a job-level contents: write), the token will lack write access and the action will silently fail to create draft releases.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 770ea7b. Configure here.

Comment thread .github/workflows/ci.yml
vet:
name: Go Vet
runs-on: ubuntu-latest
timeout-minutes: 10
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Vet job still uses ubuntu-latest runner

Low Severity

The vet job in ci.yml still uses runs-on: ubuntu-latest while the build and fmt jobs in the same file were converted to ubuntu-24.04. The PR description states "Replace ubuntu-latest with ubuntu-24.04 for reproducibility" and the test plan requires confirming no ubuntu-latest refs remain in workflows.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 770ea7b. Configure here.

actions: read
jobs:
update_release_draft:
timeout-minutes: 15
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Release drafter still uses ubuntu-latest runner

Low Severity

The release-drafter.yml workflow still uses runs-on: ubuntu-latest despite other changes being made to this file (adding permissions and timeout-minutes). The PR's test plan explicitly requires confirming no ubuntu-latest refs remain in .github/workflows/.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 770ea7b. Configure here.

Comment thread Cargo.toml
@@ -1,5 +1,5 @@
[workspace]
resolver = "2"
resolver = "3"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cargo resolver changed from "2" to "3" unexpectedly

Medium Severity

The workspace resolver was changed from "2" to "3", which enables MSRV-aware dependency resolution. This is a behavioral change unrelated to the PR's stated scope of workflow hardening. The sole workspace member (frontend/web/src-tauri) declares rust-version = "1.77.2", so resolver 3 may select different (potentially older) dependency versions to satisfy that constraint, potentially causing build failures or behavioral changes.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 770ea7b. Configure here.


permissions:
contents: read
actions: read
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cargo audit missing checks: write permission breaks annotations

High Severity

The newly added top-level permissions block grants only contents: read and actions: read, but the rustsec/audit-check action requires checks: write to post check-run results and annotations via the GitHub API. Previously, no explicit permissions block existed, so the default token permissions (which include checks: write) applied. Now the action will fail with a "Resource not accessible by integration" error when it tries to create the check run.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 770ea7b. Configure here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L This PR changes 100-499 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants