Skip to content

add workflow for virus scanning binaries - #101

Merged
dhth merged 5 commits into
mainfrom
add-virus-scanning-check-before-release
Aug 23, 2025
Merged

add workflow for virus scanning binaries#101
dhth merged 5 commits into
mainfrom
add-virus-scanning-check-before-release

Conversation

@dhth

@dhth dhth commented Aug 23, 2025

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • Chores
    • Added a CI workflow to build release binaries and scan them with VirusTotal.
    • Workflow runs on manual dispatch (not automatically on pull requests).
    • Go toolchain version is derived from the project version file in CI.
    • Builds binaries in snapshot mode before scanning.
    • Configured rate-limited VirusTotal scanning of the built artifacts.

@coderabbitai

coderabbitai Bot commented Aug 23, 2025

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

Adds a new GitHub Actions workflow that builds Go binaries with GoReleaser and scans the produced artifacts with VirusTotal; the workflow is named "scan" and triggers on workflow_dispatch only.

Changes

Cohort / File(s) Summary of Changes
CI Workflow: VirusTotal scan
.github/workflows/scan.yml
Added workflow "scan" triggered by workflow_dispatch; job virus-total on ubuntu-latest that checks out the repo (actions/checkout@v5), sets up Go (actions/setup-go@v5 with go-version-file: 'go.mod'), builds with goreleaser/goreleaser-action@v6 (version: 'v2.9.0', args: build --snapshot), lists ./dist/hours_*/hours, and runs crazy-max/ghaction-virustotal pinned to commit d34968c958ae283fe976efed637081b9f9dcf74f with vt_api_key: ${{ secrets.VT_API_KEY }}, request_rate: 4, scanning ./dist/hours_*/hours.

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.


📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

Knowledge Base: Disabled due to Reviews > Disable Knowledge Base setting

📥 Commits

Reviewing files that changed from the base of the PR and between 47a529a and 4b1c2c4.

📒 Files selected for processing (1)
  • .github/workflows/scan.yml (1 hunks)
✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch add-virus-scanning-check-before-release

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

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

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

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

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

Knowledge Base: Disabled due to Reviews > Disable Knowledge Base setting

📥 Commits

Reviewing files that changed from the base of the PR and between 1d63e14 and d1a7db4.

📒 Files selected for processing (1)
  • .github/workflows/scan.yml (1 hunks)
🔇 Additional comments (1)
.github/workflows/scan.yml (1)

26-32: Be aware: VirusTotal submissions are shared with security vendors

Uploading binaries to VirusTotal typically shares samples with AV partners. Ensure this aligns with your project’s policy and that no proprietary/private artifacts are included.

Do you want me to add a safeguard that only scans artifacts produced from public branches/tags and never from private/internal builds?

Comment thread .github/workflows/scan.yml Outdated
Comment thread .github/workflows/scan.yml Outdated
Comment thread .github/workflows/scan.yml
Comment thread .github/workflows/scan.yml Outdated
Comment thread .github/workflows/scan.yml
Comment thread .github/workflows/scan.yml
Comment thread .github/workflows/scan.yml

@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

♻️ Duplicate comments (7)
.github/workflows/scan.yml (7)

13-15: Checkout depth 1 unless GoReleaser snapshot needs tags

Use depth 1 to speed up unless your snapshot build derives version from tags.

       - uses: actions/checkout@v5
         with:
-          fetch-depth: 0
+          fetch-depth: 1

If your GoReleaser config needs tags/history, keep depth: 0.


3-5: Tighten triggers and scan actual release artifacts too

Limit PR runs to relevant paths and add tag/release triggers so you also scan what you actually ship.

 on:
   workflow_dispatch:
+  pull_request:
+    paths:
+      - '**/*.go'
+      - 'go.mod'
+      - 'go.sum'
+      - '.goreleaser*.y*ml'
+      - '.github/workflows/scan.yml'
+  push:
+    tags:
+      - 'v*'
+  release:
+    types: [published]

6-7: Avoid hardcoding Go version; sync with go.mod and enable module cache

Prevents drift and speeds up builds.

-env:
-  GO_VERSION: '1.25.0'
       - name: Set up Go
         uses: actions/setup-go@v5
         with:
-          go-version: ${{ env.GO_VERSION }}
+          go-version-file: 'go.mod'
+          cache: true

Also applies to: 16-19


9-11: Harden the job: least-privilege permissions, concurrency, and timeout

Reduces blast radius and avoids piled-up runs.

 jobs:
   virus-total:
     runs-on: ubuntu-latest
+    permissions:
+      contents: read
+    concurrency:
+      group: ${{ github.workflow }}-${{ github.ref }}
+      cancel-in-progress: true
+    timeout-minutes: 20

21-24: Pin GoReleaser action by commit SHA; add --clean and distribution

Improves supply-chain security and ensures a clean dist dir.

-      - name: Build Binaries
-        uses: goreleaser/goreleaser-action@v6
-        with:
-          version: 'v2.9.0'
-          args: build --snapshot
+      - name: Build Binaries
+        # Pin to the commit SHA for the chosen release; keep version comment for readability
+        uses: goreleaser/goreleaser-action@<COMMIT-SHA> # v6
+        with:
+          distribution: goreleaser
+          version: 'v2.9.0'
+          args: build --snapshot --clean

Replace with the exact digest of the action release you trust.


20-24: Add a diagnostic step to verify dist contents match VT globs

Helps catch pattern mismatches early.

       - name: Build Binaries
         # ...
-          args: build --snapshot
+          args: build --snapshot --clean
+      - name: List dist for debugging
+        if: always()
+        run: |
+          echo "=== dist tree ==="
+          ls -lahR dist || true

25-31: Guard VirusTotal for forks/missing secret, broaden file patterns, fail on detections, and upload reports

Prevents secret-related failures on forked PRs, scans all platforms, and surfaces reports.

       - name: VirusTotal scan
-        uses: crazy-max/ghaction-virustotal@d34968c958ae283fe976efed637081b9f9dcf74f #v4.2.0
+        if: ${{ !github.event.pull_request.head.repo.fork && secrets.VT_API_KEY != '' }}
+        uses: crazy-max/ghaction-virustotal@d34968c958ae283fe976efed637081b9f9dcf74f # v4.2.0
         with:
           vt_api_key: ${{ secrets.VT_API_KEY }}
           request_rate: 4
           files: |
-            ./dist/hours_*/hours
+            ./dist/**/hours
+            ./dist/**/hours.exe
+          fail_ci_if_virus_found: true
+
+      - name: Upload VT reports
+        if: always()
+        uses: actions/upload-artifact@v4
+        with:
+          name: virustotal-reports
+          path: |
+            vt/*.json
+            vt/*.txt

Adjust report paths if the action outputs differ.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

Knowledge Base: Disabled due to Reviews > Disable Knowledge Base setting

📥 Commits

Reviewing files that changed from the base of the PR and between d1a7db4 and 8b2dc75.

📒 Files selected for processing (1)
  • .github/workflows/scan.yml (1 hunks)

Comment thread .github/workflows/scan.yml
@dhth
dhth merged commit 111afec into main Aug 23, 2025
@dhth
dhth deleted the add-virus-scanning-check-before-release branch August 23, 2025 10:13
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