Skip to content
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

Merged

Conversation

fwereade
Copy link
Contributor

@fwereade fwereade commented Apr 23, 2024

Description

  • fileset function now uses fs.Stat instead of os.Stat and works more often
  • Attribute.DecodeVarType now handles the list and map shortcuts for list(any) and map(any)
  • Attribute.GetRawValue now returns data from set values

Related issues

  • Close #XXX

Checklist

  • I've read the guidelines for contributing to this repository.
  • I've followed the conventions in the PR title.
  • I've added tests that prove my fix is effective or that my feature works.
  • I've updated the documentation with the relevant information (if needed).
  • I've added usage information (if the PR introduces new options)
  • I've included a "before" and "after" example to the description (if the PR is a user interface change).

Comment on lines -252 to +254
// 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))
Copy link
Member

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.

Copy link
Contributor Author

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.

Copy link
Member

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!

@simar7
Copy link
Member

simar7 commented Apr 23, 2024

Thanks for the PR @fwereade, just left a small comment.

@simar7 simar7 self-requested a review April 23, 2024 22:03
@simar7 simar7 added this pull request to the merge queue Apr 23, 2024
Merged via the queue into aquasecurity:main with commit 7c2017f Apr 23, 2024
15 checks passed
fl0pp5 pushed a commit to altlinux/trivy that referenced this pull request May 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants