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

darwin/firewall: Fixes for alf_exceptions, make alf_services an alias for sharing_preferences #5378

Merged
merged 16 commits into from Oct 4, 2019

Conversation

woodruffw
Copy link
Contributor

This adds the pathFromNestedPlistAliasData function to handle an edge case in parsing some of the alias fields in the ALF plist, and turns alf_services into an alias for sharing_preferences (the original backing plist was vestigial and didn't accurately represent the state of the application firewall).

@facebook-github-bot facebook-github-bot added the cla signed Automated label: Pull Request author has signed the osquery CLA label Jan 21, 2019
Copy link
Contributor

@akindyakov akindyakov left a comment

Choose a reason for hiding this comment

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

Thank you for your contribution, @woodruffw !
Traditional question about table integration tests, may I ask you to update it?

specs/darwin/alf_services.table Show resolved Hide resolved
@woodruffw
Copy link
Contributor Author

Alright, I've added integration tests for alf_services and alf_exceptions.

@woodruffw
Copy link
Contributor Author

Anything else I can do to help get this merged, @akindyakov?

@woodruffw
Copy link
Contributor Author

Polite ping on this. Is there anything blocking another review/merge?

@woodruffw woodruffw changed the base branch from experimental to master September 30, 2019 20:32
osquery/tables/system/darwin/firewall.cpp Outdated Show resolved Hide resolved
osquery/tables/system/darwin/firewall.h Outdated Show resolved Hide resolved

/// Parse a nested (base-64 encoded) plist's alias data for its path
/// Observed experimentally with /Library/Preferences/com.apple.alf.plist
Status pathFromNestedPlistAliasData(const std::string& data,
Copy link
Member

Choose a reason for hiding this comment

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

Do you mind uploading test data into ./tests and making a unit test for this new parsing.

I can +1 to the observation, it's the same format on a 10.14.6 test device.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, let me see if I can whip up a sanitized version of a local sample.

@theopolis
Copy link
Member

Looking good! Last thing needed is the unit test.

@woodruffw
Copy link
Contributor Author

Looks like the CI is failing on Linux due to disk exhaustion?

BUILT 975/1073 JOBS 21.0s //osquery/events/tests:events_database_tests#binary
[2019-10-02 16:22:42.356][error][command:73980f72-6344-4cb4-88dc-4131143599e9][tid:27][com.facebook.buck.artifact_cache.ArtifactUploader] When creating artifact archive for //osquery/events/tests:inotify_tests#binary containing: 
 buck-out/release/bin/osquery/events/tests/.inotify_tests#binary/metadata/artifact
buck-out/release/bin/osquery/events/tests/.inotify_tests#binary/metadata/artifact/OUTPUT_HASH
buck-out/release/bin/osquery/events/tests/.inotify_tests#binary/metadata/artifact/OUTPUT_SIZE
buck-out/release/bin/osquery/events/tests/.inotify_tests#binary/metadata/artifact/RECORDED_PATHS
buck-out/release/bin/osquery/events/tests/.inotify_tests#binary/metadata/artifact/RECORDED_PATH_HASHES
buck-out/release/gen/osquery/events/tests/inotify_tests
buck-out/release/gen/osquery/events/tests/inotify_tests#binary.: java.io.IOException: No space left on device

[2019-10-02 16:22:42.356][error][command:73980f72-6344-4cb4-88dc-4131143599e9][tid:28][com.facebook.buck.artifact_cache.ArtifactUploader] When creating artifact archive for //osquery/events/tests:fsevents_tests#binary containing: 
 buck-out/release/bin/osquery/events/tests/.fsevents_tests#binary/metadata/artifact
buck-out/release/bin/osquery/events/tests/.fsevents_tests#binary/metadata/artifact/OUTPUT_HASH
buck-out/release/bin/osquery/events/tests/.fsevents_tests#binary/metadata/artifact/OUTPUT_SIZE
buck-out/release/bin/osquery/events/tests/.fsevents_tests#binary/metadata/artifact/RECORDED_PATHS
buck-out/release/bin/osquery/events/tests/.fsevents_tests#binary/metadata/artifact/RECORDED_PATH_HASHES
buck-out/release/gen/osquery/events/tests/fsevents_tests
buck-out/release/gen/osquery/events/tests/fsevents_tests#binary.: java.io.IOException: No space left on device

BUILT 976/1073 JOBS 16.6s //osquery/events/tests:inotify_tests#binary
BUILT 977/1073 JOBS 20.6s //osquery/events/tests:fsevents_tests#binary
double free or corruption (out)
##[error]Bash exited with code '134'.
##[section]Finishing: Run tests

@theopolis
Copy link
Member

@mike-myers-tob or @Smjert, see above about disk exhaustion. Is this something we have control over within Azure?

woodruffw and others added 16 commits October 4, 2019 12:28
Some plists (like com.apple.alf) contain a weird nested
(base64-encoded) plist, which in turn contains a single
NSData value. This commit updates `filterPlist` to handle
this NSData case, and adds a new convenience method
for extracting the POSIX path from the alias data of
these weird nested plists.
Should make it a bit easier to debug these in the future,
if Apple decides to change the format up.
The alf_services row was generated from an apparently
unused/meaningless array in the ALF plist. sharing_preferences
represents the same services and has accurate status information,
so just substitute it instead.
The `alf_services` table is now an alias for `sharing_preferences`,
so the functionality test should just go there.
@theopolis theopolis merged commit a9b2380 into osquery:master Oct 4, 2019
@woodruffw woodruffw deleted the william/feature/alf-tables branch October 4, 2019 19:52
muffins pushed a commit to muffins/osquery that referenced this pull request Oct 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API change cla signed Automated label: Pull Request author has signed the osquery CLA macOS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants