Skip to content

Commit 344abd6

Browse files
security: fix vulnerabilities in release skill
Fixed security issues identified in release automation: 1. Symlink attack prevention: - Replaced predictable /tmp/pub-dry-run.log with mktemp - Added trap to cleanup temporary file on exit - Prevents attacker from creating symlink to overwrite sensitive files 2. Authentication validation: - Added GitHub CLI authentication check before release operations - Prevents partial release if gh auth fails mid-execution 3. Variable expansion safety: - Fixed PRERELEASE variable to use parameter expansion syntax - Prevents word splitting issues Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 4ee7ad4 commit 344abd6

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

.claude/skills/release/skill.sh

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,18 @@ git diff-index --quiet HEAD -- || error "Working tree has uncommitted changes"
2828
PUBSPEC_VERSION=$(grep '^version:' pubspec.yaml | awk '{print $2}')
2929
[[ "$PUBSPEC_VERSION" != "$VERSION" ]] && error "Version mismatch! pubspec.yaml: $PUBSPEC_VERSION, requested: $VERSION"
3030

31+
# Verify authentication
32+
gh auth status &>/dev/null || error "GitHub CLI not authenticated. Run: gh auth login"
33+
3134
success "Pre-flight checks passed"
3235

36+
# Create temporary file for dry-run output (prevents symlink attacks)
37+
DRY_RUN_LOG=$(mktemp)
38+
trap "rm -f '$DRY_RUN_LOG'" EXIT
39+
3340
# Dry run
3441
info "Running pub publish dry-run..."
35-
if ! flutter packages pub publish --dry-run 2>&1 | tee /tmp/pub-dry-run.log; then
42+
if ! flutter packages pub publish --dry-run 2>&1 | tee "$DRY_RUN_LOG"; then
3643
echo ""
3744
read -p "Dry-run found warnings. Continue? (y/N) " -n 1 -r
3845
echo
@@ -59,7 +66,7 @@ GH_RELEASE_URL=$(gh release create "v${VERSION}" \
5966
--notes "$RELEASE_NOTES" \
6067
--target master \
6168
--draft \
62-
$PRERELEASE)
69+
${PRERELEASE:+$PRERELEASE})
6370

6471
success "GitHub draft release created!"
6572

0 commit comments

Comments
 (0)