@cryptotaxi247 / CoPilot / commits / 00f2ff6b

Refactor sync vulnerabilities route to remove unnecessary comments and whitespace

taylorwalton committed Dec 12, 2024 at 13:04 UTC 00f2ff6b22fbb11bec306a9929048980f08ecabc
1 file changed +1 -11
backend/app/agents/routes/agents.py
+1 -11
@@ -795,7 +795,6 @@ async def delete_agent(
795 message=f"Agent {agent_id} deleted successfully",
796 )
797
798 -
798 @agents_router.get(
799 "/sync/vulnerabilities",
800 description="Sync agent vulnerabilities",
@@ -824,20 +823,12 @@ async def sync_vulnerabilities_route(
823 @agents_router.get(
824 "/sync/vulnerabilities/{customer_code}",
825 description="Sync agent vulnerabilities",
826 + dependencies=[Security(AuthHandler().require_any_scope("admin", "analyst"))],
827 )
828 async def sync_vulnerabilities_customer_code_route(
829 customer_code: str,
830 session: AsyncSession = Depends(get_db),
831 - dependencies=[Security(AuthHandler().require_any_scope("admin", "analyst"))],
831 ):
833 - """
834 - Only applies to Wazuh Manager Version 4.8.1 or higher.
835 - 1. Loops through all agents in the database to collect their agent_name and customer code.
836 - 2. Queries the `wazuh-states-vulnerabilities-*` index in Wazuh Indexer to get vulnerabilities based on the agent_name.
837 - 3. Checks the `wazuh-vulnerabilities-*customer_code*` index in Wazuh Indexer to get vulnerabilities based on the
838 - agent_name and checks to see if a vulnerability_id already exists.
839 - 4. If the vulnerability_id does not exist, it is sent to the Graylog GELF Input.
840 - """
832 logger.info("Syncing agent vulnerabilities")
833 agents = await get_agents_by_customer_code(customer_code, session)
834 for agent in agents:
@@ -847,7 +838,6 @@ async def sync_vulnerabilities_customer_code_route(
838 await sync_agent_vulnerabilities(agent.hostname, customer_code)
839 return {"success": True, "message": "Agent vulnerabilities synced successfully"}
840
850 -
841 # ! TODO: CURRENTLY UPDATES IN THE DB BUT NEED TO UPDATE IN WAZUH # !
842 # @agents_router.put(
843 # "/{agent_id}/update-customer-code",