-
Notifications
You must be signed in to change notification settings - Fork 542
support jwt in aws wif #2766
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
base: main
Are you sure you want to change the base?
support jwt in aws wif #2766
Changes from 4 commits
3a2564e
bbba8cd
d504821
6645b36
6fb9276
5e91529
3e48a3f
eced7bd
235851e
83bf480
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -333,6 +333,38 @@ def test_aws_impersonation_calls_correct_apis_for_each_role_in_impersonation_pat | |
| assert fake_aws_environment.assume_role_call_count == 2 | ||
|
|
||
|
|
||
| @pytest.mark.parametrize( | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We also need to have e2e test in test/wif/test_wif.py (ask llm to explain how that e2e test is executed)
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for comments! I have 2 questions to get the e2e test working:
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. seems
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are the changes available on preprod? We could write a test there first and later switch to sfctest0 Ping @sfc-gh-akolodziejczyk on Slack to get access to the accounts we use for wif e2e tests. e2e tests are super important, as when we worked on WIF in other drivers based on Python implementation, we had some drivers not connecting because of wrong implementation
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for the suggestion. The e2e test test_should_authenticate_using_aws_outbound_token is added in test/wif/test_wif.py. I've also manually validated the full flow on qa6 using the current branch(AWS VM) across all 4 scenarios and details are in Description section. |
||
| "env_value,expected_format", | ||
| [ | ||
| ("true", "jwt"), | ||
| ("false", "old"), | ||
| (None, "old"), | ||
| ], | ||
| ) | ||
| def test_aws_token_format_based_on_env_variable( | ||
| fake_aws_environment: FakeAwsEnvironment, | ||
| monkeypatch, | ||
| env_value, | ||
| expected_format, | ||
| ): | ||
| """Test that AWS uses correct token format based on ENABLE_AWS_WIF_OUTBOUND_TOKEN environment variable.""" | ||
| if env_value is not None: | ||
| monkeypatch.setenv("ENABLE_AWS_WIF_OUTBOUND_TOKEN", env_value) | ||
|
|
||
| auth_class = AuthByWorkloadIdentity(provider=AttestationProvider.AWS) | ||
| auth_class.prepare(conn=None) | ||
|
|
||
| data = extract_api_data(auth_class) | ||
|
|
||
| assert data["AUTHENTICATOR"] == "WORKLOAD_IDENTITY" | ||
| assert data["PROVIDER"] == "AWS" | ||
|
|
||
| if expected_format == "jwt": | ||
| assert data["TOKEN"] == fake_aws_environment.web_identity_token | ||
| else: | ||
| verify_aws_token(data["TOKEN"], fake_aws_environment.region) | ||
|
|
||
|
|
||
| # -- GCP Tests -- | ||
|
|
||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.