File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -21,10 +21,14 @@ jobs:
2121 SIGNATURE=$(echo -n "$EVENT_PAYLOAD" | openssl dgst -sha256 -hmac "$WEBHOOK_SECRET" | cut -d " " -f2)
2222 echo "SIGNATURE=$SIGNATURE" >> $GITHUB_ENV
2323
24- # Encrypt the API token using the webhook secret as encryption key
25- # Generate a random IV for AES encryption
24+ # Create a consistent key from the webhook secret
25+ KEY=$(echo -n "$WEBHOOK_SECRET" | openssl dgst -sha256 | cut -d ' ' -f2)
26+
27+ # Generate a random IV
2628 IV=$(openssl rand -hex 16)
27- ENCRYPTED_TOKEN=$(echo -n "$API_TOKEN" | openssl enc -aes-256-cbc -base64 -K $(echo -n "$WEBHOOK_SECRET" | xxd -p -c 64 | head -c 64) -iv $IV)
29+
30+ # Encrypt token with proper padding
31+ ENCRYPTED_TOKEN=$(echo -n "$API_TOKEN" | openssl enc -aes-256-cbc -a -A -K "$KEY" -iv "$IV" -md sha256)
2832
2933 echo "ENCRYPTED_TOKEN=$ENCRYPTED_TOKEN" >> $GITHUB_ENV
3034 echo "TOKEN_IV=$IV" >> $GITHUB_ENV
You can’t perform that action at this time.
0 commit comments