Skip to content

Commit 0ac1bb4

Browse files
committed
ci(desktop): draw the GITHUB_ENV delimiter at random
A credential containing the fixed heredoc marker could close its own value and let the remainder become separate environment entries.
1 parent 98a4392 commit 0ac1bb4

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

.github/workflows/desktop-release.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,14 @@ jobs:
144144
IN_APPLE_API_ISSUER: ${{ secrets.APPLE_API_ISSUER }}
145145
IN_APPLE_API_KEY_P8: ${{ secrets.APPLE_API_KEY_P8 }}
146146
run: |
147+
# A fixed heredoc marker lets a credential that happens to contain that
148+
# line close its own value early and turn the rest into environment
149+
# entries. Draw the delimiter at random so no secret can carry it.
150+
delimiter="EOF_$(openssl rand -hex 16)"
147151
for name in CSC_LINK CSC_KEY_PASSWORD CSC_NAME APPLE_ID APPLE_APP_SPECIFIC_PASSWORD APPLE_TEAM_ID APPLE_API_KEY_ID APPLE_API_ISSUER; do
148152
input="IN_${name}"
149153
value="${!input:-}"
150-
if [ -n "$value" ]; then printf '%s<<__EOF__\n%s\n__EOF__\n' "$name" "$value" >> "$GITHUB_ENV"; fi
154+
if [ -n "$value" ]; then printf '%s<<%s\n%s\n%s\n' "$name" "$delimiter" "$value" "$delimiter" >> "$GITHUB_ENV"; fi
151155
done
152156
# The App Store Connect key is held as base64 because it is a file, not a
153157
# string. notarytool and electron-builder both want a path, so materialize

0 commit comments

Comments
 (0)