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

Wincred not support more than 2600 bytes #308

Closed
monwolf opened this issue Mar 23, 2022 · 3 comments
Closed

Wincred not support more than 2600 bytes #308

monwolf opened this issue Mar 23, 2022 · 3 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@monwolf
Copy link
Contributor

monwolf commented Mar 23, 2022

Hi,

I'm opening this issue because¡ I tried to update from v to v1.7.4 and I saw windows support is broken due to a limitation on the wincred manager. When I try to run the newer version I'm getting the error:

level=warning msg="Unable to cache role credentials in secure store" func=main.GetRoleCredentials file="/Users/aturner/go/src/github.com/synfinatic/aws-sso-cli/cmd/main.go:280" error="El fragmento ha recibido datos incorrectos."

After searching a bit on the Internet I saw the issue:

danieljoos/wincred#18

That is related to this error message, so I debugged the application and saw the JSON we are trying to save has around 3.7K bytes.

To Reproduce:
aws-sso exec -A "my-account" --role=AdministratorAccess aws eks get-token --cluster-name my-cluster

Expected behavior:

I expect all work fine :)

Screenshots:

Error:

image

Cause:
image

Desktop (please complete the following information):

  • OS: Windows
  • Version 10

Additional context:
danieljoos/wincred#18

Contents of ~/.aws-sso/config.yaml:

SSOConfig:
    xxxx-sso:
        SSORegion: us-east-1
        StartUrl: https://xxxxx.awsapps.com/start
DefaultSSO: xxxx-sso
LogLevel: warn
LogLines: true
UrlAction: open
SecureStore: wincred 
@monwolf monwolf added the bug Something isn't working label Mar 23, 2022
@monwolf
Copy link
Contributor Author

monwolf commented Mar 23, 2022

@synfinatic I think I could split it into chunks of 2K save it and then reconstruct it for recovery. What do you think about this?

Your patch is a little bit "tricky", it only "works" if Windows is installed with the ENG locale xD

	// Work around bogus errors wincred storage issue.  Sadly doesn't seem
	// like we can tell if are using windcred, so just key off of the OS
	// https://github.com/99designs/keyring/issues/99
	if err != nil && runtime.GOOS == "windows" && err.Error() == "The stub received bad data." {
		return nil
	}
	return err

@synfinatic
Copy link
Owner

Oh, is that what is going on... that's just lovely. :-/

In theory, I would be open to looking at a patch which breaks the JSON blob into 2K chunks... I have a few concerns, but haven't thought about it enough yet to know if they are legit or not- mostly just about keeping the code clean and maintainable.

If you do submit a patch, please include unit tests.

@monwolf
Copy link
Contributor Author

monwolf commented Mar 24, 2022

With this patch I've been able to run it on windows without problems

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants