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

FileProfileImporter breaks if profile names contain whitespace #43

Open
aph3rson opened this issue Nov 3, 2023 · 0 comments
Open

FileProfileImporter breaks if profile names contain whitespace #43

aph3rson opened this issue Nov 3, 2023 · 0 comments

Comments

@aph3rson
Copy link

aph3rson commented Nov 3, 2023

private static final Pattern awsProfileStartPattern = Pattern.compile("\\s*\\[(?:profile\\s)?(\\S+)\\]\\s*", Pattern.CASE_INSENSITIVE);

The above line is used during the import process for profile files (either exported by AWS Signer, or from the ~/.aws/config file locally). The former supports profile names with spaces in them. However, importing these files breaks, with AWS Signer detecting no profiles in the file:

[DEBUG] Import Profile Button Clicked.
[DEBUG] Selected path from file dialog: /fake_path/aws_signer.ini
[INFO] Imported 0 profile(s) from file: /fake_path/aws_signer.ini

Here's an example export file from AWS Signer that causes this:

[profile Foo: Bar]
signer_enabled=true
signer_in_scope_only=true
credential_process=/fake_path/bin/gimme --account foo --role bar
duration_seconds=60

[profile Foo external]
signer_enabled=true
signer_in_scope_only=true
role_arn=arn:aws:iam::123456789012:role/external
source_profile=Foo: Bar
role_session_name=aph3rson_external

[profile Foo: Baz]
signer_enabled=true
signer_in_scope_only=true
credential_process=/fake_path/bin/gimme --account foo --role baz
duration_seconds=60

[profile Creds: OhYes]
signer_enabled=true
signer_in_scope_only=true
credential_process=/fake_path/bin/gimme --account creds --role ohyes
duration_seconds=60

It may be more appropriate to use an INI library for this - the ~/.aws/config file is INI-formatted, as mentioned here if that's what AWS Signer is shooting for.

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

No branches or pull requests

1 participant