S3SubmitToArchiveCommand: StaticCredentialsProvider unconditionally constructed, blocking ECS Fargate task role credential resolution
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 75/100
Research direction
The issue is in S3SubmitToArchiveCommand's createClient() method. Look for the AWS SDK credential provider chain construction. The fix is to conditionally add the StaticCredentialsProvider only when both access-key and secret-key are non-empty. Test by deploying a Dataverse instance on AWS ECS Fargate with an IAM task role and no configured S3 keys, then triggering a BagIt archival operation.
Written by the indexing model from the issue text.
Description
What steps does it take to reproduce the issue?
Deploy Dataverse on AWS ECS Fargate with an IAM task role granting S3 access. Do not configure dataverse.s3archiver.access-key or dataverse.s3archiver.secret-key — rely solely on the task role for credentials.
Trigger a BagIt archival operation via S3SubmitToArchiveCommand.
- When does this issue occur?
See above
- Which page(s) does it occurs on?
N/A
- What happens?
The container throws a NullPointerException during client construction in createClient(), and the archival operation fails before any S3 call is made.
- To whom does it occur (all users, curators, superusers)?
All
- What did you expect to happen?
Archival should succeed using IAM credentials from the ECS task role, consistent with how other AWS SDK clients behave on Fargate.
Which version of Dataverse are you using?
6.10.1
Any related open or closed issues to this bug report?
N/A
Screenshots:
N/A
Root cause
String accessKey = config.getOptionalValue("dataverse.s3archiver.access-key", String.class).orElse("");
String secretKey = config.getOptionalValue("dataverse.s3archiver.secret-key", String.class).orElse("");
AwsCredentialsProvider staticCredentials = StaticCredentialsProvider
.create(AwsBasicCredentials.create(accessKey, secretKey));
When neither key is configured, both values are empty strings. AwsBasicCredentials.create("", "") throws an NPE.
Note: confirmed with a standalone test — AwsBasicCredentials.create("", "") throws java.lang.NullPointerException: Access key ID cannot be blank.
Suggested fix
Only add StaticCredentialsProvider to the chain when both keys are present and non-empty:
AwsCredentialsProviderChain.Builder chainBuilder = AwsCredentialsProviderChain.builder()
.addCredentialsProvider(ProfileCredentialsProvider.create(profile));
if (!accessKey.isEmpty() && !secretKey.isEmpty()) {
chainBuilder.addCredentialsProvider(
StaticCredentialsProvider.create(AwsBasicCredentials.create(accessKey, secretKey)));
}
chainBuilder.addCredentialsProvider(DefaultCredentialsProvider.create());
s3CB.credentialsProvider(chainBuilder.build());
Are you thinking about creating a pull request for this issue?
If the approach is accepted, yes.
- Dominant language
- Java
- Stars
- 1.1k
- Forks
- 568
- Avg merge
- 5d 10h
- Merged PRs (30d)
- 21
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from IQSS/dataverse
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
IQSS/dataverse#12818 · 1 comment · 1 reaction · 1 assignee ·
Maintainers usually reply within 1 day
-
Release Size: 30
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Maintainers usually reply within 1 day
-
docs: remove obsolete chown command and follow-up notePossibly taken @donsizemore claimed this 18 days ago. Open
Difficulty 1/5 Under an hour Newbie friendliness 92/100
IQSS/dataverse#12764 · 1 reaction ·
Maintainers usually reply within 1 day
-
S3SubmitToArchiveCommand: temporary bag files not deleted after upload, causing disk space leakOpenType: Bug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
IQSS/dataverse#12736 · 1 comment ·
Maintainers usually reply within 1 day
-
Type: Bug
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
IQSS/dataverse#12735 · 1 comment ·
Maintainers usually reply within 1 day
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
account bug communication lecture
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
area/server bug P2
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
modelcontextprotocol/java-sdk#1196 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Consumer progress rows interleave topics with equal queue IDsPossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
apache/rocketmq-dashboard#7250 ·
Maintainers usually reply within 3 days