AssumeRoleCredentialProvider replaces non-RuntimeException failures with TypeError
Maintainer thường phản hồi trong vòng 1 ngày
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 25/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- aws, php
- Lĩnh vực
- authentication, cloud
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- PHP
- Star
- 6.2k
- Fork
- 1.3k
- Merge trung bình
- 4 ngày 15 giờ
- Pull request đã merge (30 ngày)
- 22
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của aws/aws-sdk-php
-
bug p2 queued service-api
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 50/100
aws/aws-sdk-php#3395 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
RDS auth tokens and presigned URLs get an expiry one hour too long during the autumn DST changeCó thể đã có người làm @stobrien89 đã nhận 6 ngày trước. Đang mởbug
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 55/100
aws/aws-sdk-php#3392 · 2 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
The SDK now requires PHP 8.2 or laterCó thể đã có người làm @stobrien89 đã nhận 17 ngày trước. Đang mởannouncement SECURITY
aws/aws-sdk-php#3385 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Shared config file is read and parsed repeatedly when creating a clientCó thể đã có người làm @LukaszFilipowski đã nhận 6 ngày trước. Đang mởfeature-request p3
Độ khó 3/5 Nửa ngày Mức phù hợp với người mới 45/100
aws/aws-sdk-php#3377 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
announcement
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 12/100
aws/aws-sdk-php#3369 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của aws/aws-sdk-php
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
shukiv/jabali-panel#2423 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
-
customer-reported enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
MagnaCapax/PMSS#1252 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 79/100
smarty-php/smarty#1220 ·
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
StarCitizenWiki/mediawiki-extensions-EmbedVideo#224 · 1 bình luận ·