Skip to content

Commit bc5b093

Browse files
authored
Update python-app.yml
1 parent 9ee6ede commit bc5b093

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

.github/workflows/python-app.yml

+7-3
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)