8000 feat(workflows): add Bumblebee supply-chain scan (reusable + template) by dkastl · Pull Request #44 · geolonia/.github · GitHub
[go: up one dir, main page]

Skip to content

feat(workflows): add Bumblebee supply-chain scan (reusable + template) - #44

Merged
dkastl merged 7 commits into
mainfrom
feat/reusable-bumblebee-scan
May 25, 2026
Merged

dkastl merged 7 commits into
mainfrom
feat/reusable-bumblebee-scan

Conversation

@dkastl
@dkastl dkastl commented May 25, 2026 •
Copy link
Copy Markdown
Contributor

Summary

Adds two coupled pieces for running Bumblebee (Apache-2.0) in repo CI:

  1. reusable-bumblebee-scan.yml — reusable workflow that downloads the pinned upstream binary + threat_intel/ catalogs, scans the repo checkout, posts an idempotent PR comment, uploads the NDJSON as an artifact, and fails the check on any match.
  2. workflow-templates/bumblebee-scan.{yml,properties.json} — exposes (1) under the Security / Automation categories in the "New workflow" UI of every repo in the org, so it can be enabled per-repo with one click.

Why

Existing CI surface — secret scanning, Dependabot CVEs, source review — does not detect packages known to have been compromised or weaponized in the wild. Bumblebee fills that gap and also adds coverage for MCP servers and editor/browser extensions.

Design notes

  • Pulls threat_intel/ directly from the upstream release tarball at the pinned tag — no mirror.
  • Checksum verified before extraction (shasum -a 256 -c).
  • Patterns lifted from reusable-secret-leak-check.yml: SHA-pinned actions, idempotent PR comment via marker, inline ::error:: annotations sanitized against workflow-command injection, artifact upload, graceful fork/Dependabot fallback when GITHUB_TOKEN is read-only.

Inputs

Input Default Purpose
bumblebee-version v0.1.1 Upstream release tag — also the source for threat_intel/
fail-on-findings true Warn-only mode possible for triage
ecosystems (all) Optional comma list to scope, e.g. npm,mcp
profile project One of baseline/project/deep

Consumer wrapper

name: Bumblebee Scan
on:
  pull_request: { branches: [main] }
  push: { branches: [main] }
permissions:
  contents: read
  pull-requests: write
jobs:
  scan:
    uses: geolonia/.github/.github/workflows/reusable-bumblebee-scan.yml@v1

Test plan

  • CodeRabbit review clean
  • After merge: tag v1.14.0 (auto-release workflow moves v1 / v1.14)
  • Add the template to a downstream repo via the "New workflow" UI and verify: scan completes <2 min, "no matches" comment posts, NDJSON artifact uploads
  • Verify on a deliberately-poisoned fixture branch (planted IOC name+version): scan fails the check, annotations + PR comment list the finding

Summary by CodeRabbit

  • Chores
    • Added a reusable supply‑chain scan workflow that runs Bumblebee, verifies release integrity, produces and uploads a findings artifact, emits workflow annotations for matches, and can optionally fail the run when configured.
  • New Features
    • Added a ready‑to‑use "Bumblebee Scan" workflow template and metadata/template registration to run on PRs, nightly schedules, or manual dispatch and post/update an idempotent summarized comment or tracking issue with truncated evidence.

Review Change Stack

Per-PR (and push-to-main) supply-chain inventory scan using
Bumblebee (Apache-2.0, by Perplexity). Matches installed packages
across npm/pypi/go/rubygems/composer/mcp/editor-extension/
browser-extension against curated `threat_intel/` exposure
catalogs shipped in the same upstream release.

Complements the existing CI surface:
- betterleaks (PR diff secret scan) — different signal
- Dependabot (CVEs in declared deps) — known CVEs, not IOCs
- CodeRabbit (PR diff review) — source, not deps

Initial trial in geolonia-backstage; rollout plan tracked in
geolonia/geolonia-operations#109.

Inputs:
- bumblebee-version (default v0.1.1)
- fail-on-findings (default true)
- ecosystems (optional comma list)
- profile (default: project)

Patterns lifted from reusable-secret-leak-check.yml: SHA-pinned
actions, idempotent PR comment via marker, inline annotations,
artifact upload, graceful fork/Dependabot fallback.
@github-actions
Copy link
Copy Markdown
Contributor

Secret Leak Check

OK No secrets detected in this PR's diff.

@coderabbitai
coderabbitai Bot commented May 25, 2026 •
Copy link
Copy Markdown

Warning

Review limit reached

@dkastl, we couldn't start this review because you've used your available PR reviews for now.

Your plan includes 5 reviews of capacity. Refill in 2 minutes and 55 seconds.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more review capacity refills, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than trial, open-source, and free plans. In all cases, review capacity refills continuously over time.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: ed5cee96-18e3-418f-8cdf-2ffc2ec67fe8

📥 Commits

Reviewing files that changed from the base of the PR and between e86fcd5 and af522f7.

📒 Files selected for processing (3)
  • .github/workflows/reusable-bumblebee-scan.yml
  • workflow-templates/bumblebee-scan.properties.json
  • workflow-templates/bumblebee-scan.yml

Walkthrough

Adds a reusable GitHub Actions workflow and workflow-template that download a pinned Bumblebee release, run a supply‑chain bumblebee scan, produce NDJSON findings, emit sanitized annotations, post/update a PR comment or tracking issue, upload the findings artifact, and optionally fail on findings.

Changes

Bumblebee Reusable Scan Workflow

Layer / File(s) Summary
Workflow interface and permissions
.github/workflows/reusable-bumblebee-scan.yml
Defines the workflow_call inputs (bumblebee-version, fail-on-findings, ecosystems, profile), workflow identity comments, and repository/PR/issue permissions plus job metadata.
Bumblebee download and scan execution
.github/workflows/reusable-bumblebee-scan.yml
Checks out the repo, downloads the pinned Bumblebee tarball and checksums.txt, verifies SHA256, extracts the release, runs bumblebee scan (with optional ecosystems filter) to produce bumblebee-findings.ndjson, and validates/counts the findings or flags scan failure.
Finding annotations and PR comment reporting
.github/workflows/reusable-bumblebee-scan.yml
Parses NDJSON to emit sanitized ::error annotations per finding via jq, constructs a markdown PR comment (stable HTML marker, evidence formatting, truncation), and posts or updates the comment using gh api while continuing on errors for fork/Dependabot contexts.
Non-PR tracking issue and artifact upload
.github/workflows/reusable-bumblebee-scan.yml
Opens/updates an idempotent tracking issue labeled bumblebee-finding for non-PR triggers, appends contextual comments when appropriate, and uploads bumblebee-findings.ndjson as a workflow artifact keyed by PR number or run id.
Failure handling and job exit
.github/workflows/reusable-bumblebee-scan.yml
Fails the job when findings exist and fail-on-findings is enabled, and fails separately when the scan produced no readable NDJSON report.

Workflow templates

Layer / File(s) Summary
Template properties
workflow-templates/bumblebee-scan.properties.json
Adds metadata for a “Bumblebee Supply-Chain Scan” workflow template (name, description, icon, categories, and supported file patterns).
Workflow template wrapper
workflow-templates/bumblebee-scan.yml
Adds the “Bumblebee Scan” workflow template that triggers on PRs to the default branch, scheduled nightly runs, and manual dispatch; delegates to the reusable workflow with commented configuration parameters.

🎯 4 (Complex) | ⏱️ ~45 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title directly and specifically describes the main change: adding Bumblebee supply-chain scan workflow (both reusable and template).
Description check ✅ Passed The description follows the template structure with Summary section completed, includes detailed explanation of changes, design decisions, inputs table, and test plan.
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
  • Commit unit tests in branch feat/reusable-bumblebee-scan

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.

Actionable comments posted: 3

🤖 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/reusable-bumblebee-scan.yml:
- Line 62: The workflow job name is hardcoded as "bumblebee (project scan)";
change it to interpolate the configured profile so the job name reflects
inputs.profile (e.g., include the profile value in the job name string) by
replacing the static name with a dynamic expression that reads inputs.profile
(and falls back to a sensible default if empty) so users see "bumblebee (project
scan - <profile>)" instead of the hardcoded label.
- Around line 56-58: Add an inline comment next to the permissions block
explaining the rationale for the scoped permissions: keep "contents: read" for
repository content access and explicitly justify why "pull-requests: write" is
required (e.g., to post/check PR statuses, add labels, or create commit statuses
as part of the reusable scan workflow) and note any mitigations (least-privilege
and usage boundaries) so reviewers can quickly understand the security tradeoffs
when inspecting the permissions section.
- Line 86: The grep pattern used in the checksum verification command (shasum -a
256 -c <(grep "linux_amd64" checksums.txt)) is too broad and may match multiple
assets; update the grep to target the exact asset filename or include the
archive suffix (e.g., match the linux_amd64 entry ending with .tar.gz) so the
subshell supplies exactly one checksum line to shasum; modify the grep
expression accordingly and keep the surrounding shasum -a 256 -c and
checksums.txt usage intact.
🪄 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: ASSERTIVE

Plan: Pro

Run ID: de7dd4e3-f18b-484c-8fe2-0faa2bbb719e

📥 Commits

