aws / aws/aws-cdk

[aws-secretsmanager]: Expose arnForPolicies on ISecret

Open
#28,402 1 comment 0 reactions 0 assignees View on GitHub
@aws-cdk/aws-secretsmanager effort/medium feature-request p3
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
2d 3h
Merged PRs (30d)
83

Description

### Describe the feature

The property arnForPolicies is currently defined protected on SecretBase and used by the grantRead and grantWrite methods. Making this a public property on ISecret simplifies creation of custom policies.

### Use Case

The Kubernetes External Secrets operator needs additional actions granted on secrets used, as described [here](https://external-secrets.io/v0.5.1/provider-aws-secrets-manager/#iam-policy). These are not added when simply using ISecret.grantRead.

However, using the correct ARN for secrets in policies is non-trivial, especially when you aren't sure at the time of writing where the secret in question will come from. CDK internally uses a mechanism to resolve this, but it is not exposed.

Another usecase would be to handle multiple secret resources inside a single policy statement.

### Proposed Solution

The logic is already present, it just needs to be made public.

### Other Information

_No response_

### Acknowledgements

- [ ] I may be able to implement this feature request
- [ ] This feature might incur a breaking change

### CDK version used

2.99.0

### Environment details (OS name and version, etc.)

Windows 10

Contributor guide

Open the contributing guide

Research direction

Start by reading the SecretBase and ISecret definitions, then follow how grantRead and grantWrite use arnForPolicies. The logic is already present; done means exposing the property on ISecret so callers can use the correct ARN when creating custom policies, with the relevant existing tests updated or extended if present.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, typescript
Domain
cloud, security
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.