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/credential: Increase credential_process provider default buffer size #2329

Merged
merged 2 commits into from
Dec 6, 2018
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion aws/credentials/processcreds/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ const (

// DefaultBufSize limits buffer size from growing to an enormous
// amount due to a faulty process.
DefaultBufSize = 512
DefaultBufSize = 1024

// DefaultTimeout default limit on time a process can run.
DefaultTimeout = time.Duration(1) * time.Minute
Expand Down
23 changes: 23 additions & 0 deletions aws/credentials/processcreds/provider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,29 @@ func TestProcessProviderTimeout(t *testing.T) {

}

func TestProcessProviderWithLongSessionToken(t *testing.T) {
oldEnv := preserveImportantStashEnv()
defer awstesting.PopEnv(oldEnv)

creds := processcreds.NewCredentials(
fmt.Sprintf(
"%s %s",
getOSCat(),
strings.Join(
[]string{"testdata", "longsessiontoken.json"},
string(os.PathSeparator))))
v, err := creds.Get()
if err != nil {
t.Errorf("expected %v, got %v", "no error", err)
}

// Text string same length as session token returned by AWS for AssumeRoleWithWebIdentity
e := "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
if a := v.SessionToken; e != a {
t.Errorf("expected %v, got %v", e, a)
}
}

type credentialTest struct {
Version int
AccessKeyID string `json:"AccessKeyId"`
Expand Down
8 changes: 8 additions & 0 deletions aws/credentials/processcreds/testdata/longsessiontoken.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"Version": 1,
"AccessKeyId": "ASIAXXXXXXXXXXXXXXXX",
"Expiration": "2199-01-01T00:00:00Z",
"SecretAccessKey": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"SessionToken":
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
}