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

Revert s3 bucket ownership enforce rule #159

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 6 additions & 21 deletions api/src/gmsa_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2695,27 +2695,13 @@ std::string retrieve_credspec_from_s3( std::string s3_arn, std::string region,
std::cerr << objectName;
return dummy_credspec;
}

// regex for callerId
std::regex callerIdRegex( "^\\d{12}$" );
std::string callerId = get_caller_id( region, creds );
if ( callerId.empty() && !std::regex_match( callerId, callerIdRegex ) )
{
std::cerr << Util::getCurrentTime() << '\t'
<< "ERROR: Unable to get caller information" << std::endl;
return std::string( "" );
}

Aws::S3::S3Client s3Client(
credentials,
Aws::MakeShared<Aws::S3::S3EndpointProvider>( Aws::S3::S3Client::ALLOCATION_TAG ),
clientConfig );
Aws::S3::S3Client s3Client (credentials,Aws::MakeShared<Aws::S3::S3EndpointProvider>
(Aws::S3::S3Client::ALLOCATION_TAG), clientConfig);
Aws::S3::Model::GetObjectRequest request;
request.SetExpectedBucketOwner( callerId );
request.SetBucket( s3Bucket );
request.SetKey( objectName );
Aws::S3::Model::GetObjectOutcome outcome = s3Client.GetObject( request );

request.SetBucket(s3Bucket);
request.SetKey(objectName);
Aws::S3::Model::GetObjectOutcome outcome =
s3Client.GetObject(request);
if ( !outcome.IsSuccess() )
{
const Aws::S3::S3Error& err = outcome.GetError();
Expand Down Expand Up @@ -2824,5 +2810,4 @@ retrieve_credspec_from_secrets_manager( std::string sm_arn, std::string region,
}
return { "", "", "", "" };
}

#endif