Describe the bug
When a user is imported into multiple CDK stacks, and is granted policies through ISecret.grantRead (or similar), the last deployed stack's policy overrides whatever was granted before on the user.
Seems to be similar to #23080, but for users instead of roles.
Regression Issue
Last Known Working CDK Library Version
No response
Expected Behavior
Each policy should be unique on a per-stack basis, such that each stack's policies don't overwrite one another.
Current Behavior
Only the last deployed stack's policy is attached to the user, overwriting all previous policies.
Reproduction Steps
With a created user, bucket, and function, deploy these two stacks:
export class FirstStack extends cdk.Stack {
constructor(scope: Construct, id: string, props: FirstStackProps) {
super(scope, id, props);
const bucket = new Bucket(this, 'Bucket', {
autoDeleteObjects: true,
removalPolicy: RemovalPolicy.DESTROY
})
const user = User.fromUserArn(this, "User", "<userArn>")
bucket.grantWrite(user)
}
}
export class SecondStack extends cdk.Stack {
constructor(scope: Construct, id: string, props: SecondStackProps) {
super(scope, id, props);
const fn = new Function(this, 'MyFn', ...)
const user = User.fromUserArn(this, "User", "<userArn>")
fn.grantInvoke(user)
}
}
Possible Solution
Perhaps a similar fix to what was done for #23080?
Additional Information/Context
No response
AWS CDK Library version (aws-cdk-lib)
2.235.1
AWS CDK CLI version
2.1118.4
Node.js Version
18.20.8
OS
Linux
Language
TypeScript
Language Version
No response
Other information
No response
Describe the bug
When a user is imported into multiple CDK stacks, and is granted policies through
ISecret.grantRead(or similar), the last deployed stack's policy overrides whatever was granted before on the user.Seems to be similar to #23080, but for users instead of roles.
Regression Issue
Last Known Working CDK Library Version
No response
Expected Behavior
Each policy should be unique on a per-stack basis, such that each stack's policies don't overwrite one another.
Current Behavior
Only the last deployed stack's policy is attached to the user, overwriting all previous policies.
Reproduction Steps
With a created user, bucket, and function, deploy these two stacks:
Possible Solution
Perhaps a similar fix to what was done for #23080?
Additional Information/Context
No response
AWS CDK Library version (aws-cdk-lib)
2.235.1
AWS CDK CLI version
2.1118.4
Node.js Version
18.20.8
OS
Linux
Language
TypeScript
Language Version
No response
Other information
No response