@cryptotaxi247 / CoPilot / commits / 57d028f0

Minor tweaks (#307)

* comment out db logging for now dont really want to use it since docker logs are more usefull and dont have log rotation in db yet * only handle errors and not all requests * feat: add customer provision presets * feat: Fix typo in WazuhDashboard enum The commit message suggests fixing a typo in the `WazuhDashboard` enum by changing `EDR_AD_INVENOTRY` to `EDR_AD_INVENTORY`. * chore: comment logging middleware in copilot.py * precommit fixes --------- Co-authored-by: Davide Di Modica <webmaster.ddm@gmail.com>

taylor_socfortress committed Sep 27, 2024 at 08:52 UTC 57d028f0f5c53bee9af34c992227fd3e4734da40
4 files changed +37 -13
backend/app/connectors/grafana/schema/dashboards.py
+1 -1
@@ -42,7 +42,7 @@ class WazuhDashboard(Enum):
42 EDR_COMPLIANCE = ("Wazuh", "edr_compliance.json")
43 EDR_AV_MALWARE_IOC = ("Wazuh", "edr_av_malware_ioc.json")
44 EDR_AGENT_INVENTORY = ("Wazuh", "edr_agent_inventory.json")
45 - EDR_AD_INVENOTRY = ("Wazuh", "edr_ad_inventory.json")
45 + EDR_AD_INVENTORY = ("Wazuh", "edr_ad_inventory.json")
46 EDR_SYSTEM_VULNERABILITIES_NEW = ("Wazuh", "edr_system_vulnerabilities_new.json")
47
48
backend/copilot.py
+4 -2
@@ -28,7 +28,6 @@ from app.db.db_setup import ensure_scheduler_user_removed
28 from app.middleware.exception_handlers import custom_http_exception_handler
29 from app.middleware.exception_handlers import validation_exception_handler
30 from app.middleware.exception_handlers import value_error_handler
31 -from app.middleware.logger import log_requests
31
32 # from app.routers import ask_socfortress
33 from app.routers import active_response
@@ -75,6 +74,9 @@ from app.routers import wazuh_manager
74 from app.schedulers.scheduler import get_scheduler_instance
75 from app.schedulers.scheduler import init_scheduler
76
77 +# from app.middleware.logger import log_requests
78 +
79 +
80 auth_handler = AuthHandler()
81 # Get the `SERVER_IP` from the `.env` file
82 load_dotenv()
@@ -103,7 +105,7 @@ app.add_middleware(
105
106 ################## ! Middleware LOGGING TO `log_entry` table ! ##################
107 # Comment out logging for now, not sure I want to use it
106 -app.middleware("http")(log_requests) # using the imported middleware
108 +# app.middleware("http")(log_requests) # using the imported middleware
109
110
111 ################## ! Exception Handlers ! ##################
frontend/src/components/customers/provision/CustomerProvisionWizard.vue
+23 -2
@@ -273,7 +273,7 @@ import {
273 import isIP from "validator/es/lib/isIP"
274 import isPort from "validator/es/lib/isPort"
275 import isURL from "validator/es/lib/isURL"
276 -import { computed, onBeforeMount, ref, toRefs } from "vue"
276 +import { computed, onBeforeMount, ref, toRefs, watch } from "vue"
277
278 const props = defineProps<{
279 customerCode: string
@@ -560,7 +560,14 @@ function toggleDashboards() {
560 if (allDashboardsSelected.value) {
561 form.value.dashboards_to_include.dashboards = []
562 } else {
563 - form.value.dashboards_to_include.dashboards = dashboardOptions.value.map(o => o.value)
563 + form.value.dashboards_to_include.dashboards = dashboardOptions.value
564 + .filter(
565 + o =>
566 + !["EDR_WAZUH_INVENOTRY", "EDR_WAZUH_INVENTORY", "EDR_AGENT_INVENTORY"]
567 + .map(d => d.toLowerCase())
568 + .includes(o.value.toLowerCase())
569 + )
570 + .map(o => o.value)
571 }
572 }
573
@@ -614,6 +621,20 @@ async function submit() {
621 })
622 }
623
624 +function formPreset(step: number) {
625 + switch (step) {
626 + case 2:
627 + if (!form.value.customer_index_name) {
628 + form.value.customer_index_name = `wazuh-${form.value.customer_code}`
629 + }
630 + break
631 + }
632 +}
633 +
634 +watch(current, val => {
635 + formPreset(val)
636 +})
637 +
638 onBeforeMount(() => {
639 getProvisioningDefaultSettings()
640 getSubscriptions()
frontend/src/components/incidentManagement/alerts/AlertsList.vue
+9 -8
@@ -150,14 +150,15 @@ import { computed, nextTick, onBeforeMount, provide, ref, watch } from "vue"
150 import AlertItem from "./AlertItem.vue"
151 import AlertsFilters from "./AlertsFilters.vue"
152
153 -const { highlight, preset, showFilters } = withDefaults(
154 - defineProps<{
155 - highlight?: string | null
156 - preset?: AlertsListFilter[]
157 - showFilters?: boolean
158 - }>(),
159 - { showFilters: true }
160 -)
153 +const {
154 + highlight,
155 + preset,
156 + showFilters = true
157 +} = defineProps<{
158 + highlight?: string | null
159 + preset?: AlertsListFilter[]
160 + showFilters?: boolean
161 +}>()
162
163 const FilterIcon = "carbon:filter-edit"
164 const InfoIcon = "carbon:information"