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

Add URI S3 Client unit tests #2901

Merged
merged 1 commit into from
Mar 22, 2024
Merged

Add URI S3 Client unit tests #2901

merged 1 commit into from
Mar 22, 2024

Conversation

sbiscigl
Copy link
Contributor

Description of changes:

Adds tests for a possible URI traversal issue that the PHP SDK saw an issue with. Besides adding tests this adds a new target aws-cpp-sdk-s3-unit-tests that will run tests with a S3 client with a mocked http client.

Check all that applies:

  • Did a review by yourself.
  • Added proper tests to cover this PR. (If tests are not applicable, explain.)
  • Checked if this PR is a breaking (APIs have been changed) change.
  • Checked if this PR will not introduce cross-platform inconsistent behavior.
  • Checked if this PR would require a ReadMe/Wiki update.

Check which platforms you have built SDK on to verify the correctness of this PR.

  • Linux
  • Windows
  • Android
  • MacOS
  • IOS
  • Other Platforms

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@@ -40,6 +40,7 @@ def main():
"aws-cpp-sdk-dynamodb-integration-tests",
"aws-cpp-sdk-sqs-integration-tests",
"aws-cpp-sdk-s3-integration-tests",
"aws-cpp-sdk-s3-unit-tests",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

im adding to the run integ tests right now. likely this should be a completely seperate step in our CI, and we should have other clients in it. We can create a seperate sep once we have enough client unit tests to justify it.

//We have to mock requset because it is used to create the return body, it actually isnt used.
auto mockRequest = Aws::MakeShared<Standard::StandardHttpRequest>(ALLOCATION_TAG, "mockuri", HttpMethod::HTTP_GET);
mockRequest->SetResponseStreamFactory([]() -> IOStream* {
IOStream* stream = Aws::New<StringStream>(ALLOCATION_TAG, "response-string", std::ios_base::in | std::ios_base::binary);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"MEMORY LEAK" -- you shout

it is deleted when mockResponse is deleted in turn calling the destructor on its bodyStream, which in turn calls delete on the underlying stream.

@sbiscigl sbiscigl force-pushed the s3-uri-unit-tests branch 4 times, most recently from 146937e to bbfdd27 Compare March 22, 2024 16:04
@sbiscigl sbiscigl marked this pull request as ready for review March 22, 2024 19:36
@sbiscigl sbiscigl merged commit 6caa146 into main Mar 22, 2024
4 checks passed
@sbiscigl sbiscigl deleted the s3-uri-unit-tests branch March 22, 2024 19:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants