Skip to content

fix: remove enr padding #7

fix: remove enr padding

fix: remove enr padding #7

name: Check Bootnodes ENRs
on:
pull_request:
branches:
- main
jobs:
check_padding:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install Python
run: |
sudo apt-get update
sudo apt-get install python3
- name: Check bootnodes ENRs have no padding
run: |
for FILE in $(find . -type f \( -name 'bootnodes.yaml' -o -name 'bootstrap_nodes.txt' \)); do
BASE64_STRINGS=$(grep -Eo '^[[:space:]]*[- ]*["]?([a-zA-Z0-9+/]+={0,2})[[:space:]]*[- ]*["]?' "$FILE" | sed 's/"//g')
for BASE64_STRING in $BASE64_STRINGS; do
if [[ "$BASE64_STRING" =~ [^A-Za-z0-9+/=] ]]; then
echo "Base64 string in $FILE contains invalid characters or padding."
exit 1
fi
done
done
- name: Decode Base64
run: |
for FILE in $(find . -type f \( -name 'bootnodes.yaml' -o -name 'bootstrap_nodes.txt' \)); do
BASE64_STRINGS=$(grep -Eo '^[[:space:]]*[- ]*["]?([a-zA-Z0-9+/]+={0,2})[[:space:]]*[- ]*["]?' "$FILE" | sed 's/"//g')
for BASE64_STRING in $BASE64_STRINGS; do
DECODED_STRING=$(echo "$BASE64_STRING" | base64 -d 2>/dev/null)
if [ $? -eq 0 ]; then
echo "Decoded base64 string in $FILE: $DECODED_STRING"
fi
done
done