Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AWS Inspector client does not build the request correctly #5157

Closed
javaduke opened this issue Apr 26, 2024 · 1 comment
Closed

AWS Inspector client does not build the request correctly #5157

javaduke opened this issue Apr 26, 2024 · 1 comment
Labels
bug This issue is a bug. needs-triage This issue or PR still needs to be triaged.

Comments

@javaduke
Copy link

Describe the bug

My test code is very simple:

InspectorClient inspectorClient = InspectorClient.builder()
                .region(Region.US_WEST_2)
                .httpClientBuilder(
                    ApacheHttpClient.builder()
                )
                .build();

        ListFindingsRequest request = ListFindingsRequest.builder().build();
        ListFindingsResponse response = inspectorClient.listFindings(request);

When I run it, it returns no errors, bu the list of ARNs is empty. It does return pagination token though. I enabled HTTP wire logging to see what actually gets sent to the AWS and found that it sends an empty HTTTP POST request to the / URI and the response is 200 with empty body. Here's what it looks like:

software.amazon.awssdk.request: Sending Request: DefaultSdkHttpFullRequest(httpMethod=POST, protocol=https, host=inspector.us-west-2.amazonaws.com, encodedPath=/, headers=[amz-sdk-invocation-id, Content-Length, Content-Type, User-Agent, X-Amz-Target], queryParameters=[])    
DEBUG org.apache.http.client.protocol.RequestAddCookies: CookieSpec selected: default    
DEBUG org.apache.http.client.protocol.RequestAuthCache: Auth cache not set in the context    
DEBUG org.apache.http.wire: http-outgoing-0 >> "POST / HTTP/1.1[\r][\n]"    
DEBUG org.apache.http.wire: http-outgoing-0 >> "Host: inspector.us-west-2.amazonaws.com[\r][\n]"    
DEBUG org.apache.http.wire: http-outgoing-0 >> "amz-sdk-invocation-id: e7f4d1b1-93cb-b4d4-fbac-6435d97e7501[\r][\n]"    
DEBUG org.apache.http.wire: http-outgoing-0 >> "amz-sdk-request: attempt=1; max=4[\r][\n]"    
DEBUG org.apache.http.wire: http-outgoing-0 >> "Authorization: xxxxx[\r][\n]"    
DEBUG org.apache.http.wire: http-outgoing-0 >> "User-Agent: aws-sdk-java/2.24.9 Mac_OS_X/14.4.1 Java_HotSpot_TM__64-Bit_Server_VM/21.0.1+12-jvmci-23.1-b19 Java/21.0.1 scala/2.13.13 vendor/Oracle_Corporation io/sync http/Apache cfg/retry-mode/legacy[\r][\n]"    
DEBUG org.apache.http.wire: http-outgoing-0 >> "x-amz-content-sha256: 44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8a[\r][\n]"    
DEBUG org.apache.http.wire: http-outgoing-0 >> "X-Amz-Date: 20240426T171534Z[\r][\n]"    
DEBUG org.apache.http.wire: http-outgoing-0 >> "X-Amz-Target: InspectorService.ListFindings[\r][\n]"    
DEBUG org.apache.http.wire: http-outgoing-0 >> "Content-Length: 2[\r][\n]"    
DEBUG org.apache.http.wire: http-outgoing-0 >> "Connection: Keep-Alive[\r][\n]"    
DEBUG org.apache.http.wire: http-outgoing-0 >> "[\r][\n]"    
DEBUG org.apache.http.wire: http-outgoing-0 >> "{}"    
DEBUG org.apache.http.wire: http-outgoing-0 << "HTTP/1.1 200 OK[\r][\n]"    
DEBUG org.apache.http.wire: http-outgoing-0 << "x-amzn-RequestId: 08cbf55c-7ea2-4d10-aa77-c19d93b5bac9[\r][\n]"    
DEBUG org.apache.http.wire: http-outgoing-0 << "Content-Type: application/x-amz-json-1.1[\r][\n]"    
DEBUG org.apache.http.wire: http-outgoing-0 << "Content-Length: 141[\r][\n]"    
DEBUG org.apache.http.wire: http-outgoing-0 << "Date: Fri, 26 Apr 2024 17:15:34 GMT[\r][\n]"    
DEBUG org.apache.http.wire: http-outgoing-0 << "[\r][\n]"    
DEBUG software.amazon.awssdk.request: Received successful response: 200, Request ID: 08cbf55c-7ea2-4d10-aa77-c19d93b5bac9, Extended Request ID: not available    
DEBUG org.apache.http.wire: http-outgoing-0 << "{"findingArns":[],"nextToken":"AAIAAWWZlFboDDHZ0M4iqcEvTrRoQCk1rhPwNfQYIiVPIjXpqWVNuwxopbSUUMHzSGdcWEtccHtfl4OWQBxI820saB7_iBKNot1hp76WUQ=="}"    

Expected Behavior

I expected the call to return list of ARNs.

Current Behavior

The list of ARNs is empty.

Reproduction Steps

InspectorClient inspectorClient = InspectorClient.builder()
                .credentialsProvider(portXAWSCredentialsProvider)
                .region(Region.US_WEST_2)
                .httpClientBuilder(
                    ApacheHttpClient.builder()
                )
                .build();

ListFindingsRequest request = ListFindingsRequest.builder().build();
ListFindingsResponse response = inspectorClient.listFindings(request);

Possible Solution

No response

Additional Information/Context

No response

AWS Java SDK version used

2.25.38

JDK version used

java version "21.0.1" 2023-10-17 Java(TM) SE Runtime Environment Oracle GraalVM 21.0.1+12.1 (build 21.0.1+12-jvmci-23.1-b19) Java HotSpot(TM) 64-Bit Server VM Oracle GraalVM 21.0.1+12.1 (build 21.0.1+12-jvmci-23.1-b19, mixed mode, sharing)

Operating System and version

macOS 14.4.1

@javaduke javaduke added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Apr 26, 2024
Copy link

This issue is now closed. Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. needs-triage This issue or PR still needs to be triaged.
Projects
None yet
Development

No branches or pull requests

1 participant