-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(pipelines): Various pipeline-related constructs not visited by aspect #18440
Comments
Seeing similar behavior in CDK v2.8.0 as well. |
In this specific case the consequences aren't very severe (a handful of missing tags), but it may be an indicator that there is a more general issue wrt. synthesizing and the usage of aspects. In general I'd expect there to be a guarantee that any construct in a given scope will be visited by an aspect. If there is a bug that breaks this guarantee, it may have more severe implications for other use-cases (e.g., if you're using aspects for compliance checking, security rules, etc.). |
This is unfortunately true. For example, constructs generated during aspect visiting time are not guaranteed to be visited again. It is not a bug, it's a limitation. In the cdk lifecycle, only constructs that are added in the "construction" phase are guaranteed to be visited. By calling It is not safe to use Aspects as the sole defense for compliance or security checking; not just because of this behavior, but more generically because the CDK employs a general-purpose programming language where anyone could write any code to do anything (also overwrite the output of the synth directory with arbitrary contents after your validation has run). To get any guarantees at all, you must do security analysis on the artifacts produced by a CDK application (CloudFormation templates etc), after the user code is definitely done running. You can use Aspects for early warning/convenience, not for security. |
|
@rix0rrr I fully agree that one should not use Aspects as a single line of defense for security and compliance checking. I brought it up as a more "severe" example compared to the scenario of missing a handful of tags (and also because I've been looking at https://github.com/cdklabs/cdk-nag lately which uses Aspects specifically for compliance and security checks). I do, however, think it could be helpful to highlight this behavior/limitation in the official |
What is the problem?
I noticed this issue when trying to tag all resources that are created when using the
pipelines.CodePipeline
construct. Some constructs (e.g.,<...>/UpdatePipeline/SelfMutate/CodePipelineActionRole/Resource
) were created and available in my cloud assembly, but never visited by my aspect (and thus not tagged).I've observed the following behavior:
buildPipeline
.buildPipeline
.Reproduction Steps
Pipeline/CodePipeline/UpdatePipeline/SelfMutate/CodePipelineActionRole/Resource
are not logged to standard out (i.e., not visited by the aspect), but exist in the generated Cloud assemblycdk.out/Pipeline.template.json
.buildPipeline
and/or remove the use of an existing CodePipeline, synthesize the application and verify that more constructs are visited by the aspect now than previously.What did you expect to happen?
buildPipeline
in order to have the aspect visit all constructs.What actually happened?
Only a subset of the expected constructs were visited by the aspect.
CDK CLI Version
1.139.0
Framework Version
No response
Node.js Version
14.17.6
OS
MacOS
Language
Typescript
Language Version
4.5.4
Other information
No response
The text was updated successfully, but these errors were encountered: