Composer could print an access token in full when run with -vvv, its most detailed debug output. It already hid passwords in repository and package URLs, but not the username part. Services like GitHub let you put a token there, as in https://[email protected]/owner/repo, so the token could end up in a log.
Only people who can read that debug output see the token.
Who is affected
The Composer advisory says you're only exposed when all of these are true:
- A token sits in the username part of a URL Composer uses, for example in a
repositoriesentry, rather than inauth.jsonorCOMPOSER_AUTH. - You run Composer with
-vvv. - That output is kept or shared, such as in public CI logs or pasted into an issue.
The most likely case is a GitHub personal access token in a URL on a CI machine that saves verbose output.
What to do
Update composer/composer to 2.10.2, or to 2.2.29 if you stay on 2.2. The fix hides the username the same way as the password. Until you can update, don't run -vvv where output is saved, and move tokens into auth.json or COMPOSER_AUTH. Clean up old CI logs that may hold a token, and replace any token that leaked.
Reported by iliaal.