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

[outputs] Komand support added (contribution from @0xdabbad00) #608

Merged
merged 5 commits into from
Feb 27, 2018
Merged

[outputs] Komand support added (contribution from @0xdabbad00) #608

merged 5 commits into from
Feb 27, 2018

Conversation

0xdabbad00
Copy link
Contributor

@0xdabbad00 0xdabbad00 commented Feb 22, 2018

to: @airbnb/streamalert-maintainers
size: small
resolves #602

Background

This is basically a copy/paste job of the Phantom integration, but even simpler. Komand has a web hook, which you hit with an authorization token, and just sent it your data.

Testing

Deployed and tested in our environment.

Copy link
Contributor

@jacknagz jacknagz left a comment

Choose a reason for hiding this comment

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

Hey @0xdabbad00 thanks for the contribution! I had a couple comments, could you also add unit tests to verify this output?

@ryandeivert if you have a second to review that'd be great

if not creds:
return self._log_status(False)

headers = {"Authorization": creds['komand_auth_token']}
Copy link
Contributor

Choose a reason for hiding this comment

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

Usage of double quotes instead of single quotes

LOGGER.debug('sending alert to Komand')

success = False
if container_id:
Copy link
Contributor

Choose a reason for hiding this comment

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

this if block seems confusing, are container_id and artifact* variables copy pasta?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes /me hangs head in shame, will fix.

OutputProperty(description='a short and unique descriptor for this '
'Komand integration')),
('komand_auth_token',
OutputProperty(description='the auth token for this Komand integration. Example: 00000000-0000-0000-0000-000000000000',
Copy link
Contributor

@ryandeivert ryandeivert Feb 26, 2018

Choose a reason for hiding this comment

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

this description line and the one below will exceed the pylint line len threshold of 100, consider breaking into multiple likes like the preceding 'descriptor' block

@ryandeivert
Copy link
Contributor

ryandeivert commented Feb 26, 2018

hey @0xdabbad00 looking good! I know this is a small class, but (as jack mentioned) some simple unit tests would be excellent :)


LOGGER.debug('sending alert to Komand')

success = False
Copy link
Contributor

Choose a reason for hiding this comment

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

remove this declaration as it's unnecessary

@ryandeivert
Copy link
Contributor

@0xdabbad00 can you fix the current conflict in manage.py then LGTM

@ryandeivert
Copy link
Contributor

so close! @0xdabbad00 - some pylint errors:

57.22s$ ./tests/scripts/pylint.sh
Starting pylint script
************* Module stream_alert.alert_processor.outputs.komand
C: 56, 0: Line too long (124/100) (line-too-long)
W: 17, 0: Unused import os (unused-import)
W: 20, 0: Unused OutputRequestFailure imported from stream_alert.alert_processor.outputs.output_base (unused-import)
************* Module tests.unit.stream_alert_alert_processor.test_outputs.test_komand
W: 47,58: Unused argument 'get_mock' (unused-argument)
W: 59,57: Unused argument 'get_mock' (unused-argument)
W: 17, 0: Unused PropertyMock imported from mock (unused-import)
W: 17, 0: Unused call imported from mock (unused-import)

Copy link
Contributor

@ryandeivert ryandeivert left a comment

Choose a reason for hiding this comment

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

LGTM 🚢

@coveralls
Copy link

Coverage Status

Coverage increased (+0.02%) to 95.553% when pulling b010778 on 0xdabbad00:spiper-support_komand into d9763f6 on airbnb:master.

@jacknagz jacknagz merged commit 4a43f09 into airbnb:master Feb 27, 2018
@ryandeivert ryandeivert changed the title Komand support added [outputs] Komand support added Feb 27, 2018
@ryandeivert ryandeivert changed the title [outputs] Komand support added [outputs] Komand support added (contribution from @0xdabbad00) Feb 27, 2018
@ryandeivert ryandeivert added this to the 1.6.1 milestone Mar 15, 2018
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.

Support Komand as an output
4 participants