Conversation
Greptile SummaryThis PR adds a new GitHub Actions workflow ( Key changes:
Issues found:
Confidence Score: 4/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant Caller as External Caller
participant GH as GitHub API
participant WF as build-edge-on-demand.yml
participant Repo as Git Repository
participant Deploy as deployment.yml
Caller->>GH: POST /repos/.../dispatches<br/>{event_type: "build-edge-on-demand",<br/>client_payload: {tag_name: "..."}}
GH->>WF: Trigger repository_dispatch
WF->>Repo: checkout main (via SSH deploy key)
WF->>WF: Resolve TAG_NAME<br/>(payload or nightly-latest-timestamp)
WF->>Repo: git tag TAG_NAME
WF->>Repo: git push origin TAG_NAME
Repo-->>Deploy: Tag push event triggers deployment workflow
Deploy->>Deploy: Build & push Docker images<br/>(EDGE_TAG=true if nightly-latest*)
WF-->>Caller: Slack alert on failure
Prompt To Fix All With AIThis is a comment left during a code review.
Path: .github/workflows/build-edge-on-demand.yml
Line: 36
Comment:
**Script injection via `client_payload.tag_name`**
`${{ github.event.client_payload.tag_name }}` is interpolated directly into the shell script. This is a classic GitHub Actions script-injection vector: any user who can trigger `repository_dispatch` (i.e., anyone with repo write access) can supply a crafted `tag_name` such as `foo"; malicious_command; echo "` and have it executed in the runner's shell.
The fix is to pass the payload value through an `env:` block so it is treated as a data variable and never interpolated into the script text:
```suggestion
TAG_NAME="${TAG_NAME_INPUT}"
```
Add a corresponding `env:` block to the step:
```yaml
env:
TAG_NAME_INPUT: ${{ github.event.client_payload.tag_name }}
```
This is the pattern recommended by GitHub's [security hardening guide](https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#understanding-the-risk-of-script-injections).
How can I resolve this? If you propose a fix, please make it concise.
---
This is a comment left during a code review.
Path: .github/workflows/build-edge-on-demand.yml
Line: 33-44
Comment:
**No duplicate tag guard**
Unlike `tag-nightly.yml`, this workflow has no check for an existing tag before calling `git tag "$TAG_NAME"`. If the same `tag_name` is dispatched twice (or if the auto-generated timestamp collides), `git tag` will exit non-zero and the push will never happen — the Slack alert will fire and the workflow will fail with a somewhat opaque error.
Consider adding a guard similar to the one in `tag-nightly.yml`:
```yaml
- name: Check for existing tag
id: check_tag
run: |
if git tag --list "$TAG_NAME" | grep -q .; then
echo "Tag $TAG_NAME already exists — skipping."
echo "tag_exists=true" >> "$GITHUB_OUTPUT"
else
echo "tag_exists=false" >> "$GITHUB_OUTPUT"
fi
```
Then gate the create/push steps on `steps.check_tag.outputs.tag_exists == 'false'`.
How can I resolve this? If you propose a fix, please make it concise.Reviews (1): Last reviewed commit: "chore(deploy): Build Edge on demand" | Re-trigger Greptile |
| run: | | ||
| # Use the tag name from the dispatch payload, or generate one | ||
| TAG_NAME="${{ github.event.client_payload.tag_name }}" | ||
| if [ -z "$TAG_NAME" ]; then |
There was a problem hiding this comment.
Script injection via
client_payload.tag_name
${{ github.event.client_payload.tag_name }} is interpolated directly into the shell script. This is a classic GitHub Actions script-injection vector: any user who can trigger repository_dispatch (i.e., anyone with repo write access) can supply a crafted tag_name such as foo"; malicious_command; echo " and have it executed in the runner's shell.
The fix is to pass the payload value through an env: block so it is treated as a data variable and never interpolated into the script text:
| if [ -z "$TAG_NAME" ]; then | |
| TAG_NAME="${TAG_NAME_INPUT}" |
Add a corresponding env: block to the step:
env:
TAG_NAME_INPUT: ${{ github.event.client_payload.tag_name }}This is the pattern recommended by GitHub's security hardening guide.
Prompt To Fix With AI
This is a comment left during a code review.
Path: .github/workflows/build-edge-on-demand.yml
Line: 36
Comment:
**Script injection via `client_payload.tag_name`**
`${{ github.event.client_payload.tag_name }}` is interpolated directly into the shell script. This is a classic GitHub Actions script-injection vector: any user who can trigger `repository_dispatch` (i.e., anyone with repo write access) can supply a crafted `tag_name` such as `foo"; malicious_command; echo "` and have it executed in the runner's shell.
The fix is to pass the payload value through an `env:` block so it is treated as a data variable and never interpolated into the script text:
```suggestion
TAG_NAME="${TAG_NAME_INPUT}"
```
Add a corresponding `env:` block to the step:
```yaml
env:
TAG_NAME_INPUT: ${{ github.event.client_payload.tag_name }}
```
This is the pattern recommended by GitHub's [security hardening guide](https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#understanding-the-risk-of-script-injections).
How can I resolve this? If you propose a fix, please make it concise.| run: | | ||
| # Use the tag name from the dispatch payload, or generate one | ||
| TAG_NAME="${{ github.event.client_payload.tag_name }}" | ||
| if [ -z "$TAG_NAME" ]; then | ||
| TAG_NAME="nightly-latest-$(date -u +'%Y%m%d-%H%M%S')" | ||
| fi | ||
| echo "Creating tag: $TAG_NAME" | ||
| git tag "$TAG_NAME" | ||
| git push origin "$TAG_NAME" | ||
| - name: Send Slack notification |
There was a problem hiding this comment.
Unlike tag-nightly.yml, this workflow has no check for an existing tag before calling git tag "$TAG_NAME". If the same tag_name is dispatched twice (or if the auto-generated timestamp collides), git tag will exit non-zero and the push will never happen — the Slack alert will fire and the workflow will fail with a somewhat opaque error.
Consider adding a guard similar to the one in tag-nightly.yml:
- name: Check for existing tag
id: check_tag
run: |
if git tag --list "$TAG_NAME" | grep -q .; then
echo "Tag $TAG_NAME already exists — skipping."
echo "tag_exists=true" >> "$GITHUB_OUTPUT"
else
echo "tag_exists=false" >> "$GITHUB_OUTPUT"
fiThen gate the create/push steps on steps.check_tag.outputs.tag_exists == 'false'.
Prompt To Fix With AI
This is a comment left during a code review.
Path: .github/workflows/build-edge-on-demand.yml
Line: 33-44
Comment:
**No duplicate tag guard**
Unlike `tag-nightly.yml`, this workflow has no check for an existing tag before calling `git tag "$TAG_NAME"`. If the same `tag_name` is dispatched twice (or if the auto-generated timestamp collides), `git tag` will exit non-zero and the push will never happen — the Slack alert will fire and the workflow will fail with a somewhat opaque error.
Consider adding a guard similar to the one in `tag-nightly.yml`:
```yaml
- name: Check for existing tag
id: check_tag
run: |
if git tag --list "$TAG_NAME" | grep -q .; then
echo "Tag $TAG_NAME already exists — skipping."
echo "tag_exists=true" >> "$GITHUB_OUTPUT"
else
echo "tag_exists=false" >> "$GITHUB_OUTPUT"
fi
```
Then gate the create/push steps on `steps.check_tag.outputs.tag_exists == 'false'`.
How can I resolve this? If you propose a fix, please make it concise.
🖼️ Visual Regression Report
|
Description
Building Edge Images on demand
How Has This Been Tested?
Additional Options
Summary by cubic
Adds a GitHub Actions workflow to trigger on-demand Edge image builds by pushing a tag to
main. This enables ad-hoc builds viarepository_dispatchwithout needing a PR or merge..github/workflows/build-edge-on-demand.ymllistens forrepository_dispatchtypebuild-edge-on-demand.client_payload.tag_nameor auto-generated asnightly-latest-YYYYMMDD-HHMMSS(UTC)../.github/actions/slack-notifyusingMONITOR_DEPLOYMENTS_WEBHOOK.Written for commit b8a5caf. Summary will update on new commits.