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 username field in managed_policy table #7944

Merged

Conversation

bgirardeau-figma
Copy link
Contributor

Currently the username field in managed_policy table is always set to "." for a user policy. This changes the field to instead be the actual username (or empty if it is a system policy), which is the expected behavior.

The issue is that directory paths from listDirectoriesInDirectory end in "/" (see here), which causes their filename and stem to be "." due to the Boost behavior described here

Tested manually with a managed machine using osqueryi. Also uncommented the table test, though it doesn't actually test anything on a non-managed machine (ie in CI) because the plist files are not present.

@lucasmrod
Copy link
Contributor

Hi folks!

We've reproduced this issue in Fleet, see: fleetdm/fleet#8119.

I've compiled this branch and tested the fix and it works (username was '.'for Foo and luk with latest osquery):
Screenshot 2023-03-17 at 16 28 37

Copy link
Member

@zwass zwass left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good. Merging with @lucasmrod's confirmation. Thank you @bgirardeau-figma!

@zwass zwass merged commit ba4f858 into osquery:master Mar 17, 2023
@bgirardeau-figma
Copy link
Contributor Author

Nice thanks for the testing and review!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants