AssumeRoleCredentialProvider replaces non-RuntimeException failures with TypeError
I maintainer di solito rispondono entro 1 giorno
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 25/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Ferma
- Stack tecnologico
- aws, php
- Ambito
- authentication, cloud
Direzione di ricerca
The fault is in the rejection callback of AssumeRoleCredentialProvider::__invoke(), which type-hints RuntimeException. Run the reproduction script from the issue to see the TypeError. Done means Throwable is accepted, RuntimeException keeps its current handling, and other failures are rethrown unchanged with getPrevious() intact. Pull request #3372 already targets this, so check it before starting.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Describe the bug
When an STS request throws an exception that doesn’t extend RuntimeException, AssumeRoleCredentialProvider replaces it with a TypeError and loses the original exception.
Regression Issue
- Select this option if this issue appears to be a regression.
Expected Behavior
I think other exceptions should pass through unchanged instead of being replaced with a type error.
Current Behavior
The example below fails with:
Argument #1 ($exception) must be of type RuntimeException, Exception given
The original exception is also lost: getPrevious() returns null.
Reproduction Steps
This example reproduces it without making any network requests or needing an AWS account.
Install aws/aws-sdk-php version 3.399.2, then run:
<?php
require 'vendor/autoload.php';
$client = new Aws\Sts\StsClient([
'region' => 'us-east-1',
'version' => '2011-06-15',
'credentials' => ['key' => 'test', 'secret' => 'test'],
'http_handler' => function () {
throw new Exception('Request cancelled');
},
]);
$provider = new Aws\Credentials\AssumeRoleCredentialProvider([
'client' => $client,
'assume_role_params' => [
'RoleArn' => 'arn:aws:iam::123456789012:role/test',
'RoleSessionName' => 'test',
],
]);
$provider()->wait();
Possible Solution
The rejection callback in AssumeRoleCredentialProvider::__invoke() only accepts RuntimeException. It could accept Throwable, keep the existing handling for RuntimeException, and rethrow other failures unchanged.
Additional Information/Context
The same callback is still present on master.
SDK version used
3.399.2
Environment details (Version of PHP (php -v)? OS name and version, etc.)
PHP 8.4.25, Ubuntu 24.04.
Generated by Codex, and reviewed by @binaryfire.
- Lingua principale
- PHP
- Stelle
- 6.2k
- Fork
- 1.3k
- Merge medio
- 2g 4h
- PR unite (30g)
- 10
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di aws/aws-sdk-php
-
feature-request needs-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
aws/aws-sdk-php#3365 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 3/5 Mezza giornata Idoneità per principianti 45/100
aws/aws-sdk-php#3377 ·
I maintainer di solito rispondono entro 1 giorno
-
Event stream decoder drops the final event when reading it reaches EOFForse già presa @lazerg l’ha presa 3 giorni fa. Aperta
Difficoltà 3/5 Mezza giornata Idoneità per principianti 62/100
aws/aws-sdk-php#3374 ·
I maintainer di solito rispondono entro 1 giorno
-
Event stream decoder reports a checksum mismatch when the checksum is read in partsForse già presa @lazerg l’ha presa 7 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 25/100
aws/aws-sdk-php#3371 ·
I maintainer di solito rispondono entro 1 giorno
-
announcement
Difficoltà 4/5 3-5 giorni Idoneità per principianti 12/100
aws/aws-sdk-php#3369 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di aws/aws-sdk-php
Issue simili
-
loginWithCustomTokenExchange() fails when an organization is configuredForse già presa @awss1i l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
auth0/auth0-PHP#883 · 1 commento ·
I maintainer di solito rispondono entro 2 giorni
-
type/bug
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 75/100
flarum/framework#5231 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
major-release
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 67/100
Intervention/image#1553 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
omegaup/omegaup#10353 · 1 commento ·
I maintainer di solito rispondono entro 5 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 61/100