Commit Graph

9618 Commits

Author SHA1 Message Date
Mike Salvatore d09f743100 Island: Register pypubsub Publisher in the DIContainer 2022-08-10 07:31:43 -04:00
Mike Salvatore 416cb30577 Common: Add type hint ty PyPubSubEventQueue constructor 2022-08-10 07:29:13 -04:00
Shreya Malviya 6ecb2f4d49 UT: Simplify logic in test_pypubsub_event_queue.test_subscribe_types() 2022-08-10 15:45:39 +05:30
Shreya Malviya e905f6eddf UT: Define functions instead of lambda expressions in PyPubSubEventQueue tests since flake8 complains 2022-08-10 15:41:03 +05:30
Shreya Malviya edad0d8cf2 UT: Simplify test logic with fixtures in PyPubSubEventQueue 2022-08-10 15:39:14 +05:30
Shreya Malviya 3aff182d47 UT: Simplify PyPubSubEventQueue's tests 2022-08-10 14:53:46 +05:30
Shreya Malviya 2fd66bc9e2 Common: Add comment about subscribing to all topics in PyPubSubEventQueue 2022-08-10 14:49:31 +05:30
Shreya Malviya f26beb6464 Common: Pass event_data to subscribers when publishing in PyPubSubEventQueue 2022-08-10 14:02:53 +05:30
Shreya Malviya 32efa0f0f2 Common: Don't pass 'data' argument when publishing in PyPubSubEventQueue 2022-08-10 13:27:55 +05:30
Shreya Malviya d154a7989c Common: Don't pass 'data' argument to IEventQueue's publish() 2022-08-10 13:26:01 +05:30
Shreya Malviya 3938e2f377 Project: Add subscribe_all_event_types to Vulture allowlist 2022-08-09 19:00:05 +05:30
Shreya Malviya 8da3abbb5b Common: Add internal all event types topic to PyPubSubEventQueue 2022-08-09 18:54:17 +05:30
Shreya Malviya 7a77fd82df Project: Add event queue's entries to Vulture allowlist 2022-08-09 17:12:48 +05:30
Shreya Malviya 585b1ca408 Common: Modify IEventQueue to not have any static methods 2022-08-09 15:21:59 +05:30
Shreya Malviya 390757f9cb UT: Modify PyPubSubEventQueuetests as per latest changes 2022-08-09 15:21:54 +05:30
Shreya Malviya 2d248151b3 Island: Register IEventQueue instance in DI container 2022-08-09 14:32:33 +05:30
Shreya Malviya d190f220f7 Common: Modify PyPubSubEventQueue to pass publisher in constructor 2022-08-09 14:31:44 +05:30
Shreya Malviya 00b62dc1a9 UT: Modify PyPubSubEventQueue's tests based on changes 2022-08-09 11:56:15 +05:30
Shreya Malviya 3cef54c09c Common: Change IEventQueue and PyPubSubEventQueue's subscribe_types() -> subscribe_type() 2022-08-09 11:53:03 +05:30
Shreya Malviya ae666d3dd3 Common: Change IEventQueue and PyPubSubEventQueue's subscribe_tags() -> subscribe_tag() 2022-08-09 11:50:31 +05:30
Shreya Malviya e92d67bfe8 Common: Fix type hints in IEventQueue and PyPubSubEventQueue 2022-08-09 11:46:19 +05:30
Shreya Malviya 9210023876 UT: Replace EventQueue with PyPubSubEventQueue 2022-08-09 11:43:37 +05:30
Shreya Malviya d346e63a26 Common: Rename EventQueue -> PyPubSubEventQueue 2022-08-09 11:42:57 +05:30
Shreya Malviya ae2ba0e068 UT: Remove event queue's unsubscribing tests 2022-08-09 11:39:43 +05:30
Shreya Malviya f3ef99db64 Common: Remove unsubscribing methods from IEventQueue and EventQueue 2022-08-09 11:37:21 +05:30
Shreya Malviya 77ea3e554d UT: Replace PypubsubEventQueue -> EventQueue and test_pypubsub_event_queue.py -> test_event_queue.py 2022-08-09 00:06:24 +05:30
Shreya Malviya 23d3f179a2 Common: Rename PypubsubEventQueue -> EventQueue and pypubsub_event_queue.py -> event_queue.py 2022-08-09 00:05:07 +05:30
Shreya Malviya 1a2a4d165a Common: Add tests for PypubsubEventQueue
All the unsubscribing tests fails for some reason right now. The
subscriber is unsubscribed from the specified topics but the subscriber
is still called when an event with that topic is published.
2022-08-08 23:57:15 +05:30
Shreya Malviya b1017e2222 Common: Fix import in common/events/__init__.py 2022-08-08 23:54:29 +05:30
Shreya Malviya 9c5bbfe35c Common: Fix some logic in PypubsubEventQueue 2022-08-08 23:54:01 +05:30
Shreya Malviya b78282ef20 Common: Implement unsubscribing functions in PypubsubEventQueue 2022-08-08 13:42:55 +05:30
Shreya Malviya 0578a6fcc8 Common: Add unsubscribing functions to IEventQueue 2022-08-08 13:38:27 +05:30
Shreya Malviya 84c800b815 Common: Remove MRO logic from PypubsubEventQueue
This isn't needed. The Agent's responsibility is to just declare what it
did in the form of events.

For example, although CredentialsStolenEvent is a type of SecurityEvent
technically, the Agent doesn't care about this. The Island does, which
is why this should be handled on the pub/sub implementation on the
Island side. The Agent merely conveys the information that it stole
credentials. Whatever is to be done or however that information is to be
handled after that is the Island's responsibility.

I don't see a use case in the Agent where a concrete event is derived
from another concrete event. So, the MRO logic is removed in this
commit.
2022-08-08 13:33:52 +05:30
Shreya Malviya d773bac8c1 Common: Simplify logic in PypubsubEventQueue 2022-08-08 13:11:07 +05:30
Shreya Malviya 8ae451f240 Common: Implement publish() in PypubsubEventQueue 2022-08-08 12:49:21 +05:30
Shreya Malviya 1fbe9e5ad4 Common: Make methods static in PypubsubEventQueue 2022-08-08 12:07:45 +05:30
Shreya Malviya 414e8127ed Common: Implement subscribe_tags() in PypubsubEventQueue 2022-08-08 12:03:17 +05:30
Shreya Malviya bb76410bac Common: Create and partially implement PypubsubEventQueue 2022-08-05 19:11:33 +05:30
Shreya Malviya 40219aa5ff Common: Add TODO in IEventQueue 2022-08-05 19:05:07 +05:30
Shreya Malviya 924fc3f1e2 Common: Make all methods of IEventQueue static 2022-08-05 18:51:07 +05:30
Shreya Malviya ac62281c84 Agent: Add pypubsub as a dependency 2022-08-05 18:45:34 +05:30
Shreya Malviya b027686b2f Island: Add pypubsub as a dependency 2022-08-05 18:44:41 +05:30
Shreya Malviya 41ea4a901b Common: Add IEventQueue 2022-08-05 18:25:00 +05:30
Shreya Malviya 89b194d0ae
Merge pull request #2167 from guardicore/2109-refactor-ip-addresses-resource
Refactor IPAddresses resource
2022-08-05 13:54:33 +05:30
Shreya Malviya 2be0e088e0 Island: Fix all references to 'local' IPs which may not always be local 2022-08-05 13:52:41 +05:30
Shreya Malviya 4095e130f9 Island: Don't return IP addresses from Root resource's GET 2022-08-05 13:52:41 +05:30
Shreya Malviya 3f14b96b71 UI: Get IP addresses from /api/island/ip-addresses instead of /api in AWSRunOptions.js 2022-08-05 13:52:41 +05:30
Mike Salvatore 2e05987e7e Revert "UT: Hacky workaround in StubDIContainer to get the tests passing for now"
This reverts commit eb4f704597. This was
resolved by 5f91e39 instead.
2022-08-05 13:52:12 +05:30
Mike Salvatore 44c73db2af
Merge pull request #2164 from guardicore/2109-compare-versions-ui
2109 compare versions UI
2022-08-04 13:58:35 -04:00
Mike Salvatore 5f91e39b39 Common: Handle classes without __name__ in DIContainer 2022-08-04 10:50:53 -04:00