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

Refactor StreamPayload, Parsers, Testing, and more #34

Merged
merged 9 commits into from
Feb 14, 2017

Conversation

jacknagz
Copy link
Contributor

@jacknagz jacknagz commented Feb 14, 2017

to @airbnb/streamalert-maintainers

size: large
resolves: #32, #31, #30, #27, and #26

Change Summary

This PR refactors and simplifies a lot of core classes in StreamAlert to be more modular and extensible:

  • Move pre-parsers into their own class.
  • Make matchers guards to rules.
  • Create an abstract class for all Parser classes to inherit from - as well as move parsers into individual classes.
  • Add actionable test fixtures with sample rules and a valid configuration.
  • Update all unit test cases, and add cases for config loading.
  • Add testing runner scripts to lower the unit/integration testing barrier.

Jack Naglieri added 9 commits February 8, 2017 17:48
* this change reduces complexity in classifier
* uses a consistent naming scheme for pre-parser classes/methods
* updates unit tests to reflect changes
Previously, all matchers and rules were evaluated in parallel.
We can save processing if we only evaluate rules if matchers return True.

This change also cleans up the rules_engine.process flow.
Overall, this refactor provides a common interface for all parsers. By namespacing parsers into their own classes, we get the benefit of parser specific helper methods, along with a consistent structure for all parsers.

Change summary:
* Move all parser logic out of StreamClassifier into a new parsers.py file
* Create an Abstract Base Class for Parsers to inherit from
* Register new parser classes with a parser decorator
* Expose a get_parser method to other modules
 Please enter the commit message for your changes. Lines starting
* add error handing for improper JSON files
* fix a bug in the return statement spacing where it was skipping checks
* add unit test cases for validating configs
* Add functional test fixtures, rules, and conf for users to work off of
* Fix a bug in the CLI test to strip all records of newline characters
* Abstract the testing commands into shell scripts to be used by devs and Travis CI
* We don't need the Terraform binary to run Lambda commands (it uses the AWS CLI)
* Resolves #31
Copy link
Contributor

@austinbyers austinbyers left a comment

Choose a reason for hiding this comment

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

LGTM

I still think using JSONSchema or similar would be simpler than using your own JSON schema library, but I haven't looked at it in depth

@jacknagz jacknagz merged commit 586b385 into master Feb 14, 2017
@jacknagz jacknagz deleted the jacknagz-refactor-streampayload-class branch February 14, 2017 20:35
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.

Improvement: Add default values for separator/delimiter
2 participants