Avoid passing ECS session token in plugin argv#10297
Open
NguyenCong2k wants to merge 1 commit intoaws:developfrom
Open
Avoid passing ECS session token in plugin argv#10297NguyenCong2k wants to merge 1 commit intoaws:developfrom
NguyenCong2k wants to merge 1 commit intoaws:developfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the ECS execute-command integration with session-manager-plugin to avoid placing the StartSession token payload on the process command line when the installed plugin supports passing it via the AWS_SSM_START_SESSION_RESPONSE environment variable, while retaining the argv-based fallback for older plugin versions.
Changes:
- Detect
session-manager-pluginversion and, for supported versions, pass the StartSession response viaAWS_SSM_START_SESSION_RESPONSEinstead of argv. - Preserve the existing argv-based behavior when the plugin version is too old or doesn’t meet the requirement.
- Add unit test coverage for the new environment-variable path in the ECS execute-command flow.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| awscli/customizations/ecs/executecommand.py | Adds plugin version probing and switches to env-var-based StartSession response passing when supported. |
| tests/unit/customizations/ecs/test_executecommand_startsession.py | Updates existing tests for version probing and adds a new test validating the env-var path. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
87
to
+94
| # Hence, making this empty session-manager-plugin call | ||
| # before calling execute-command to ensure that | ||
| # session-manager-plugin is installed | ||
| # before execute-command-command is made | ||
| check_call(["session-manager-plugin"]) | ||
| plugin_version = check_output( | ||
| ["session-manager-plugin", "--version"], text=True | ||
| ) |
Comment on lines
202
to
217
| json.dumps(self.ssm_request_parameters), | ||
| self.endpoint_url], | ||
| self.endpoint_url], | ||
| ) |
84fad25 to
026f11a
Compare
Author
|
Thanks, addressed both comments.
Tests: python -m pytest tests\unit\customizations\test_sessionmanager.py tests\unit\customizations\ecs\test_executecommand_startsession.py -q |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
session-manager-pluginthroughAWS_SSM_START_SESSION_RESPONSEwhen the installed plugin supports itTest