aws / aws/aws-workload-credentials-provider

Enhancement: Introduce new query parameter for `jsonKey` to enable common use case

Open
#55 2 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Rust
Stars
706
Forks
45
Avg merge
3d 1h
Merged PRs (30d)
6

Description

**Enhancement to provide for common use case looking for a specific key (password) out of the secret payload**

Often though many different pieces of data are in the Secret Manager JSON payload the data the application is interested in is simply the password or secret at hand.

Look to add parity similar to how it works when retrieving directly from [ECS/task definition](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/secrets-envvar-secrets-manager.html#secrets-envvar-secrets-manager-update-container-definition)

Implementation details/concerns:
- As the payload would change should it be a different end point or just an additional query param?
- What type of validation and error codes would be needed for when json key is not present?

**Option 1:**
Add a new simple query parameter
`http://localhost:2773/secretsmanager/get?secretId=&jsonKey=password `

(Less Ideal) Resulting payload BAU with new response key `SecretKeyValue`
```
{
"ARN": "arn:aws:secretsmanager:us-west-2:123456789012:secret:MyTestSecret-a1b2c3",
"Name": "MyTestSecret",
"VersionId": "a1b2c3d4-5678-90ab-cdef-EXAMPLE11111",
"SecretString": "{\"username\":\"diegor\",\"password\":\"EXAMPLE-PASSWORD\"}",
"SecretKeyValue": "EXAMPLE-PASSWORD"
"VersionStages": [
"AWSCURRENT"
],
"CreatedDate": 1523477145.713
}
```

(More Ideal) Resulting payload that breaks the contract of original query response
```
EXAMPLE-PASSWORD
```

**Option 2:**
Introduce a different endpoint to allow for different payload

`http://localhost:2773/secretsmanager//password`

Resulting payload
```
EXAMPLE-PASSWORD
```

I am open to trying to help contribute if issue is excepted

Contributor guide

Open the contributing guide

Research direction

Start by reading the existing /secretsmanager/get endpoint and its response contract. Compare the query-parameter and alternate-endpoint options, then define validation, missing-key errors, and whether the original response shape remains unchanged before implementing and testing the selected behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, rust
Domain
api, backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.