Skip to content

chore(mixins-preview): update Vended Logs to use Facades and Traits and add actions methods to BucketGrants#37239

Merged
mergify[bot] merged 8 commits intomainfrom
vended-logs/use-refl
Mar 16, 2026
Merged

chore(mixins-preview): update Vended Logs to use Facades and Traits and add actions methods to BucketGrants#37239
mergify[bot] merged 8 commits intomainfrom
vended-logs/use-refl

Conversation

@ShadowCat567
Copy link
Copy Markdown
Contributor

@ShadowCat567 ShadowCat567 commented Mar 12, 2026

Reason for this change

Vended Logs was previously not using the Traits and Facades that have been introduced with the GA of Mixins.

BucketGrants is a handwritten Grants class and did not benefit from the update a lot of the other Grants classes received which gave them access to the .actions() method.

Description of changes

Note: most of these changes involve refreshing the e2e test files mostly because policy names have changed and some implementation details are a bit different because of grants, the permissions themselves have not changed

This changes the implementation but not the behavior of Vended Logs to use the Facades and Traits.
BucketGrants now has 2 methods which operate like the .actions() method in other Grants classes. BucketGrants gets 2 methods while most other classes only get one because BucketGrants has a somewhat unique scenario where it always receives some kind of object arn to be able to apply permissions to accessing objects in a bucket, but does not always receive a bucket arn which controls what can be done to the bucket itself. We split these 2 use cases into 2 different grant methods.

Describe any new or updated permissions being added

Corrects Vended Logs S3 Bucket permissions to not grant to log stream, this is inline with Vended Logs documentation: https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/AWS-logs-infrastructure-V2-S3.html

Description of how you validated changes

Updated unit and integration tests in vended logs and added new unit tests to for BucketGrants

Checklist


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@github-actions github-actions Bot added p2 admired-contributor [Pilot] contributed between 13-24 PRs to the CDK labels Mar 12, 2026
@aws-cdk-automation aws-cdk-automation requested a review from a team March 12, 2026 19:15
@mergify mergify Bot added the contribution/core This is a PR that came from AWS. label Mar 12, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 12, 2026

⚠️ Experimental Feature: This security report is currently in experimental phase. Results may include false positives and the rules are being actively refined.
Please try merge from main to avoid findings unrelated to the PR.


TestsPassed ✅SkippedFailed
Security Guardian Results120 ran120 passed
TestResult
No test annotations available

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 12, 2026

⚠️ Experimental Feature: This security report is currently in experimental phase. Results may include false positives and the rules are being actively refined.
Please try merge from main to avoid findings unrelated to the PR.


TestsPassed ✅SkippedFailed
Security Guardian Results with resolved templates120 ran120 passed
TestResult
No test annotations available

@aws-cdk-automation aws-cdk-automation added the pr/needs-further-review PR requires additional review from our team specialists due to the scope or complexity of changes. label Mar 12, 2026
@@ -141,6 +141,19 @@ export class BucketGrants {
return this.grant(identity, perms.BUCKET_PUT_ACL_ACTIONS, [], this.arnForObjects(objectsKeyPattern));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now you can update the other methods to use the new actions().

* @param actions The actions to grant (e.g. 's3:GetObject').
*/
public actions(identity: IGrantable, objectsKeyPattern: string = '*', ...actions: string[]) {
return this.grant(identity, actions, [],
Copy link
Copy Markdown
Contributor

@otaviomacedo otaviomacedo Mar 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe the key actions should also become a parameter, instead of being hard-coded as an empty array.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking about having actions be able to take both Key and Bucket actions (and we sort them out inside the actions method) since you can't have 2 variadic parameters

@ShadowCat567 ShadowCat567 changed the title chore(mixins-preview): update Vended Logs to use Facades and Traits chore(mixins-preview): update Vended Logs to use Facades and Traits and add actions methods to BucketGrants Mar 13, 2026
@aws-cdk-automation aws-cdk-automation removed the pr/needs-further-review PR requires additional review from our team specialists due to the scope or complexity of changes. label Mar 13, 2026
@ShadowCat567 ShadowCat567 marked this pull request as ready for review March 13, 2026 19:45
@aws-cdk-automation aws-cdk-automation added the pr/needs-maintainer-review This PR needs a review from a Core Team Member label Mar 13, 2026
"Arn"
]
},
":log-stream:*\"}],\"Version\":\"2012-10-17\"}"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this change correct? It's hard to tell from this diff, but it seems that we are removing the log streams permission and just granting permission to the log group.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, I think this needs alteration...need to look at the docs again and see if I can set this up with bucketGrants

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looked through my test stacks and took a second look over the documentation, granting log stream permissions was incorrect to begin with, these permissions are the correct ones

* @param actions The S3 and/or KMS actions to grant.
*/
public actionsOnObjectKeys(identity: IGrantable, objectsKeyPattern: string = '*', ...actions: string[]) {
const keyActions: string[] = [];
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(minor) we can remove the duplication between the two new methods by delegating to a new private one.

// when
bucket.grantDelete(deleter);

console.log(JSON.stringify(Template.fromStack(stack), null, 2));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left behind unintentionally?

Copy link
Copy Markdown
Contributor Author

@ShadowCat567 ShadowCat567 Mar 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not intentional, was using this for debugging

@aws-cdk-automation aws-cdk-automation added the pr/needs-further-review PR requires additional review from our team specialists due to the scope or complexity of changes. label Mar 16, 2026
@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented Mar 16, 2026

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented Mar 16, 2026

Merge Queue Status

  • Entered queue2026-03-16 14:40 UTC · Rule: default-squash
  • Checks passed · in-place
  • Merged2026-03-16 15:10 UTC · at c6a3e311257c2084e30fbb1afd594ec7df7a5051

This pull request spent 30 minutes 9 seconds in the queue, including 29 minutes 54 seconds running CI.

Required conditions to merge

@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented Mar 16, 2026

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@mergify mergify Bot merged commit 4f0d32e into main Mar 16, 2026
23 of 24 checks passed
@mergify mergify Bot deleted the vended-logs/use-refl branch March 16, 2026 15:10
@github-actions
Copy link
Copy Markdown
Contributor

Comments on closed issues and PRs are hard for our team to see.
If you need help, please open a new issue that references this one.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Mar 16, 2026
@aws-cdk-automation aws-cdk-automation removed the pr/needs-maintainer-review This PR needs a review from a Core Team Member label Mar 16, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

admired-contributor [Pilot] contributed between 13-24 PRs to the CDK contribution/core This is a PR that came from AWS. p2 pr/needs-further-review PR requires additional review from our team specialists due to the scope or complexity of changes.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants