-
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
fix(terraform): Attribute and fileset fixes #6544
fix(terraform): Attribute and fileset fixes #6544
Conversation
// Join the path to the glob pattern, while ensuring the full | ||
// pattern is canonical for the host OS. The joined path is | ||
// automatically cleaned during this operation. | ||
pattern = filepath.Join(path, pattern) | ||
// Trivy uses a virtual file system | ||
// Join the path to the glob pattern, and ensure both path and pattern | ||
// agree on path separators, so the globbing works as expected. | ||
pattern = filepath.ToSlash(filepath.Join(path, pattern)) |
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.
Have you observed any issues on Windows? I'm curious if we can add a test case to handle OS specific behavior.
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 specific issues I've hit with windows are around trying to subvert fileset
to work with paths outside its "root" – which I haven't included in this PR because I expected you'd prefer not to do that – but as part of that I noticed that doublestar.Glob
is documented to expect paths and patterns with /
, so that seemed like a sensible change regardless.
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.
Fair enough, thanks for the PR!
Thanks for the PR @fwereade, just left a small comment. |
Description
fileset
function now usesfs.Stat
instead ofos.Stat
and works more oftenAttribute.DecodeVarType
now handles thelist
andmap
shortcuts forlist(any)
andmap(any)
Attribute.GetRawValue
now returns data fromset
valuesRelated issues
Checklist