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

🐛 Resource file.exists does not work properly #2457

Closed
mm-weber opened this issue Nov 2, 2023 · 3 comments
Closed

🐛 Resource file.exists does not work properly #2457

mm-weber opened this issue Nov 2, 2023 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@mm-weber
Copy link
Contributor

mm-weber commented Nov 2, 2023

Describe the bug

file().exists

does not work properly with the content below and returns 'false'.

cnspec> file("/Library/Security/PolicyBanner.rtf").content
file.content: "
        {\\rtf1\\ansi\\ansicpg1252\\cocoartf1561\\cocoasubrtf610
        {\\fonttbl\\f0\\fswiss\\fcharset0 Helvetica;}
        {\\colortbl;\\red255\\green255\\blue255;}
        {\\*\\expandedcolortbl;;}
        \\margl1440\\margr1440\\vieww10800\\viewh8400\\viewkind0
        
\\pard\	x566\	x1133\	x1700\	x2267\	x2834\	x3401\	x3968\	x4535\	x5102\	x5669\	x6236\	x6803\\pardirnatural\\partightenfactor0

        \\f0\\fs24 \\cf0 Center for Internet Security Test Message}Center for Internet Security 
Test Message
"
cnspec> file("/Library/Security/PolicyBanner.rtf").exists
[failed] file.exists
  expected: == true
  actual:   false

image

To Reproduce
Steps to reproduce the behavior:

Create the file above on MacOS 13.6.2 (arm64) and run the command.

Expected behavior
The file.exists should return true, regardless of the content.

Screenshots or CLI Output
If applicable, add screenshots or the CLI output to help explain your problem.

Desktop (please complete the following information):

  • OS: macOS, arm64
  • OS Version: 13.5.2
cnspec 9.5.1 (e8298bf, 2023-11-02T10:07:22Z)

Additional context
Did install current providers:

mondoo-testing:Downloads root# ./cnspec_9.5.1 providers install os
→ installing provider 'os' version=9.1.1
→ successfully installed os provider path=/Library/Mondoo/providers/os version=9.1.1
@mm-weber
Copy link
Contributor Author

mm-weber commented Nov 2, 2023

Seems content doesn't matter:

cnspec> file("/Library/Security/PolicyBanner.txt").exists 
[failed] file.exists
  expected: == true
  actual:   false

cnspec> file("/Library/Security/PolicyBanner.txt")
file: file path="/Library/Security/PolicyBanner.txt" size=42 permissions.string="-rw-r--r--"
cnspec> file("/Library/Security/PolicyBanner.txt").content
file.content: "Center for Internet Security Test Message
"

@mm-weber mm-weber added the bug Something isn't working label Nov 2, 2023
@imilchev imilchev self-assigned this Mar 1, 2024
@imilchev
Copy link
Member

imilchev commented Mar 1, 2024

@mm-weber can you retest with latest cnspec and latest os provider?

@mm-weber
Copy link
Contributor Author

mm-weber commented Mar 5, 2024

Can't repro this issue anymore:

image

@mm-weber mm-weber closed this as completed Mar 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants