Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
KA: ${{ secrets.KEYSTORE_KEY_ALIAS }}
KP: ${{ secrets.KEYSTORE_KEY_PASSWORD }}
run: |
printf '%s' "$KEYSTORE_B64" | base64 -d > "$RUNNER_TEMP/ghost-rain.jks"
echo "$KEYSTORE_B64" | base64 --decode --ignore-garbage > "$RUNNER_TEMP/ghost-rain.jks"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remediation recommended

1. Permissive base64 decode 🐞 Bug ☼ Reliability

The workflow decodes KEYSTORE_B64 with base64 --ignore-garbage, which silently discards any
non-base64 characters instead of failing fast on malformed input. This can turn a paste-corrupted
secret into a different .jks file and defer the failure to Gradle signing with harder-to-diagnose
errors.
Agent Prompt
## Issue description
The workflow currently uses `base64 --decode --ignore-garbage` to decode the keystore secret. This weakens validation by silently discarding non-base64 characters, which can produce a corrupted keystore file and move the error to a later signing step.

## Issue Context
This decoded file is then referenced via `keystore.properties` and consumed by the Android Gradle signing configuration, so failing fast at decode time is valuable for diagnosability.

## Fix Focus Areas
- .github/workflows/build.yml[20-34]

## Suggested fix
Replace the permissive decode with a strict decode while only normalizing expected whitespace (e.g., remove `\r`/newlines) and keep decode errors fatal.

Example:
```bash
printf '%s' "$KEYSTORE_B64" | tr -d '\r\n' | base64 --decode > "$RUNNER_TEMP/ghost-rain.jks"
```
(Optionally, add a small validation step to ensure the sanitized string contains only base64 characters before decoding.)

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

cat > keystore.properties <<EOF
storeFile=$RUNNER_TEMP/ghost-rain.jks
storePassword=$SP
Expand Down