Repository navigation
fix(parameters): do not mutate the caller's Filters list in SecretsProvider.get_multiple - #8604
wanjinhao1 wants to merge 1 commit into
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.



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.