Skip to content

fix: Replace hardcoded AWS credentials with AnonymousCredentialsProvi… - #7148

Open
ford220102 wants to merge 2 commits into
aws:masterfrom
ford220102:master
Open

fix: Replace hardcoded AWS credentials with AnonymousCredentialsProvi…#7148
ford220102 wants to merge 2 commits into
aws:masterfrom
ford220102:master

Conversation

@ford220102

@ford220102 ford220102 commented Jul 14, 2026

Copy link
Copy Markdown

…der in benchmark

Security fix for java:S6263 - Long-term AWS access keys should not be used.

Replaced hardcoded dummy credentials ("test"/"test") with AnonymousCredentialsProvider in V1CborRoundtripBenchmark.

The benchmark uses a local mock server and does not require real AWS credentials. Using AnonymousCredentialsProvider makes this intent explicit and avoids the security hotspot.

This change:

  • Eliminates the security warning for hardcoded credentials
  • Makes the code's intent clearer (no real AWS access needed)
  • Is safe for benchmark code that never contacts real AWS services

Motivation and Context

Modifications

Testing

Screenshots (if appropriate)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Checklist

  • I have read the CONTRIBUTING document
  • Local run of mvn install succeeds
  • My code follows the code style of this project
  • My change requires a change to the Javadoc documentation
  • I have updated the Javadoc documentation accordingly
  • I have added tests to cover my changes
  • All new and existing tests passed
  • I have added a changelog entry. Adding a new entry must be accomplished by running the scripts/new-change script and following the instructions. Commit the new file created by the script in .changes/next-release with your changes.
  • My change is to implement 1.11 parity feature and I have updated LaunchChangelog

License

  • I confirm that this pull request can be released under the Apache 2 license

…der in benchmark

Security fix for java:S6263 - Long-term AWS access keys should not be used.

Replaced hardcoded dummy credentials ("test"/"test") with
AnonymousCredentialsProvider in V1CborRoundtripBenchmark.

The benchmark uses a local mock server and does not require
real AWS credentials. Using AnonymousCredentialsProvider makes
this intent explicit and avoids the security hotspot.

This change:
- Eliminates the security warning for hardcoded credentials
- Makes the code's intent clearer (no real AWS access needed)
- Is safe for benchmark code that never contacts real AWS services
@ford220102
ford220102 requested a review from a team as a code owner July 14, 2026 22:54
@debora-ito debora-ito self-assigned this Jul 27, 2026
@debora-ito

Copy link
Copy Markdown
Member

Hi @ford220102

can you give us more context about what originated the change? Where is the security warning coming from?

@debora-ito debora-ito added the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 10 days. label Jul 27, 2026
@ford220102

Copy link
Copy Markdown
Author

Hi @debora-ito, thanks for asking.

The warning did not come from an AWS CI workflow or a security incident. I identified the code during a static-analysis review as matching Sonar rule java:S6263, because BasicAWSCredentials("test", "test") contains credential-like hardcoded string values.

These are only dummy credentials used by V1CborRoundtripBenchmark. The benchmark communicates exclusively with the local ProtocolRoundtripServer and does not connect to any real AWS service.

The purpose of the change is to remove the credential-like literals and make it clear that no real AWS credentials are required.

I also noticed that my initial change used the SDK v2 AnonymousCredentialsProvider with an SDK v1 client. I will correct it to use the SDK v1-compatible implementation:

new AWSStaticCredentialsProvider(new AnonymousAWSCredentials())

I will update the commit and rerun the relevant build.

@github-actions github-actions Bot removed the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 10 days. label Jul 28, 2026
@debora-ito

Copy link
Copy Markdown
Member

I identified the code during a static-analysis review as matching Sonar rule java:S6263, because BasicAWSCredentials("test", "test") contains credential-like hardcoded string values.

I see, thank you for the additional context.

Changing to use AnonymousCredentialProvider will skip the signing steps and affect the benchmarks, so we'd like to keep the test as it is. The security finding doesn't apply in this case, we are using fake credentials with a mock server for client-side benchmarking purposes.

Marking to auto close soon, but let us know if you have questions.

@debora-ito debora-ito added the closing-soon This issue will close in 4 days unless further comments are made. label Jul 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

closing-soon This issue will close in 4 days unless further comments are made.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants