Skip to content

Commit 83bab00

Browse files
authored
Remove Composer token leak mitigation (#48783)
1 parent 979a3dc commit 83bab00

1 file changed

Lines changed: 0 additions & 25 deletions

File tree

.github/actions/tool-setup/action.yml

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -52,36 +52,11 @@ runs:
5252
done
5353
done
5454
55-
# Composer <=2.9.7 rejects the new GITHUB_TOKEN token format.
56-
# It validates GH tokens against `^[.A-Za-z0-9_]+$`:
57-
# https://github.com/composer/composer/blob/2.9.7/src/Composer/IO/BaseIO.php#L142-L144
58-
#
59-
# When we get a new-format token, let's pass a blank string so it uses an unauth call,
60-
# but keep using the old-format token when issued to reduce the chances rate limiting.
61-
#
62-
# See: https://github.com/composer/composer/issues/12849
63-
# https://github.blog/changelog/2026-04-24-notice-about-upcoming-new-format-for-github-app-installation-tokens/
64-
- name: Check github-token format for setup-php
65-
id: gh_token_check
66-
if: steps.versions.outputs.php-version != 'false'
67-
shell: bash
68-
env:
69-
RAW: ${{ github.token }}
70-
run: |
71-
if [[ "$RAW" =~ ^[.A-Za-z0-9_]+$ ]]; then
72-
echo "Old-format token will be accepted by composer, so it's safe to use."
73-
echo "oldschooltoken=true" >> "$GITHUB_OUTPUT"
74-
else
75-
echo "New-format token would be rejected by composer; let's use a blank token."
76-
echo "oldschooltoken=false" >> "$GITHUB_OUTPUT"
77-
fi
78-
7955
- name: Setup PHP
8056
if: steps.versions.outputs.php-version != 'false'
8157
uses: shivammathur/setup-php@v2
8258
with:
8359
php-version: ${{ steps.versions.outputs.php-version }}
84-
github-token: ${{ steps.gh_token_check.outputs.oldschooltoken == 'true' && github.token || '' }}
8560
ini-values: error_reporting=E_ALL, display_errors=On, zend.assertions=1
8661
tools: composer:${{ steps.versions.outputs.composer-version }}
8762
extensions: mysql, imagick

0 commit comments

Comments
 (0)