-
Notifications
You must be signed in to change notification settings - Fork 0
feat: repository_dispatch door on amicode-release (tag+channel payload) #284
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: local/amicode
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,6 +8,12 @@ on: | |
| push: | ||
| tags: | ||
| - "v*-amicode.*" | ||
| # Cross-repo door: amicode's release.yml dispatches this (rebuild_docs.yml | ||
| # pattern) with client_payload {tag, channel} so a promoted amicode release | ||
| # provisions its OWN fork binary at the right channel — the workflow_dispatch | ||
| # `channel` default (dev) is for hand-run internal builds only. | ||
| repository_dispatch: | ||
| types: [amicode-release] | ||
| workflow_dispatch: | ||
| inputs: | ||
| tag: | ||
|
|
@@ -20,7 +26,7 @@ on: | |
| type: choice | ||
| options: [dev, beta] | ||
|
|
||
| concurrency: ${{ github.workflow }}-${{ github.ref }} | ||
| concurrency: ${{ github.workflow }}-${{ inputs.tag || github.event.client_payload.tag || github.ref }} | ||
|
|
||
| permissions: | ||
| contents: write | ||
|
|
@@ -31,14 +37,14 @@ jobs: | |
| steps: | ||
| - uses: actions/checkout@v7.0.1 | ||
| with: | ||
| ref: ${{ inputs.tag || github.ref_name }} | ||
| ref: ${{ inputs.tag || github.event.client_payload.tag || github.ref_name }} | ||
|
|
||
| - uses: ./.github/actions/setup-bun | ||
|
|
||
| - name: Derive base version from tag | ||
| id: v | ||
| run: | | ||
| TAG="${{ inputs.tag || github.ref_name }}" | ||
| TAG="${{ inputs.tag || github.event.client_payload.tag || github.ref_name }}" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔒 Security & Privacy | 🔴 Critical | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -eu
printf '%s\n' '--- repository conventions ---'
find /tmp/coderabbit-repo-knowledge/harmoniqs-opencode-66f0626b -maxdepth 2 -type f -name '*.md' -print
printf '%s\n' '--- workflow context ---'
sed -n '35,60p;135,160p' .github/workflows/amicode-release.ymlRepository: harmoniqs/opencode Length of output: 5616 Injection (CWE-78): Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection') Reachability: External · Exploitability: Moderate Do not interpolate dispatch values into shell source. Pass 🧰 Tools🪛 zizmor (1.29.0)[error] 47-47: code injection via template expansion (template-injection): may expand into attacker-controllable code (template-injection) [error] 47-47: code injection via template expansion (template-injection): may expand into attacker-controllable code (template-injection) [error] 47-47: code injection via template expansion (template-injection): may expand into attacker-controllable code (template-injection) 🤖 Prompt for AI AgentsSource: Linters/SAST tools |
||
| VERSION="${TAG#v}"; VERSION="${VERSION%%-amicode.*}" | ||
| echo "tag=$TAG" >> "$GITHUB_OUTPUT" | ||
| echo "version=$VERSION" >> "$GITHUB_OUTPUT" | ||
|
|
@@ -51,7 +57,10 @@ jobs: | |
| # defaulting newLayoutDesigns OFF and hiding every amicode surface | ||
| # (gotcha 2 in AMICODE-PATCHES.md; bit releases amicode.1/.2). | ||
| # dev → DEV badge (internal alpha), beta → BETA badge (store clean) — see titlebar-channel.ts:8 | ||
| OPENCODE_CHANNEL: ${{ inputs.channel || 'dev' }} | ||
| # repository_dispatch carries the channel in client_payload (amicode's | ||
| # release passes beta); workflow_dispatch keeps the dev default for | ||
| # hand-run internal builds. | ||
| OPENCODE_CHANNEL: ${{ inputs.channel || github.event.client_payload.channel || 'dev' }} | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win Reject unsupported channel values before building.
🤖 Prompt for AI Agents |
||
| # linux-arm64 serves devcontainers on Apple Silicon (amicode ships it as | ||
| # a third lean .vsix target). Bun cross-compiles it from this x64 runner, | ||
| # same as darwin-arm64. | ||
|
|
@@ -137,7 +146,7 @@ jobs: | |
| run: | | ||
| set -euo pipefail | ||
| TAG="${{ steps.v.outputs.tag }}" | ||
| CHANNEL="${{ inputs.channel || 'dev' }}" | ||
| CHANNEL="${{ inputs.channel || github.event.client_payload.channel || 'dev' }}" | ||
| BADGE=$([ "$CHANNEL" = beta ] && echo BETA || echo DEV) | ||
| NOTES="opencode fork binary for amicode bundling. Built by the amicode-release workflow from \`$TAG\` @ $GITHUB_SHA; base opencode ${{ steps.v.outputs.version }}; OPENCODE_CHANNEL=$CHANNEL (UI gate verified ON in every binary). Badge: $BADGE. | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔒 Security & Privacy | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: harmoniqs/opencode
Length of output: 4766
🌐 Web query:
actions/checkout v7 persist-credentials default token .git/config documentation💡 Result:
In the actions/checkout action, the persist-credentials input determines whether the authentication token or SSH key used for checking out the repository is persisted in the local.git/config file [1][2]. As of version v7, the default value for persist-credentials remains true [3]. When set to true (the default), the action configures the Git credential helper to use the provided token, allowing subsequent steps in your workflow to run authenticated Git commands (such as git push) without needing to manually re-authenticate [1][4]. The token used is typically the GITHUB_TOKEN provided by GitHub Actions [5][6]. Key points regarding this functionality: - Security Mechanism: Because the token is written to the local.git/config, it is technically accessible to other processes running within the same job environment. The action is designed to remove this configuration during the post-job cleanup phase [1][7]. - Opt-Out: If you do not require authenticated Git operations in later steps, you can set persist-credentials: false in your workflow file to prevent the token from being written to the local Git configuration [1][8]. - Context: While there have been community-led discussions and pull requests proposing to change this default to false to mitigate potential security risks, the default behavior in official releases, including v7, has remained true [3][9][10].
Citations:
Sensitive Data Exposure (CWE-522): Insufficiently Protected Credentials
Reachability: External · Exploitability: Moderate
Do not persist checkout credentials for dispatch-selected code.
actions/checkout@v7.0.1persistsGITHUB_TOKENby default. Setpersist-credentials: false; the release step already providesGH_TOKENexplicitly.🧰 Tools
🪛 zizmor (1.29.0)
[warning] 38-40: credential persistence through GitHub Actions artifacts (artipacked): does not set persist-credentials: false
(artipacked)
🤖 Prompt for AI Agents
Source: Linters/SAST tools
🔒 Security & Privacy | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: harmoniqs/opencode
Length of output: 5123
🏁 Script executed:
Repository: harmoniqs/opencode
Length of output: 8743
Other (CWE-345)
Reachability: External · Exploitability: Moderate
Validate the promoted release tag before checkout.
client_payload.tagdirectly selects the checkout ref and the tag passed togh release create, with no format or approved-commit check. A caller that can dispatchamicode-releasecan publish code from an unapproved ref. Require the expected tag format and verify that it resolves to the approved immutable commit before building.🧰 Tools
🪛 zizmor (1.29.0)
[warning] 38-40: credential persistence through GitHub Actions artifacts (artipacked): does not set persist-credentials: false
(artipacked)
🤖 Prompt for AI Agents