Reviewing files that changed from the base of the PR and between 424ffdb and 42dc898.

📒 Files selected for processing (1)
  • .github/workflows/reusable-bumblebee-scan.yml

- name: bumblebee (project scan) -> name: bumblebee (${{ inputs.profile }} scan)
- shasum grep 'linux_amd64' -> grep '${ASSET}' (exact filename, no ambiguity)
- permissions: add inline rationale comments
- trim verbose comment blocks
@github-actions
Copy link
Copy Markdown
Contributor

Secret Leak Check

OK No secrets detected in this PR's diff.

@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

🤖 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/reusable-bumblebee-scan.yml:
- Line 72: The shasum verification uses grep "${ASSET}" which treats dots as
regex; change the grep invocation to use fixed-string matching (grep -F) when
checking checksums so the ${ASSET} literal is matched exactly; update the
command that invokes shasum -a 256 -c <(grep "${ASSET}" checksums.txt) to use
grep -F "${ASSET}" to ensure exact matching of the asset name.
🪄 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: ASSERTIVE

Plan: Pro

Run ID: fba97ace-51af-45bd-a52a-e4442e9970bf

📥 Commits

Reviewing files that changed from the base of the PR and between 42dc898 and 88b0242.

📒 Files selected for processing (1)
  • .github/workflows/reusable-bumblebee-scan.yml

Exposes the reusable Bumblebee scan via the "Add workflow"
UI under the Security / Automation categories. Pattern matches
the existing `secret-leak-check.yml` template — three-line
caller pointing at the @v1 reusable workflow with commented
overrides for common knobs (ecosystems, fail-on-findings,
profile, bumblebee-version).
@github-actions
Copy link
Copy Markdown
Contributor

Secret Leak Check

OK No secrets detected in this PR's diff.

@dkastl dkastl changed the title feat(workflows): add reusable Bumblebee supply-chain scan feat(workflows): add Bumblebee supply-chain scan (reusable + template) May 25, 2026
@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: 2

🤖 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 `@workflow-templates/bumblebee-scan.properties.json`:
- Around line 3-6: The template claims PyPI support in the "description" but the
"filePatterns" array is missing common Python dependency files; update the
filePatterns to include Python patterns such as "pyproject.toml",
"requirements.txt", "poetry.lock", and "Pipfile.lock" so that the Bumblebee scan
template surfaces for Python repos—modify the "filePatterns" entry in the JSON
to add these strings alongside the existing entries.

In `@workflow-templates/bumblebee-scan.yml`:
- Line 15: The reuse of the workflow is pinned to a mutable tag in the `uses:
geolonia/.github/.github/workflows/reusable-bumblebee-scan.yml@v1` line; replace
the `@v1` suffix with the target repository's full commit SHA (40-char) for the
commit that contains `reusable-bumblebee-scan.yml`. Edit the `uses` value in
workflow-templates/bumblebee-scan.yml to use
`.../reusable-bumblebee-scan.yml@<full-commit-sha>` (obtain the SHA from the
target repo’s commit history or GitHub UI) and verify any other
reusable-workflow references are similarly pinned.
🪄 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: ASSERTIVE

Plan: Pro

Run ID: 757ee08f-d6d8-4c12-9b99-d669fcea8ace

📥 Commits

Reviewing files that changed from the base of the PR and between 88b0242 and 940da48.

📒 Files selected for processing (2)
  • workflow-templates/bumblebee-scan.properties.json
  • workflow-templates/bumblebee-scan.yml

Comment thread workflow-templates/bumblebee-scan.yml Resolved
Drop redundant push-to-main trigger (covered by PR + branch
protection) and add a daily scheduled run so newly-cataloged
IOCs against already-merged packages get caught. The exposure
catalog is the part that changes, not the lockfile — without a
scheduled scan, a hijacked transitive dep can sit in main
indefinitely.

19:00 UTC = 04:00 JST matches the existing org cron convention.
Release trigger included as a commented opt-in for repos that
publish artifacts (npm / PyPI / Docker).
@github-actions
Copy link
Copy Markdown
Contributor

Secret Leak Check

OK No secrets detected in this PR's diff.

On schedule / workflow_dispatch / release / push there's no PR to
comment on, so a failing red Actions run is the only signal — easy
to miss across many repos. Add an idempotent issue with label
`bumblebee-finding` + `security`:

- Marker-keyed lookup so re-runs update the same issue, not spam
- Comment per re-detection to bump notifications without losing
  the canonical body
- Skipped on pull_request (the PR comment is the right surface)
- Skipped when total=0 (don't open empty issues)

Auto-create the labels in case the consumer repo doesn't have
them yet. Requires `issues: write` — added to both the reusable
permissions block and the template wrapper.
@github-actions
Copy link
Copy Markdown
Contributor

Secret Leak Check

OK No secrets detected in this PR's diff.

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

♻️ Duplicate comments (1)
workflow-templates/bumblebee-scan.yml (1)

21-21: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Pin reusable workflow to an immutable SHA

Line 21 still uses @v1, which is mutable. Please pin geolonia/.github/.github/workflows/reusable-bumblebee-scan.yml to a full 40-char commit SHA to prevent silent drift in a security-sensitive workflow.

🤖 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 `@workflow-templates/bumblebee-scan.yml` at line 21, The workflow call uses a
mutable tag "geolonia/.github/.github/workflows/reusable-bumblebee-scan.yml@v1";
replace the tag with the repository's full 40-character commit SHA (e.g.,
geolonia/.github/.github/workflows/reusable-bumblebee-scan.yml@<40-char-sha>) so
the reusable workflow is pinned immutably; update the string wherever
"reusable-bumblebee-scan.yml@v1" appears (search for that exact token) and
commit the change.
🤖 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.

Duplicate comments:
In `@workflow-templates/bumblebee-scan.yml`:
- Line 21: The workflow call uses a mutable tag
"geolonia/.github/.github/workflows/reusable-bumblebee-scan.yml@v1"; replace the
tag with the repository's full 40-character commit SHA (e.g.,
geolonia/.github/.github/workflows/reusable-bumblebee-scan.yml@<40-char-sha>) so
the reusable workflow is pinned immutably; update the string wherever
"reusable-bumblebee-scan.yml@v1" appears (search for that exact token) and
commit the change.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 3b6f4718-3d0b-4796-99b2-f5bc003064e6

📥 Commits

Reviewing files that changed from the base of the PR and between 940da48 and e86fcd5.

📒 Files selected for processing (1)
  • workflow-templates/bumblebee-scan.yml

- shasum: grep "${ASSET}" -> grep -F "${ASSET}" (literal match;
  the dots in the filename were regex wildcards)
- template properties: add pyproject.toml, requirements.txt,
  poetry.lock, Pipfile.lock so the template surfaces for Python
  repos as the description promises

Not addressed: SHA-pinning the reusable workflow @v1 reference.
The whole org convention (reusable-secret-leak-check, cdk-deploy-
monitor, release-auto-on-tag) uses floating @v1 specifically so
the org can ship a centralized fix without every consumer repo
re-pinning. Pinning to a SHA here would defeat that model.
@github-actions
Copy link
Copy Markdown
Contributor

Secret Leak Check

OK No secrets detected in this PR's diff.

@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

🤖 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/reusable-bumblebee-scan.yml:
- Around line 209-257: The step uses MARKER ("<!-- bumblebee-finding-issue-v1
-->") to locate an existing tracking issue but searches the repo for a body that
starts with that marker while BODY_FILE (steps.comment.outputs.body_file)
actually contains a different marker ("<!-- bumblebee-reusable-v1 -->"), so the
lookup never matches and new issues are created; fix by ensuring the issue body
used for search contains the MARKER before calling gh issue list — for example,
prepend MARKER into the file referenced by BODY_FILE (or write a temp file
combining MARKER + contents of steps.comment.outputs.body_file) so the gh issue
list startswith check and subsequent gh issue edit/create use the same marker
(referencing MARKER and BODY_FILE in this step and the gh issue list/gh issue
edit commands).
🪄 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: ASSERTIVE

Plan: Pro

Run ID: 21b198ec-7c6c-49c0-a842-aed50e1e0117

📥 Commits

Reviewing files that changed from the base of the PR and between e86fcd5 and 6d3b6ca.

📒 Files selected for processing (3)
  • .github/workflows/reusable-bumblebee-scan.yml
  • workflow-templates/bumblebee-scan.properties.json
  • workflow-templates/bumblebee-scan.yml

The tracking-issue step was reusing the PR-comment body file
(starts with `<!-- bumblebee-reusable-v1 -->`) but searching
for existing issues whose body starts with the *issue* marker
`<!-- bumblebee-finding-issue-v1 -->`. They never matched, so
every scheduled run would open a fresh duplicate issue instead
of updating the existing one.

Build a separate `issue-body.md` that strips the PR-comment
marker and prepends the issue marker. Use that for both create
and edit calls.
@github-actions
Copy link
Copy Markdown
Contributor

Secret Leak Check

OK No secrets detected in this PR's diff.

@dkastl
dkastl merged commit d26766b into main May 25, 2026
1 check passed
@dkastl
dkastl deleted the feat/reusable-bumblebee-scan branch May 25, 2026 06:06
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

0