-
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
(core): addUnacknowledgeableWarning() method for Annotations #26914
Comments
I'm torn if this is a bug or a feature request. I want to err on the side of bug. I'm going to consider this a bug |
Its deprecation is causing problems for `cdk-nag`, which has a use case for unsuppressible warnings. Undeprecate for now until we come up with a better all-round solution. Relates to #26914.
Thanks @dontirun we are undeprecating the method until we have a better solution for you. We are currently thinking something like an accessible report of acknowledged warnings for plugins to parse. |
On the papercuts:
I appreciate this, but I also think it's vitally important that the suppression tag is surfaced in a clear way to users, especially if we intend to go full-hog on warnings (which I want to, with all the tweakable and adjustable things and weird edge cases people can get into, it's much better to overwarn and allow it to be silenced, than to not warn or *gasp* error). I opted for putting the tag into the warning string directly, so there's no way to miss it. Of course, any presentation layer could be aware of this, parse out the tag and display it differently, for example in a separate table column or something.
Do you have an example of a suppressible error? To my mind the major distinction between warnings and errors is their suppressibility, and so the fact that they cannot be suppressed is a feature. |
Yes, but with some context first 😄. Given that, let's say that you are using the HIPAA security based |
Its deprecation is causing problems for `cdk-nag`, which has a use case for unsuppressible warnings. Undeprecate for now until we come up with a better all-round solution. Relates to #26914. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
In CDK Core feature parlance, would it be equivalent to say that message is a warning, and everyone must always run with |
Yes, I would say an error in cdk-nag is equivalent to this |
Its deprecation is causing problems for `cdk-nag`, which has a use case for unsuppressible warnings. Undeprecate for now until we come up with a better all-round solution. Relates to #26914. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Describe the feature
Exactly the addWarning method, but not deprecated
Use Case
cdk-nag uses the cdk Annotation system to emit
Warnings
andErrors
. Currently it uses the addWarning method forWarnings
.addWarning
was deprecated with the introduction ofaddWarningV2
in the latest cdk release. Allcdk-nag
Warnings now emit deprecation messages along with the warning, which adds a lot of clutter the the CLI output. While this could be fixed by switching toaddWarningV2
, I don't think thataddWarningV2
is the correct choice in this case, primarily due to how thecdk-nag
warning/error suppression system is intended to function.Primary Concern
acknowledgeWarning
vsNagSuppression
NagSuppression
s arecdk-nag
's way of acknowledging warnings and errors. The key difference betweenacknowledgeWarning
andNagSuppression
s are thatNagSuppresion
s write the suppression to the CloudFormation Metadata in acdk-nag
specific format. That Cfn metadata is important when using SAST tooling to look over the generated CloudFormation templates (Anecdotally, I know of several use cases where thecdk-nag
Metadata is reviewed in CI/CD pipelines). Ifcdk-nag
were to switch fromaddWarning
toaddWarningV2
users would be able to use bothacknowledgeWarning
andNagSuppresion
s to silence warnings. While technically not a breaking change giving users the ability to useacknowledgeWarning
forcdk-nag
isn't a good choice.Smaller Concerns/Annoyances with
addWarningV2
andcdk-nag
if
cdk-nag
were to switch toaddWarningV2
and we were to ignore the primary concern there would be a few other minor annoyances.warnings
anderrors
would be slightly different from one another.Warnings
would have an additionaladdWarningV2
identifier appended to the end of the message, whileerrors
would not. While that would be the existingRuleId
already used forcdk-nag
,errors
don't have a correspondingaddErrorV2
(and in my opinion it doesn't make sense to have this) so this adds a bit of clutter and confusionaddErrorV2
method there would a delta between the options to acknowledge/suppressWarnings
andErrors
Proposed Solution
I don't think that "undeprecating"
addWarning
is the correct solution, because in cdk internal uses casesaddWarningV2
is the correct choice and users should useaddWarningV2
. Having a clone ofaddWarning
with a better name would add some "guardrails"(?) on usageaddUnacknowledgeableWarning()
method toAnnotations
which is a clone of of the currentaddWarning
methodaddWarningV2
unless they have a specific use case where the warnings should not be acknowledgeable and that unhandled warnings will prohibit users from deploying cdk applications withstrict
mode.Other Information
Related to cdklabs/cdk-nag#1418
Acknowledgements
CDK version used
2.93.0
Environment details (OS name and version, etc.)
Not relevant, but macOs 13.4 (Ventura) 😄
The text was updated successfully, but these errors were encountered: