-
Notifications
You must be signed in to change notification settings - Fork 2.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
feat(cloudformation): inline ignore support for YAML templates #6358
Conversation
239e279
to
ee694a8
Compare
6a4228a
to
5b80a0e
Compare
5b80a0e
to
51eae13
Compare
func NewCFReferenceWithValue(resourceRange iacTypes.Range, resolvedValue Property, logicalId string) CFReference { | ||
return CFReference{ | ||
resourceRange: resourceRange, | ||
resolvedValue: resolvedValue, | ||
logicalId: logicalId, | ||
} | ||
} | ||
|
||
func (cf CFReference) String() string { | ||
return cf.resourceRange.String() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Were they not used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The resolvedValue
field was used in methods that were not used anywhere else, so this constructor was not needed.
ignored int | ||
}{ | ||
{ | ||
name: "without ignored", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
name: "without ignored", | |
name: "without ignore", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed dd26943
func ScannerWithAlternativeIDProvider(f func(string) []string) options.ScannerOption { | ||
return func(s options.ConfigurableScanner) { | ||
if tf, ok := s.(ConfigurableTerraformScanner); ok { | ||
tf.AddExecutorOptions(executor.OptionWithAlternativeIDProvider(f)) | ||
} | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
were alternativeIDProviders
not in use? I'm not sure of the original motivation behind them but just want to be sure they weren't part of any use case that we might have missed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not used in the Trivy. I think it's a legacy from tfsec.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have noticed that there is a lot of logic in the Terraform scanner to process the scan results and a lot of it is not being used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have noticed that there is a lot of logic in the Terraform scanner to process the scan results and a lot of it is not being used.
We should remove such logic, in a separate PR.
// tfsec:ignore:*[secure=false] | ||
// trivy:ignore:*[secure=false] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would still keep the old tfsec tests in so that we remain backwards compatible but add another test case for the trivy ignores.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I seem to have renamed it by accident, fixed it dd26943
@@ -1,131 +0,0 @@ | |||
package parser |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where's this logic been moved to?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I put the parsing of comments with ignore rules in a separate package https://github.com/aquasecurity/trivy/pull/6358/files#diff-c1fe13f24e97f852991501a2535948a2ff13ef4e36564313e85754d8f9c6f35eR20.
Description
Moved inline ignore handling from terraform to a separate package, which will allow to add support for ignore by inline comments to other iac scanners. Added ignore support for CloudFormation (yaml only).
Related issues
Checklist