Skip to content

chore(python): add user agent suffix to kms requests#1686

Merged
imabhichow merged 6 commits into
mainfrom
imabhichow/python-user-agent
Aug 22, 2025
Merged

chore(python): add user agent suffix to kms requests#1686
imabhichow merged 6 commits into
mainfrom
imabhichow/python-user-agent

Conversation

@imabhichow
Copy link
Copy Markdown
Contributor

@imabhichow imabhichow commented Aug 14, 2025

Issue #, if available:

Description of changes:

Before Change:

"userAgent": "Boto3/1.40.10 md/Botocore#1.40.10 ua/2.1 os/macos#24.5.0 md/arch#arm64 lang/python#3.12.11 md/pyimpl#CPython m/Z,b,D cfg/retry-mode#legacy Botocore/1.40.10"

After Change

"userAgent": "Boto3/1.40.10 md/Botocore#1.40.10 ua/2.1 os/macos#24.5.0 md/arch#arm64 lang/python#3.12.11 md/pyimpl#CPython m/b,D,Z cfg/retry-mode#legacy Botocore/1.40.10 AwsCryptographicMPL/Python/1.11.0"

Squash/merge commit message, if applicable:

chore(python): add user agent suffix to kms requests

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@imabhichow imabhichow marked this pull request as ready for review August 14, 2025 22:38
@imabhichow imabhichow requested a review from a team as a code owner August 14, 2025 22:38
@github-actions
Copy link
Copy Markdown
Contributor

Detected changes to the release files or to the check-files action

@github-actions
Copy link
Copy Markdown
Contributor

Changes to the release files or the check-files action requires 2 approvals from CODEOWNERS

@github-actions
Copy link
Copy Markdown
Contributor

Detected changes to the release files or to the check-files action

@github-actions
Copy link
Copy Markdown
Contributor

Changes to the release files or the check-files action requires 2 approvals from CODEOWNERS

Comment thread .releaserc.cjs
Comment on lines +375 to +383

// Update the version in ComAmazonawsKms/src/Index.dfy DafnyUserAgentSuffix function
{
files: ["ComAmazonawsKms/src/Index.dfy"],
from: 'var version := ".*"',
to: 'var version := "${nextRelease.version}"',
results: [CheckResults("ComAmazonawsKms/src/Index.dfy")],
countMatches: true,
},
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

See ComAmazonawsKms/src/Index.dfy

With this change, this will ensure that user agent suffix always include the current mplVersion during release.

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.

oh nice! how did you go about testing this?
did you run this change on a fork?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, I ran semantic release command on this branch in my local and checkout the changes into new branch.

npx semantic-release --branches imabhichow/python-user-agent --no-ci

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

tagging a repo is a built in function of semantic release. So, while testing this you might have tagged v1.11.2. https://github.com/aws/aws-cryptographic-material-providers-library/tree/v1.11.2.

You can just delete this tag and its safe because only Go cares about tags and there is no go.mod in the root of the repo. That's the reason we only have tag protection for releases/go/**/**.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

So, while testing this you might have tagged v1.11.2. https://github.com/aws/aws-cryptographic-material-providers-library/tree/v1.11.2.

Good catch Rishav. I will delete the tag.

@@ -24,15 +26,18 @@ class default__(aws_cryptography_internal_kms.internaldafny.generated.Com_Amazon
@staticmethod
def KMSClient(boto_client = None, region = None):
if boto_client is None:
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.

Will this only append the user agent string to the default client (i.e. the client we create when the customer doesn't provide one)? Is it possible to also add it to the user defined one?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, this will only append to the default client.

Is it possible to also add it to the user defined one?

I'll look at the Python implementation and see if we can append the user agent. (I assume other runtimes do not append user agent strings to customer-supplied ones).

Copy link
Copy Markdown
Contributor Author

@imabhichow imabhichow Aug 20, 2025

Choose a reason for hiding this comment

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

I am able to add user agent string to user provided kms client, however, when user provided client also passes a user_agent_extra string, MPL will override the customer provided one user_agent_extra.

I am uncertain if we want this behavior for user/customer provided client. (I also looked into other runtime i.e. Java, Java does not add user agent string to customer provided clients)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Oh I think we may be able to append to the existing user_agent_extra if there's one.

@github-actions
Copy link
Copy Markdown
Contributor

Detected changes to the release files or to the check-files action

@github-actions
Copy link
Copy Markdown
Contributor

Changes to the release files or the check-files action requires 2 approvals from CODEOWNERS

@github-actions
Copy link
Copy Markdown
Contributor

Detected changes to the release files or to the check-files action

@github-actions
Copy link
Copy Markdown
Contributor

Changes to the release files or the check-files action requires 2 approvals from CODEOWNERS

@github-actions
Copy link
Copy Markdown
Contributor

Detected changes to the release files or to the check-files action

@github-actions
Copy link
Copy Markdown
Contributor

Changes to the release files or the check-files action requires 2 approvals from CODEOWNERS

@github-actions
Copy link
Copy Markdown
Contributor

Detected changes to the release files or to the check-files action

@imabhichow imabhichow merged commit b69aaf2 into main Aug 22, 2025
202 of 203 checks passed
@imabhichow imabhichow deleted the imabhichow/python-user-agent branch August 22, 2025 20:24
josecorella pushed a commit that referenced this pull request Feb 2, 2026
## [1.11.2](v1.11.1...v1.11.2) (2026-02-02)

### Fixes -- DotNet

* **dotnet:** build from main ([#1781](#1781)) ([b2d6075](b2d6075))

### Maintenance -- All Languages

* **dafny:** add fuzz testing to MPL ([#1622](#1622)) ([14fad38](14fad38))
* **dafny:** add new SearchAndReplaceWhole and friends ([#1680](#1680)) ([74e98c1](74e98c1))
* **dafny:** bump setup_dafny ([#1712](#1712)) ([2c57523](2c57523))
* **dafny:** optimize mutation map for O(1) performance in Go  ([#1687](#1687)) ([68cd7cb](68cd7cb))

### Maintenance -- Python

* **python:** add user agent suffix to kms requests ([#1686](#1686)) ([b69aaf2](b69aaf2))
* **python:** allow local testing ([#1651](#1651)) ([8b221c4](8b221c4))
* **python:** exclude generated tests from project distribution ([#1627](#1627)) ([505eee0](505eee0))
* **python:** tests for OpaqueWithText ([#1656](#1656)) ([25e1219](25e1219))

### Maintenance -- Go

* **go:** add go 1.25 to CI ([#1684](#1684)) ([49aa27c](49aa27c))
* **go:** put back content() in mutable maps extern ([#1694](#1694)) ([bb0ec0c](bb0ec0c))
* **go:** Release dynamodb Go module 0.2.1 ([#1671](#1671)) ([c82e136](c82e136))
* **go:** Release dynamodb Go module 0.2.2 ([#1698](#1698)) ([76846e1](76846e1))
* **go:** Release kms Go module 0.2.1 ([#1667](#1667)) ([dd8cdf1](dd8cdf1))
* **go:** Release kms Go module 0.2.2 ([#1697](#1697)) ([79c0531](79c0531))
* **go:** Release kms Go module 0.3.0 ([#1746](#1746)) ([1e438f3](1e438f3))
* **go:** Release mpl Go module 0.2.1 ([#1672](#1672)) ([9bc43c0](9bc43c0))
* **go:** Release mpl Go module 0.2.2 ([#1704](#1704)) ([5f2aa33](5f2aa33))
* **go:** Release mpl Go module 0.3.0 ([#1751](#1751)) ([1ac31b6](1ac31b6))
* **go:** Release primitives Go module 0.2.1 ([#1669](#1669)) ([dca265f](dca265f))
* **go:** Release primitives Go module 0.2.2 ([#1699](#1699)) ([d4c3a20](d4c3a20))
* **go:** Release primitives Go module 0.3.0 ([#1748](#1748)) ([541e04a](541e04a))
* **go:** Release smithy-dafny-standard-library Go module 0.2.1  ([#1666](#1666)) ([fa3f98b](fa3f98b))
* **go:** Release smithy-dafny-standard-library Go module 0.2.2 ([#1696](#1696)) ([4312195](4312195))
* **go:** remove create pull request step in go release workflow ([#1681](#1681)) ([7eafe88](7eafe88))
* **go:** test with go 1.23 ([#1737](#1737)) ([987ac0f](987ac0f))
* **go:** update Go release script for ESDK and DB-ESDK ([#1653](#1653)) ([ea64f20](ea64f20))
* **go:** update release script  ([#1676](#1676)) ([34f9689](34f9689))
* **go:** Update release script to cd to right directory  ([#1679](#1679)) ([952c42f](952c42f))

### Maintenance -- Rust

* **rust:** bump dafny version for rust to 4.10 ([#1725](#1725)) ([f41b3c4](f41b3c4))
* **rust:** clean up kms module ([#1752](#1752)) ([6878377](6878377))
* **rust:** fix clippy warning. Bump test dependencies ([#1715](#1715)) ([7b8d6ac](7b8d6ac))
* **rust:** more compatible blocking ([#1780](#1780)) ([3ea1161](3ea1161))
* **rust:** note unused parameter ([#1693](#1693)) ([49759c9](49759c9))
* **rust:** prepare for initial Rust crate publication ([#1755](#1755)) ([1e28a61](1e28a61))
* **rust:** provide fips feature flag ([#1703](#1703)) ([f6bdd23](f6bdd23))
* **rust:** release 0.2.0 ([#1782](#1782)) ([03c999c](03c999c))
* **rust:** remove warnings ([#1724](#1724)) ([453359a](453359a))

### Miscellaneous

* add managed policy to cfn template ([#1758](#1758)) ([81cc558](81cc558))
* Add UserAgent string to KMS client ([#1716](#1716)) ([09b2cda](09b2cda))
* bump CI to macos-14 ([#1734](#1734)) ([1413b88](1413b88))
* bump smithy-dafny ([#1657](#1657)) ([e2fb76c](e2fb76c))
* bump smithy-dafny ([#1706](#1706)) ([dc1678a](dc1678a))
* **CI:** ci action to upload performance logs to cloudwatch ([#1754](#1754)) ([c5b3ac6](c5b3ac6))
* **ci:** Install Go/goimports as codegen dependencies ([#1713](#1713)) ([7a6fd63](7a6fd63))
* **CI:** test DB-ESDK java examples from MPL  ([#1692](#1692)) ([4e06e37](4e06e37))
* **CI:** update slack notification to include link of GHA run  ([#1659](#1659)) ([c6e2c20](c6e2c20))
* clean up submodule URL to remove embedded username ([#1757](#1757)) ([df1ec90](df1ec90))
* **deps:** bump actions/download-artifact from 4 to 6 in /.github/workflows ([#1747](#1747)) ([2a767e7](2a767e7))
* **deps:** update deps across the repo ([#1773](#1773)) ([edcc64c](edcc64c))
* update check-files ([#1785](#1785)) ([14af920](14af920))
* update kms externs correctly ([#1717](#1717)) ([e11ba53](e11ba53))
* Update workflow permissions ([#1783](#1783)) ([37f416e](37f416e))
josecorella pushed a commit that referenced this pull request Feb 2, 2026
* **dotnet:** build from main ([#1781](#1781)) ([b2d6075](b2d6075))

* **dafny:** add fuzz testing to MPL ([#1622](#1622)) ([14fad38](14fad38))
* **dafny:** add new SearchAndReplaceWhole and friends ([#1680](#1680)) ([74e98c1](74e98c1))
* **dafny:** bump setup_dafny ([#1712](#1712)) ([2c57523](2c57523))
* **dafny:** optimize mutation map for O(1) performance in Go  ([#1687](#1687)) ([68cd7cb](68cd7cb))

* **python:** add user agent suffix to kms requests ([#1686](#1686)) ([b69aaf2](b69aaf2))
* **python:** allow local testing ([#1651](#1651)) ([8b221c4](8b221c4))
* **python:** exclude generated tests from project distribution ([#1627](#1627)) ([505eee0](505eee0))
* **python:** tests for OpaqueWithText ([#1656](#1656)) ([25e1219](25e1219))

* **go:** add go 1.25 to CI ([#1684](#1684)) ([49aa27c](49aa27c))
* **go:** put back content() in mutable maps extern ([#1694](#1694)) ([bb0ec0c](bb0ec0c))
* **go:** Release dynamodb Go module 0.2.1 ([#1671](#1671)) ([c82e136](c82e136))
* **go:** Release dynamodb Go module 0.2.2 ([#1698](#1698)) ([76846e1](76846e1))
* **go:** Release kms Go module 0.2.1 ([#1667](#1667)) ([dd8cdf1](dd8cdf1))
* **go:** Release kms Go module 0.2.2 ([#1697](#1697)) ([79c0531](79c0531))
* **go:** Release kms Go module 0.3.0 ([#1746](#1746)) ([1e438f3](1e438f3))
* **go:** Release mpl Go module 0.2.1 ([#1672](#1672)) ([9bc43c0](9bc43c0))
* **go:** Release mpl Go module 0.2.2 ([#1704](#1704)) ([5f2aa33](5f2aa33))
* **go:** Release mpl Go module 0.3.0 ([#1751](#1751)) ([1ac31b6](1ac31b6))
* **go:** Release primitives Go module 0.2.1 ([#1669](#1669)) ([dca265f](dca265f))
* **go:** Release primitives Go module 0.2.2 ([#1699](#1699)) ([d4c3a20](d4c3a20))
* **go:** Release primitives Go module 0.3.0 ([#1748](#1748)) ([541e04a](541e04a))
* **go:** Release smithy-dafny-standard-library Go module 0.2.1  ([#1666](#1666)) ([fa3f98b](fa3f98b))
* **go:** Release smithy-dafny-standard-library Go module 0.2.2 ([#1696](#1696)) ([4312195](4312195))
* **go:** remove create pull request step in go release workflow ([#1681](#1681)) ([7eafe88](7eafe88))
* **go:** test with go 1.23 ([#1737](#1737)) ([987ac0f](987ac0f))
* **go:** update Go release script for ESDK and DB-ESDK ([#1653](#1653)) ([ea64f20](ea64f20))
* **go:** update release script  ([#1676](#1676)) ([34f9689](34f9689))
* **go:** Update release script to cd to right directory  ([#1679](#1679)) ([952c42f](952c42f))

* **rust:** bump dafny version for rust to 4.10 ([#1725](#1725)) ([f41b3c4](f41b3c4))
* **rust:** clean up kms module ([#1752](#1752)) ([6878377](6878377))
* **rust:** fix clippy warning. Bump test dependencies ([#1715](#1715)) ([7b8d6ac](7b8d6ac))
* **rust:** more compatible blocking ([#1780](#1780)) ([3ea1161](3ea1161))
* **rust:** note unused parameter ([#1693](#1693)) ([49759c9](49759c9))
* **rust:** prepare for initial Rust crate publication ([#1755](#1755)) ([1e28a61](1e28a61))
* **rust:** provide fips feature flag ([#1703](#1703)) ([f6bdd23](f6bdd23))
* **rust:** release 0.2.0 ([#1782](#1782)) ([03c999c](03c999c))
* **rust:** remove warnings ([#1724](#1724)) ([453359a](453359a))

* add managed policy to cfn template ([#1758](#1758)) ([81cc558](81cc558))
* Add UserAgent string to KMS client ([#1716](#1716)) ([09b2cda](09b2cda))
* bump CI to macos-14 ([#1734](#1734)) ([1413b88](1413b88))
* bump smithy-dafny ([#1657](#1657)) ([e2fb76c](e2fb76c))
* bump smithy-dafny ([#1706](#1706)) ([dc1678a](dc1678a))
* **CI:** ci action to upload performance logs to cloudwatch ([#1754](#1754)) ([c5b3ac6](c5b3ac6))
* **ci:** Install Go/goimports as codegen dependencies ([#1713](#1713)) ([7a6fd63](7a6fd63))
* **CI:** test DB-ESDK java examples from MPL  ([#1692](#1692)) ([4e06e37](4e06e37))
* **CI:** update slack notification to include link of GHA run  ([#1659](#1659)) ([c6e2c20](c6e2c20))
* clean up submodule URL to remove embedded username ([#1757](#1757)) ([df1ec90](df1ec90))
* **deps:** bump actions/download-artifact from 4 to 6 in /.github/workflows ([#1747](#1747)) ([2a767e7](2a767e7))
* **deps:** update deps across the repo ([#1773](#1773)) ([edcc64c](edcc64c))
* update check-files ([#1785](#1785)) ([14af920](14af920))
* update kms externs correctly ([#1717](#1717)) ([e11ba53](e11ba53))
* Update workflow permissions ([#1783](#1783)) ([37f416e](37f416e))
josecorella pushed a commit that referenced this pull request Feb 2, 2026
* **dotnet:** build from main ([#1781](#1781)) ([b2d6075](b2d6075))

* **dafny:** add fuzz testing to MPL ([#1622](#1622)) ([14fad38](14fad38))
* **dafny:** add new SearchAndReplaceWhole and friends ([#1680](#1680)) ([74e98c1](74e98c1))
* **dafny:** bump setup_dafny ([#1712](#1712)) ([2c57523](2c57523))
* **dafny:** optimize mutation map for O(1) performance in Go  ([#1687](#1687)) ([68cd7cb](68cd7cb))

* **python:** add user agent suffix to kms requests ([#1686](#1686)) ([b69aaf2](b69aaf2))
* **python:** allow local testing ([#1651](#1651)) ([8b221c4](8b221c4))
* **python:** exclude generated tests from project distribution ([#1627](#1627)) ([505eee0](505eee0))
* **python:** tests for OpaqueWithText ([#1656](#1656)) ([25e1219](25e1219))

* **go:** add go 1.25 to CI ([#1684](#1684)) ([49aa27c](49aa27c))
* **go:** put back content() in mutable maps extern ([#1694](#1694)) ([bb0ec0c](bb0ec0c))
* **go:** Release dynamodb Go module 0.2.1 ([#1671](#1671)) ([c82e136](c82e136))
* **go:** Release dynamodb Go module 0.2.2 ([#1698](#1698)) ([76846e1](76846e1))
* **go:** Release kms Go module 0.2.1 ([#1667](#1667)) ([dd8cdf1](dd8cdf1))
* **go:** Release kms Go module 0.2.2 ([#1697](#1697)) ([79c0531](79c0531))
* **go:** Release kms Go module 0.3.0 ([#1746](#1746)) ([1e438f3](1e438f3))
* **go:** Release mpl Go module 0.2.1 ([#1672](#1672)) ([9bc43c0](9bc43c0))
* **go:** Release mpl Go module 0.2.2 ([#1704](#1704)) ([5f2aa33](5f2aa33))
* **go:** Release mpl Go module 0.3.0 ([#1751](#1751)) ([1ac31b6](1ac31b6))
* **go:** Release primitives Go module 0.2.1 ([#1669](#1669)) ([dca265f](dca265f))
* **go:** Release primitives Go module 0.2.2 ([#1699](#1699)) ([d4c3a20](d4c3a20))
* **go:** Release primitives Go module 0.3.0 ([#1748](#1748)) ([541e04a](541e04a))
* **go:** Release smithy-dafny-standard-library Go module 0.2.1  ([#1666](#1666)) ([fa3f98b](fa3f98b))
* **go:** Release smithy-dafny-standard-library Go module 0.2.2 ([#1696](#1696)) ([4312195](4312195))
* **go:** remove create pull request step in go release workflow ([#1681](#1681)) ([7eafe88](7eafe88))
* **go:** test with go 1.23 ([#1737](#1737)) ([987ac0f](987ac0f))
* **go:** update Go release script for ESDK and DB-ESDK ([#1653](#1653)) ([ea64f20](ea64f20))
* **go:** update release script  ([#1676](#1676)) ([34f9689](34f9689))
* **go:** Update release script to cd to right directory  ([#1679](#1679)) ([952c42f](952c42f))

* **rust:** bump dafny version for rust to 4.10 ([#1725](#1725)) ([f41b3c4](f41b3c4))
* **rust:** clean up kms module ([#1752](#1752)) ([6878377](6878377))
* **rust:** fix clippy warning. Bump test dependencies ([#1715](#1715)) ([7b8d6ac](7b8d6ac))
* **rust:** more compatible blocking ([#1780](#1780)) ([3ea1161](3ea1161))
* **rust:** note unused parameter ([#1693](#1693)) ([49759c9](49759c9))
* **rust:** prepare for initial Rust crate publication ([#1755](#1755)) ([1e28a61](1e28a61))
* **rust:** provide fips feature flag ([#1703](#1703)) ([f6bdd23](f6bdd23))
* **rust:** release 0.2.0 ([#1782](#1782)) ([03c999c](03c999c))
* **rust:** remove warnings ([#1724](#1724)) ([453359a](453359a))

* add managed policy to cfn template ([#1758](#1758)) ([81cc558](81cc558))
* Add UserAgent string to KMS client ([#1716](#1716)) ([09b2cda](09b2cda))
* bump CI to macos-14 ([#1734](#1734)) ([1413b88](1413b88))
* bump smithy-dafny ([#1657](#1657)) ([e2fb76c](e2fb76c))
* bump smithy-dafny ([#1706](#1706)) ([dc1678a](dc1678a))
* **CI:** ci action to upload performance logs to cloudwatch ([#1754](#1754)) ([c5b3ac6](c5b3ac6))
* **ci:** Install Go/goimports as codegen dependencies ([#1713](#1713)) ([7a6fd63](7a6fd63))
* **CI:** test DB-ESDK java examples from MPL  ([#1692](#1692)) ([4e06e37](4e06e37))
* **CI:** update slack notification to include link of GHA run  ([#1659](#1659)) ([c6e2c20](c6e2c20))
* clean up submodule URL to remove embedded username ([#1757](#1757)) ([df1ec90](df1ec90))
* **deps:** bump actions/download-artifact from 4 to 6 in /.github/workflows ([#1747](#1747)) ([2a767e7](2a767e7))
* **deps:** update deps across the repo ([#1773](#1773)) ([edcc64c](edcc64c))
* update check-files ([#1785](#1785)) ([14af920](14af920))
* update kms externs correctly ([#1717](#1717)) ([e11ba53](e11ba53))
* Update workflow permissions ([#1783](#1783)) ([37f416e](37f416e))
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.

5 participants