Skip to content

Bug: get_parameters_by_name mutates the caller's parameters dict, so later global decrypt/transform are ignored #8590

Open

Description

@leandrodamascena

Expected Behaviour

get_parameters_by_name(params, decrypt=True) applies decrypt=True to every parameter without a per-parameter override, no matter how many times params was used before. The input dict is not modified.

Current Behaviour

_overrides = options or {} (ssm.py:716) writes transform and decrypt back into the user's dict. On the first call they are filled with the current globals; on later calls those stale values win over the new global decrypt/transform. Only non-empty override dicts are affected ({} is falsy and gets copied). A module-level PARAMS = {...} reused across invocations, as in the docs, hits this.

Code snippet

from botocore.config import Config
from botocore.stub import Stubber
from aws_lambda_powertools.utilities.parameters import SSMProvider

provider = SSMProvider(boto_config=Config(region_name="us-east-1"))
stub = Stubber(provider.client)
resp = {"Parameters": [{"Name": "/a", "Value": "v", "Type": "String", "Version": 1}]}
stub.add_response("get_parameters", resp, {"Names": ["/a"]})
stub.add_response("get_parameters", resp, {"Names": ["/a"]})   # second call: no WithDecryption sent
stub.activate()

params = {"/a": {"max_age": 0}}
provider.get_parameters_by_name(params)
print(params)  # {'/a': {'max_age': 0, 'transform': None, 'decrypt': False}}   input was mutated
provider.get_parameters_by_name(params, decrypt=True)  # still fetched without decryption

Possible Solution

_overrides = {**(options or {})} so the caller's dict is never written to.

Steps to Reproduce

Run the snippet above (it uses botocore.stub.Stubber, no AWS access needed).

Powertools for AWS Lambda (Python) version

latest

AWS Lambda function runtime

3.13

Packaging format used

PyPi

Debugging logs

Warning

This issue is ready to be picked up, by humans or by agents. If you want it, comment here first so we can assign it to you, and please take only one or two issues at a time so others can join in too. The reproduction above runs locally without AWS access. Thanks!

Activity

  1. SumiRann1 commented on Oct 18, 2026

    @SumiRann1

    Hii @leandrodamascena , I want to work upon this issue and fix it!

  2. leandrodamascena commented on Oct 18, 2026

    @leandrodamascena
    ContributorAuthor

    Hey @SumiRann1 pls go ahead.

  3. added this to the 3.38.0 milestone on Oct 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinggood first issueGood for newcomersparametersParameters utilitytriagePending triage from maintainers

Type

No type

Projects

Relationships

None yet

Development

No branches or pull requests

Issue actions