-
Notifications
You must be signed in to change notification settings - Fork 84
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
Cannot use Role ARN to auth for S3 bucket target #327
Comments
Thanks for reporting. |
I created a fixed version Can you overwrite the tag and check if its working? If so I will release a new chart version. |
@fjogeleit The issue with not being able to provide a blank |
Okay, thanks for your feedback. Let me know if you encounter any other issue I can help with. |
Thanks for your help so far. If you have a way to confirm that the I've verified that the env vars are present and can be used to read and write from the s3 bucket using the AWS cli. But policy-reporter returns the following error Inside the chart I have the following values set:
With the |
Okay, I will see if I can test it somehow. I have no aws cluster so I need to set the env vars manually somehow. |
i was not able to test a success case because I was not able to set up valid credentials without an ECS cluster but I changed the provider logic, so you should get a more detailed error message why your values are not working. Hope this gives more insights. I published it as version |
After much prodding, I think this code is the source of the issue if config.Endpoint == "" {
return nil
} when using go api for AWS with IRSA, the API does something to determine the correct credentials and endpoint when "Endpoint" is left blank. Attempting to specify a value for the endpoint causes some other credential related things not to be setup properly leading to failures. I wrote some code to test this: func basic_s3_uploader() {
s3Config := &aws.Config{
Region: aws.String("us-east-1"),
// Endpoint: aws.String("s3.amazonaws.com"),
LogLevel: aws.LogLevel(aws.LogDebugWithHTTPBody),
}
s3Session, sessionErr := session.NewSession(s3Config)
// svc := s3.New(s3Session)
// svc.Handlers.Send.PushFront(func(r *request.Request) {
// // Print the endpoint URL
// fmt.Println("Endpoint:", r.HTTPRequest.URL.Host)
// })
// otherInput := &s3.ListBucketsInput{}
// _, err := svc.ListBuckets(otherInput)
// if err != nil {
// print("We got a nil")
// }
if sessionErr != nil {
print("This session has failed with: " + sessionErr.Error())
}
uploader := s3manager.NewUploader(s3Session)
filename := "test-file-to-upload.txt"
file, err := os.Open(filename)
if err != nil {
fmt.Println("Failed to open file", filename, err)
os.Exit(1)
}
defer file.Close()
input := &s3manager.UploadInput{
Bucket: aws.String("my-special-bucket"), // bucket's name
Key: aws.String(filename), // files destination location
Body: file, // content of the file
}
output, err := uploader.UploadWithContext(context.Background(), input)
print(context.Background())
print(uploader)
if err != nil {
print("Error: " + err.Error())
}
print("Output: " + output.Location)
} I also isolated out the code in So if you're able to get an image up without that check on "Endpoint" which restricts it from being blank then i should be able to confirm whether that's the case. |
Hey, thanks for your investigation. Sure I will build an image with your changes |
@fjogeleit any updates on this? |
Sorry for the delay, busy week. Will have time tomorrow for this. |
I just did it directly and created a tag |
When attempting to setup the S3 target auth using only
AWS_ROLE_ARN
andAWS_WEB_IDENTITY_TOKEN_FILE
the configuration seems to fail with the error[ERROR] S3.AccessKeyID has not been declared
due toaccessKeyID
andsecretAccessKey
not being allowed to be blank.From my investigations, it seems the AWS config appears to be setup properly, but the first provider in the ChainProvider is the StaticProvider which only throws an error if the credential values (
accessKeyID
andsecretAccessKey
) are blank. Which cannot happen due to the SecurityHub error that is thrown when these values are empty strings. Because StaticProvider doesn't actually check the credentials, dummy values don't lead to a configuration error so the configuration completes and the application attempts to auth using them and fails.Policy Reporter Version: 2.12.0
Has anyone encountered this issue or have a workaround? Alternatively, am I possibly misunderstanding the configuration steps?
The text was updated successfully, but these errors were encountered: