Skip to content

Commit

Permalink
don't allow events with no data
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions committed Dec 20, 2024
1 parent df02ef3 commit 5c2bda1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions bbot/core/event/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1648,6 +1648,8 @@ def make_event(
When working within a module's `handle_event()`, use the instance method
`self.make_event()` instead of calling this function directly.
"""
if not data:
raise ValidationError("No data provided")

# allow tags to be either a string or an array
if not tags:
Expand Down
4 changes: 4 additions & 0 deletions bbot/test/test_step_1/test_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -611,6 +611,10 @@ async def test_events(events, helpers):
assert str(parent_event_3.module) == "mymodule"
assert str(parent_event_3.module_sequence) == "mymodule->mymodule->mymodule"

# event with no data
with pytest.raises(ValidationError):
event = scan.make_event(None, "DNS_NAME", parent=scan.root_event)

await scan._cleanup()


Expand Down

0 comments on commit 5c2bda1

Please sign in to comment.