Repository navigation
fix(parameters): do not mutate the caller's Filters list in SecretsProvider.get_multiple - #8604
Conversation
…vider.get_multiple
|
Thanks a lot for your first contribution! Please check out our contributing guidelines and don't hesitate to ask whatever you need. |
leandrodamascena
left a comment
There was a problem hiding this comment.
Thanks @wanjinhao1, confirmed and approved. I ran it against real Secrets Manager with a module-level Filters list like the one in our docs: on develop the second call already fails with "No secrets found" because the stale name filter from the first call is still in the list. With your change the list stays untouched and every call sends only its own name filter.
This goes out in 3.39.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.
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #8604 +/- ##
===========================================
- Coverage 96.95% 96.95% -0.01%
===========================================
Files 321 321
Lines 16253 16251 -2
Branches 1453 1453
===========================================
- Hits 15758 15756 -2
Misses 353 353
Partials 142 142 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
b51badc
into
aws-powertools:develop
|
Awesome work, congrats on your first merged pull request and thank you for helping improve everyone's experience! |
|
Awesome work, congrats on your first merged pull request and thank you for helping improve everyone's experience! |



Issue number: closes #8596
Summary
Changes
SecretsProvider._get_multipleappended the synthesized{"Key": "name", ...}filter to the very list the caller passed viasdk_options["Filters"](filters.append(name_filter)). A shared or module-levelFilterslist — as shown in the documentation example — therefore grew one stalenamefilter per call, and every subsequent request sent the accumulated filters.This changes the merge to build a new list (
[*sdk_options.get("Filters", []), name_filter]), leaving the caller's list untouched. A functional test withbotocore.stub.Stubbercallsget_multipletwice with the same shared list and asserts the list is unchanged.User experience
Before: reusing a
Filterslist across calls silently accumulated stalenamefilters, causing subsequentbatch_get_secret_valuecalls to request secrets that were no longer wanted.After: the caller's
Filterslist is left exactly as passed, and each request sends only the caller's filters plus the currentnamefilter.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
AI assistance disclosure: this fix was implemented with the help of an AI coding agent on behalf of the account owner.