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
10 changes: 6 additions & 4 deletions .github/workflows/deploy-cors-proxy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
- name: Deploy to CORS proxy server
shell: bash
env:
CUSTOM_SUPPORTED_ORIGINS_SPACE_SEPARATED: ${{ secrets.CUSTOM_SUPPORTED_ORIGINS_SPACE_SEPARATED }}
CUSTOM_SUPPORTED_ORIGINS_SPACE_SEPARATED: ${{ vars.CUSTOM_SUPPORTED_ORIGINS_SPACE_SEPARATED }}
run: |
mkdir -p ~/.ssh
echo "${{ secrets.DEPLOY_CORS_PROXY_TARGET_HOST_KEY }}" >> ~/.ssh/known_hosts
Expand Down Expand Up @@ -73,13 +73,15 @@ jobs:
CUSTOM_ORIGINS_PHP="<?php define('PLAYGROUND_CORS_PROXY_SUPPORTED_ORIGINS', array("

for origin in $CUSTOM_SUPPORTED_ORIGINS_SPACE_SEPARATED; do
# NOTE: These patterns are not perfect but should be sufficient here.
if ! (
[[ $origin =~ ^https?://([a-zA-Z0-9-]+\.)*[a-zA-Z]{2,}$ ]] ||
[[ $origin =~ ^https?://([0-9]{1,3}\.){3}[0-9]{1,3}$ ]] ||
[[ $origin =~ ^https?://^([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$ ]]
[[ $origin =~ ^https?:\/\/([a-zA-Z0-9-]+\.)*[a-zA-Z]{2,}(:[[:digit:]]{1,5})?$ ]] ||
[[ $origin =~ ^https?://([0-9]{1,3}\.){3}[0-9]{1,3}(:[[:digit:]]{1,5})?$ ]] ||
[[ $origin =~ ^https?://^([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}(:[[:digit:]]{1,5})?$ ]]
); then
echo "Unable to use CUSTOM_SUPPORTED_ORIGINS_SPACE_SEPARATED"
echo "Invalid origin: '$origin'"
echo "Full contents: '${CUSTOM_SUPPORTED_ORIGINS_SPACE_SEPARATED}'"
exit -1;
fi

Expand Down
Loading