Skip to content

Surface plugin-not-found error for ssm start-session when the plugin is missing - #10626

Open
Sanjays2402 wants to merge 1 commit into
aws:developfrom
Sanjays2402:fix-9837-ssm-plugin-check
Open

Surface plugin-not-found error for ssm start-session when the plugin is missing#10626
Sanjays2402 wants to merge 1 commit into
aws:developfrom
Sanjays2402:fix-9837-ssm-plugin-check

Conversation

@Sanjays2402

Copy link
Copy Markdown

Problem

Fixes #9837.

When aws ssm start-session is run without the session-manager-plugin installed, the CLI only discovered the missing plugin after the StartSession API call had already succeeded. It then called TerminateSession to clean up the just-started session. If the caller lacked the ssm:TerminateSession permission, that AccessDeniedException replaced the real, actionable error — telling the user they had a permissions problem when the actual problem was a missing plugin.

Fix

  • Check for the plugin (via session-manager-plugin --version) before calling StartSession. When it is missing, fail fast with the existing "SessionManagerPlugin is not found" message — no session is created, so no cleanup API call (and no extra permission) is needed.
  • As defense-in-depth, a failure of the TerminateSession cleanup in the remaining edge case (plugin vanishing mid-command) is now logged at debug level instead of masking the plugin-not-found error.

Testing

  • Reproduced the issue scenario against a mocked client: before the fix, a missing plugin combined with a denied TerminateSession surfaced AccessDeniedException; after the fix, the user gets SessionManagerPlugin is not found... and neither StartSession nor TerminateSession is called.
  • tests/unit/customizations/test_sessionmanager.py: 83 passed (added 2 regression tests; updated 2 tests for the new fail-fast ordering).
  • tests/functional/ssm/test_start_session.py: 9 passed (updated 1 test that encoded the old start-then-terminate behavior).
  • flake8 clean on all touched files.

AI disclosure

This PR was prepared with the assistance of AI coding tools; independent human review is still pending.

Previously the plugin was checked only after the StartSession API call
succeeded. When the plugin was missing, the CLI called TerminateSession
to clean up the started session; if the caller lacked the
ssm:TerminateSession permission, that AccessDenied error masked the real
"plugin not found" error.

Check for the plugin before starting the session so the actionable error
is always surfaced, and never let a cleanup failure mask it.
@Sanjays2402
Sanjays2402 requested a review from a team as a code owner September 9, 2026 18:23
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

Successfully merging this pull request may close these issues.

aws ssm start-session incorrectly returns permissions error when session-manager-plugin is not installed

1 participant