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

Change logger_mode flag to be actually interpreted as an octal #7273

Merged

Conversation

Smjert
Copy link
Member

@Smjert Smjert commented Aug 19, 2021

The logger_mode flag was actually interpreted as decimal format number,
not octal.
Now the flag is actually a string and is expected to represent an octal
number.
A validation function has been added to prevent invalid permission modes and
the flag itself is expected to be given at osquery startup only,
not changed during the execution.

This supersedes #7193

The logger_mode flag was actually interpreted as decimal format number,
not octal.
Now the flag is actually a string and is expected to represent an octal
number.
A validation function has been added to prevent invalid permission modes and
the flag itself is expected to be given at osquery startup only,
not changed during the execution.
Copy link
Member

@directionless directionless left a comment

Choose a reason for hiding this comment

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

<3

Do we need tests?

docs/wiki/installation/cli-flags.md Outdated Show resolved Hide resolved
@Smjert
Copy link
Member Author

Smjert commented Aug 19, 2021

<3

Do we need tests?

The test is present (it's what it's making the CI fail) and I forgot to update it (since it still passes the mode as an integer in decimal format).
I'm updating it, but I've also hit an interesting issue with how python converts octal to string and what our tryTo function does.

tryTo is not considering a failure when it's not converting the whole string to a number, because the underlying standard function stops at the first non digit number, and since python transforms 0754 -> "0o754", you always get 0.
But I would say that is for another time ^^'.

@directionless
Copy link
Member

I wasn't sure if there should be a c++ test for validateLoggerMode or something. Happy to defer to y'all.

Code seems fine to me. I'll give one of the c++ folks a chance to review, though I think we can do this by 5.0

@directionless directionless added this to the 5.0.0 milestone Aug 20, 2021
@theopolis theopolis merged commit 2d610db into osquery:master Aug 20, 2021
@Smjert Smjert deleted the stefano/fix/logger-mode-conversion branch August 20, 2021 08:15
aikuchin pushed a commit to aikuchin/osquery that referenced this pull request Jul 11, 2023
…1 to master

* commit 'f72b7c5510b8cd78c9d0450cbd1f31903681caa5': (53 commits)
  Add `TimeoutStopSec` to systemd unit files (osquery#7190)
  Prevent osquery from killing itself when the --force flag is used (osquery#7295)
  Linux: Support AF_PACKET sockets. (osquery#7282)
  libs: update openssl to 1.1.1l (osquery#7293)
  Correct macOS installed app bundle path in osqueryctl and doc (osquery#7289)
  macos path fix in launchd plist (osquery#7288)
  Update osquery installed artifacts default paths in code (osquery#7285)
  Update osquery installed artifacts paths in the documentation (osquery#7286)
  Update packaging SHA (osquery#7279)
  Change to the `disk_encryption` table to support QueryContext (osquery#7209)
  Add feature to skip denylist for event-based queries (osquery#7158)
  Support pid_with_namespace in more tables (osquery#7132)
  audit: socket_events improvements (osquery#7269)
  [linux][packaging] Update packaging paths (osquery#7271)
  Change logger_mode flag to be actually interpreted as an octal (osquery#7273)
  Update `uptime` table descrption (osquery#7270)
  [macOS][packaging] Create an app bundle along with other package_data (osquery#7263)
  Add case sensitive pragma to the pragma/actions authorizer allow list (osquery#7267)
  Fix audit rule removal upon osquery exit (osquery#7221)
  Fix osquery_info build_platform column value on Linux (osquery#7254)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants