Skip to content

fix(data_classes): return None from TransferFamilyAuthorizer.password when the event has none - #8715

Open
anishmehta24 wants to merge 1 commit into
aws-powertools:developfrom
anishmehta24:fix/transfer-family-password-optional
Open

anishmehta24 wants to merge 1 commit into
aws-powertools:developfrom
anishmehta24:fix/transfer-family-password-optional

Conversation

@anishmehta24

Copy link
Copy Markdown

Issue number: closes #8714

Summary

Changes

TransferFamilyAuthorizer.password is typed str | None and documented as None for non-password logins, but indexed the event directly, so an event without password raised KeyError. It now returns self.get("password"), matching the Pydantic model, which already defaults password to None. The docstring now says it's None when the event has no password (e.g. SSH key login) rather than mentioning certificates.

Added test_transfer_family_authorizer_event_without_password in tests/unit/data_classes/required_dependencies/test_transfer_family_event.py; it fails on develop with KeyError: 'password'.

User experience

Before: TransferFamilyAuthorizer(event).password raises KeyError when the event has no password. After: it returns None.


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.

@anishmehta24
anishmehta24 requested a review from a team as a code owner October 30, 2026 16:59
@anishmehta24
anishmehta24 requested a review from svozza October 30, 2026 16:59
@powertools-for-aws-oss-automation powertools-for-aws-oss-automation Bot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Oct 30, 2026
@boring-cyborg boring-cyborg Bot added the tests label Oct 30, 2026

@leandrodamascena leandrodamascena left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @anishmehta24, confirmed. Transfer Family only sends password for password logins, the AWS sample identity provider itself checks for the missing key, and our Pydantic model already defaults it to None, so the data class was the odd one out.

I'm approving now. This goes out in 3.40.0, so it will sit here for a while before I merge it. No rebase needed in the meantime, and you'll be credited in the release notes.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/S Denotes a PR that changes 10-29 lines, ignoring generated files. tests

2 participants